forked from aerospike/aerospike-common
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
179 lines (148 loc) · 5.38 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
###############################################################################
## SETTINGS ##
###############################################################################
include project/settings.mk
# Modules
MODULES :=
# Override optimizations via: make O=n
O = 3
# Make-local Compiler Flags
CC_FLAGS = -std=gnu99 -g -Wall -fPIC -O$(O)
CC_FLAGS += -fno-common -fno-strict-aliasing
CC_FLAGS += -D_FILE_OFFSET_BITS=64 -D_REENTRANT -D_GNU_SOURCE $(EXT_CFLAGS)
ifneq ($(ARCH),$(filter $(ARCH),ppc64 ppc64le))
CC_FLAGS += -march=nocona
endif
PREPRO_SUFFIX = .cpp
ifeq ($(PREPRO),1)
SUFFIX = $(PREPRO_SUFFIX)
CC_FLAGS += -E -DPREPRO=$(PREPRO) -DGEN_TAG=$(GEN_TAG)"\
"
endif
ifeq ($(OS),Darwin)
CC_FLAGS += -D_DARWIN_UNLIMITED_SELECT
# homebrew openssl include path
ifneq ($(wildcard /usr/local/opt/openssl/include),)
CC_FLAGS += -I/usr/local/opt/openssl/include
endif
# macports openssl include path
ifneq ($(wildcard /opt/local/include/openssl),)
CC_FLAGS += -I/opt/local/include
endif
else ifeq ($(OS),FreeBSD)
CC_FLAGS += -finline-functions
else
CC_FLAGS += -finline-functions -rdynamic
ifneq ($(wildcard /etc/alpine-release),)
CC_FLAGS += -DAS_ALPINE
endif
endif
ifneq ($(CF), )
CC_FLAGS += -I$(CF)/include
endif
# Linker flags
LD_FLAGS = $(LDFLAGS)
ifeq ($(OS),Darwin)
LD_FLAGS += -undefined dynamic_lookup
endif
# DEBUG Settings
ifdef DEBUG
O=0
CC_FLAGS += -pg -fprofile-arcs -ftest-coverage -g2
LD_FLAGS += -pg -fprofile-arcs -lgcov
endif
###############################################################################
## OBJECTS ##
###############################################################################
AEROSPIKE-OBJECTS =
AEROSPIKE-OBJECTS += as_aerospike.o
AEROSPIKE-OBJECTS += as_arraylist.o
AEROSPIKE-OBJECTS += as_arraylist_hooks.o
AEROSPIKE-OBJECTS += as_arraylist_iterator.o
AEROSPIKE-OBJECTS += as_arraylist_iterator_hooks.o
AEROSPIKE-OBJECTS += as_boolean.o
AEROSPIKE-OBJECTS += as_buffer.o
AEROSPIKE-OBJECTS += as_buffer_pool.o
AEROSPIKE-OBJECTS += as_bytes.o
AEROSPIKE-OBJECTS += as_double.o
AEROSPIKE-OBJECTS += as_geojson.o
AEROSPIKE-OBJECTS += as_hashmap.o
AEROSPIKE-OBJECTS += as_hashmap_hooks.o
AEROSPIKE-OBJECTS += as_hashmap_iterator.o
AEROSPIKE-OBJECTS += as_hashmap_iterator_hooks.o
AEROSPIKE-OBJECTS += as_integer.o
AEROSPIKE-OBJECTS += as_iterator.o
AEROSPIKE-OBJECTS += as_list.o
AEROSPIKE-OBJECTS += as_log.o
AEROSPIKE-OBJECTS += as_map.o
AEROSPIKE-OBJECTS += as_memtracker.o
AEROSPIKE-OBJECTS += as_module.o
AEROSPIKE-OBJECTS += as_msgpack.o
AEROSPIKE-OBJECTS += as_msgpack_ext.o
AEROSPIKE-OBJECTS += as_msgpack_serializer.o
AEROSPIKE-OBJECTS += as_nil.o
AEROSPIKE-OBJECTS += as_pair.o
AEROSPIKE-OBJECTS += as_password.o
AEROSPIKE-OBJECTS += as_queue.o
AEROSPIKE-OBJECTS += as_queue_mt.o
AEROSPIKE-OBJECTS += as_random.o
AEROSPIKE-OBJECTS += as_rec.o
AEROSPIKE-OBJECTS += as_result.o
AEROSPIKE-OBJECTS += as_serializer.o
AEROSPIKE-OBJECTS += as_stream.o
AEROSPIKE-OBJECTS += as_string.o
AEROSPIKE-OBJECTS += as_string_builder.o
AEROSPIKE-OBJECTS += as_thread_pool.o
AEROSPIKE-OBJECTS += as_timer.o
AEROSPIKE-OBJECTS += as_val.o
AEROSPIKE-OBJECTS += as_vector.o
AEROSPIKE-OBJECTS += crypt_blowfish.o
AEROSPIKE-OBJECTS += ssl_util.o
CITRUSLEAF-OBJECTS =
CITRUSLEAF-OBJECTS += cf_alloc.o
CITRUSLEAF-OBJECTS += cf_b64.o
CITRUSLEAF-OBJECTS += cf_clock.o
CITRUSLEAF-OBJECTS += cf_crypto.o
CITRUSLEAF-OBJECTS += cf_digest.o
CITRUSLEAF-OBJECTS += cf_ll.o
CITRUSLEAF-OBJECTS += cf_queue.o
CITRUSLEAF-OBJECTS += cf_queue_priority.o
CITRUSLEAF-OBJECTS += cf_random.o
CITRUSLEAF-OBJECTS += cf_vector.o
OBJECTS =
OBJECTS += $(AEROSPIKE-OBJECTS:%=$(TARGET_OBJ)/common/aerospike/%)
OBJECTS += $(CITRUSLEAF-OBJECTS:%=$(TARGET_OBJ)/common/citrusleaf/%)
HEADER-SRC = $(shell find $(SOURCE_INCL) -type f -name "*.h")
HEADER-TRG = $(patsubst $(SOURCE_INCL)/%.h, $(TARGET_INCL)/%.h, $(HEADER-SRC))
###############################################################################
## MAIN TARGETS ##
###############################################################################
.PHONY: all
all: build prepare
.PHONY: build
build: libaerospike-common
.PHONY: prepare
prepare: $(HEADER-TRG)
.PHONY: clean
clean:
@rm -rf $(TARGET)
.PHONY: libaerospike-common libaerospike-common.a libaerospike-common.$(DYNAMIC_SUFFIX)
libaerospike-common: libaerospike-common.a libaerospike-common.$(DYNAMIC_SUFFIX)
libaerospike-common.a: $(TARGET_LIB)/libaerospike-common.a
libaerospike-common.$(DYNAMIC_SUFFIX): $(TARGET_LIB)/libaerospike-common.$(DYNAMIC_SUFFIX)
###############################################################################
## BUILD TARGETS ##
###############################################################################
$(TARGET_OBJ)/common/aerospike/%.o: $(SOURCE_MAIN)/aerospike/%.c $(SOURCE_INCL)/aerospike/*.h
$(object)
$(TARGET_OBJ)/common/citrusleaf/%.o: $(SOURCE_MAIN)/citrusleaf/%.c $(SOURCE_INCL)/citrusleaf/*.h
$(object)
$(TARGET_LIB)/libaerospike-common.$(DYNAMIC_SUFFIX): $(OBJECTS)
$(library)
$(TARGET_LIB)/libaerospike-common.a: $(OBJECTS)
$(archive)
$(TARGET_INCL)/%.h: $(SOURCE_INCL)/%.h
@mkdir -p $(@D)
cp $< $@
###############################################################################
include project/test.mk project/rules.mk