forked from xant/libhl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
152 lines (124 loc) · 3.76 KB
/
Makefile.in
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
SHELL = /bin/sh
VPATH = @srcdir@
builddir = @builddir@
top_srcdir = @top_srcdir@
srcdir = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = $(exec_prefix)/bin
infodir = $(prefix)/info
libdir = @libdir@
includedir = @includedir@
mandir = $(prefix)/man/man1
CC = @CC@
CPPFLAGS = @CPPFLAGS@
CFLAGS = $(CPPFLAGS) @CFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
INSTALL = @INSTALL@
UNAME := $(shell uname)
LIBTOOL_DEPS = @LIBTOOL_DEPS@
ifeq ($(UNAME), Darwin)
SHAREDFLAGS = -dynamiclib
SHAREDEXT = dylib
else
SHAREDFLAGS = -shared
SHAREDEXT = so
endif
ifeq ("$(LIBDIR)", "")
LIBDIR = $(libdir)
endif
ifeq ("$(INCDIR)", "")
INCDIR = $(includedir)/libhl
endif
IS_CLANG := $(shell $(CC) --version | grep clang)
ifneq ("$(IS_CLANG)", "")
CLANG_FLAGS=-Wno-undefined-inline -Wno-unknown-warning-option
endif
TARGETS = $(patsubst $(srcdir)/src/%.c, $(builddir)/%.o, $(wildcard $(srcdir)/src/*.c))
TESTS = $(patsubst %.c, %, $(wildcard $(top_srcdir)/test/*_test.c))
TEST_EXEC_ORDER = fbuf_test \
rbuf_test \
linklist_test \
hashtable_test \
rqueue_test \
queue_test \
rbtree_test \
avltree_test \
binheap_test \
pqueue_test \
skiplist_test \
trie_test \
graph_test
all: objects static shared
.PHONY: static
static: objects
./libtool --mode=link ar -r -o $(builddir)/libhl.a $(builddir)/*.lo
.PHONY: shared
shared: objects
./libtool --mode=link $(CC) $(LIBS) $(LDFLAGS) -Wc,$(SHAREDFLAGS) -o $(builddir)/libhl.$(SHAREDEXT) $(builddir)/*.o
%.o : $(srcdir)/src/%.c
./libtool --mode=compile $(CC) -c $(CFLAGS) $< -o $(builddir)/$@
objects: CFLAGS += -fPIC -I$(top_srcdir)/src -Wall -Werror -Wno-parentheses -Wno-pointer-sign -Wno-unused-function $(CLANG_FLAGS) -g -O3
objects: libtool $(TARGETS)
libtool: $(LIBTOOL_DEPS)
$(SHELL) ./config.status libtool
.PHONY: clean
clean:
@echo "Cleaning libhl"
rm -f $(builddir)/*.o
rm -f $(builddir)/*.lo
rm -f $(top_srcdir)/test/*_test
rm -f $(builddir)/libhl.a
rm -f $(builddir)/libhl.$(SHAREDEXT)
rm -f $(builddir)/libtool
@if [ -f $(top_srcdir)/support/libut/libut.a ]; then \
echo "Cleaning libut"; \
make -C $(top_srcdir)/support/libut clean; \
fi
.PHONY: distclean
distclean: clean
rm -rf config.h Makefile config.log configure autom4te.cache config.status
.PHONY: libut
libut:
@cd $(top_srcdir); if [ ! -f $(top_srcdir)/support/libut/Makefile ]; then git submodule init; git submodule update; fi; cd -; make -C $(top_srcdir)/support/libut
.PHONY:tests
tests: CFLAGS += -I$(top_srcdir)/src -I$(top_srcdir)/support/libut/src -Wall -Werror -Wno-parentheses -Wno-pointer-sign -Wno-unused-function $(CLANG_FLAGS) -g -O3
tests: libut static
@for i in $(TESTS); do\
echo "$(CC) $(CFLAGS) $$i.c -o $$i libhl.a $(LDFLAGS) -lm";\
$(CC) $(CFLAGS) $$i.c -o $$i libhl.a $(top_srcdir)/support/libut/libut.a $(LDFLAGS) -lm;\
done;\
CWD=$(pwd);\
cd $(top_srcdir)/test/;\
for i in $(TEST_EXEC_ORDER); do echo; ./$$i; echo; done;\
cd $$CWD;
.PHONY: test
test: tests
.PHONY: install
install:
@echo "Installing libraries in $(LIBDIR)"
cp -v libhl.a $(LIBDIR)/
cp -v libhl.$(SHAREDEXT) $(LIBDIR)/
@echo "Installing headers in $(INCDIR)"
install -d -m=755 $(INCDIR)
cp -v $(top_srcdir)/src/*.h $(INCDIR)/
rm -f $(INCDIR)/atomic_defs.h
.PHONY: docs
docs:
@doxygen libhl.doxycfg
# automatic re-running of configure if the ocnfigure.in file has changed
${srcdir}/configure: configure.in aclocal.m4
cd ${srcdir} && autoconf
# autoheader might not change config.h.in, so touch a stamp file
${srcdir}/config.h.in: stamp-h.in
${srcdir}/stamp-h.in: configure.in aclocal.m4
cd ${srcdir} && autoheader
echo timestamp > ${srcdir}/stamp-h.in
config.h: stamp-h
stamp-h: config.h.in config.status
./config.status
Makefile: Makefile.in config.status
./config.status
config.status: configure
./config.status --recheck