-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
90 lines (69 loc) · 2.18 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
.PHONY: clean all install
PLATFORM = $(shell uname)
MACHINE = $(shell uname -m)
all: libradb.a
*.o: *.h
override CFLAGS += -std=gnu99 -fstrict-aliasing -Wstrict-aliasing -Wall \
-I. -DGC_THREADS -D_GNU_SOURCE -D$(PLATFORM)
ifdef DEBUG
override CFLAGS += -g -DGC_DEBUG -DDEBUG
else
override CFLAGS += -O3 -g -momit-leaf-frame-pointer -foptimize-sibling-calls -fno-stack-protector -march=native -mtune=native -mno-sse2 -minline-all-stringops
endif
ifeq ($(RADB_MEM), MALLOC)
config.h: config.h.in
sed 's/RADB_MEM_MODE/RADB_MEM_MALLOC/g' config.h.in > config.h
else ifeq ($(RADB_MEM), GC)
config.h: config.h.in
sed 's/RADB_MEM_MODE/RADB_MEM_GC/g' config.h.in > config.h
else
config.h: config.h.in
sed 's/RADB_MEM_MODE/RADB_MEM_PER_STORE/g' config.h.in > config.h
endif
common_objects = string.o fixed.o common.o linear_index.o string_index2.o fixed_index2.o linear_index0.o string_index0.o
platform_objects =
ifeq ($(MACHINE), i686)
override CFLAGS += -fno-pic
endif
ifeq ($(PLATFORM), Linux)
platform_objects +=
override CFLAGS += -fcf-protection=none -mno-align-stringops -fno-tree-loop-distribute-patterns
endif
ifeq ($(PLATFORM), FreeBSD)
platform_objects +=
override CFLAGS += -I/usr/local/include
endif
ifeq ($(PLATFORM), Darwin)
platform_objects +=
endif
$(common_objects): config.h
libradb.a: $(common_objects) $(platform_objects)
ar rcs $@ $(common_objects) $(platform_objects)
clean:
rm -f config.h
rm -f *.o
rm -f libradb.a
PREFIX = /usr
install_include = $(DESTDIR)$(PREFIX)/include/radb
install_lib = $(DESTDIR)$(PREFIX)/lib
install_h = \
$(install_include)/radb.h \
$(install_include)/config.h \
$(install_include)/common.h \
$(install_include)/string_store.h \
$(install_include)/string_index.h \
$(install_include)/fixed_store.h \
$(install_include)/fixed_index.h \
$(install_include)/linear_index.h \
$(install_include)/string_index2.h \
$(install_include)/fixed_index2.h \
$(install_include)/linear_index0.h \
$(install_include)/string_index0.h
install_a = $(install_lib)/libradb.a
$(install_h): $(install_include)/%: %
mkdir -p $(install_include)
cp $< $@
$(install_a): $(install_lib)/%: %
mkdir -p $(install_lib)
cp $< $@
install: $(install_h) $(install_a)