]> mj.ucw.cz Git - libucw.git/blob - ucw/Makefile
LibUCW: Added fb-socket.h header to public API.
[libucw.git] / ucw / Makefile
1 # Makefile for the UCW Library (c) 1997--2010 Martin Mares <mj@ucw.cz>
2
3 DIRS+=ucw
4 LIBUCW=$(o)/ucw/libucw.pc
5
6 ifdef CONFIG_UCW_UTILS
7 include $(s)/ucw/utils/Makefile
8 endif
9
10 LIBUCW_MODS= \
11         threads \
12         alloc alloc_str realloc bigalloc mempool mempool-str mempool-fmt eltpool \
13         partmap hashfunc \
14         slists simple-lists bitsig \
15         log log-stream log-file log-syslog log-conf tbf \
16         conf-context conf-alloc conf-dump conf-input conf-intr conf-journal conf-parse conf-section conf-getopt \
17         ipaccess \
18         fastbuf ff-binary ff-string ff-printf ff-unicode ff-varint ff-stkstring \
19         fb-file fb-mem fb-temp tempfile fb-mmap fb-limfd fb-buffer fb-grow fb-pool fb-atomic fb-param fb-socket fb-multi \
20         char-cat char-upper char-lower unicode varint stkstring \
21         wildmatch regex \
22         prime primetable random \
23         time-stamp time-timer time-conf \
24         bit-ffs bit-fls bit-array \
25         url \
26         mainloop main-block main-rec \
27         proctitle exitstatus runcmd \
28         lizard lizard-safe adler32 sighandler \
29         md5 sha1 sha1-hmac crc crc-tables \
30         base64 base224 \
31         io-careful io-sync io-mmap io-size \
32         string str-esc str-split str-match str-imatch str-hex str-fix \
33         bbuf gary \
34         getopt \
35         strtonum \
36         resource trans res-fd res-mem res-subpool res-mempool res-eltpool \
37         daemon daemon-ctrl \
38         signames
39
40 LIBUCW_MAIN_INCLUDES= \
41         lib.h log.h threads.h time.h \
42         mempool.h eltpool.h \
43         clists.h slists.h simple-lists.h \
44         string.h stkstring.h unicode.h varint.h chartype.h regex.h \
45         wildmatch.h \
46         unaligned.h \
47         bbuf.h gbuf.h gary.h bitarray.h bitsig.h \
48         hashfunc.h hashtable.h \
49         heap.h binheap.h binheap-node.h \
50         redblack.h \
51         prime.h \
52         bitops.h \
53         conf.h getopt.h ipaccess.h \
54         fastbuf.h io.h ff-unicode.h ff-varint.h ff-binary.h fb-socket.h \
55         url.h \
56         mainloop.h \
57         process.h \
58         lizard.h \
59         md5.h sha1.h crc.h \
60         base64.h base224.h \
61         kmp.h kmp-search.h binsearch.h \
62         partmap.h \
63         strtonum.h \
64         resource.h trans.h \
65         daemon.h \
66         signames.h \
67         sighandler.h
68
69 ifdef CONFIG_UCW_THREADS
70 # Some modules require threading
71 LIBUCW_MODS+=threads-conf workqueue asio
72 LIBUCW_MAIN_INCLUDES+=workqueue.h semaphore.h asio.h
73 endif
74
75 ifdef CONFIG_UCW_FB_DIRECT
76 LIBUCW_MODS+=fb-direct
77 endif
78
79 ifdef CONFIG_UCW_OWN_GETOPT
80 include $(s)/ucw/getopt/Makefile
81 endif
82
83 LIBUCW_INCLUDES=$(LIBUCW_MAIN_INCLUDES)
84
85 include $(s)/ucw/sorter/Makefile
86 include $(s)/ucw/doc/Makefile
87
88 LIBUCW_MOD_PATHS=$(addprefix $(o)/ucw/,$(LIBUCW_MODS))
89
90 $(o)/ucw/libucw.a: $(addsuffix .o,$(LIBUCW_MOD_PATHS))
91 $(o)/ucw/libucw-pic.a: $(addsuffix .oo,$(LIBUCW_MOD_PATHS))
92 $(o)/ucw/libucw.so: $(addsuffix .oo,$(LIBUCW_MOD_PATHS))
93 $(o)/ucw/libucw.so: SONAME_SUFFIX=.$(UCW_ABI_MAJOR)
94
95 ifdef CONFIG_STATIC_PIC
96 $(o)/ucw/libucw.pc: $(o)/ucw/libucw-pic.a
97 endif
98 ifdef CONFIG_INSTALL_API
99 $(o)/ucw/libucw.pc: $(addprefix $(o)/ucw/libucw,.a -pic.a .so)
100 endif
101
102 $(o)/ucw/hashfunc.o $(o)/ucw/hashfunc.oo: CFLAGS += -funroll-loops
103 $(o)/ucw/lizard.o: CFLAGS += $(COPT2) -funroll-loops
104
105 $(o)/ucw/ff-varint-t: $(LIBUCW)
106 $(o)/ucw/varint-t: $(LIBUCW)
107 $(o)/ucw/conf-test: $(o)/ucw/conf-test.o $(LIBUCW)
108 $(o)/ucw/hash-test: $(o)/ucw/hash-test.o $(LIBUCW)
109 $(o)/ucw/hashfunc-test: $(o)/ucw/hashfunc-test.o $(LIBUCW)
110 $(o)/ucw/asort-test: $(o)/ucw/asort-test.o $(LIBUCW)
111 $(o)/ucw/redblack-test: $(o)/ucw/redblack-test.o $(LIBUCW)
112 $(o)/ucw/binheap-test: $(o)/ucw/binheap-test.o $(LIBUCW)
113 $(o)/ucw/lizard-test: $(o)/ucw/lizard-test.o $(LIBUCW)
114 $(o)/ucw/kmp-test: $(o)/ucw/kmp-test.o $(LIBUCW)
115 $(o)/ucw/strtonum-test: $(o)/ucw/strtonum-test.o $(LIBUCW)
116 ifdef CONFIG_CHARSET
117 $(o)/ucw/kmp-test: $(LIBCHARSET)
118 endif
119 $(o)/ucw/ipaccess-test: $(o)/ucw/ipaccess-test.o $(LIBUCW)
120 $(o)/ucw/trie-test: $(o)/ucw/trie-test.o $(LIBUCW)
121
122 TESTS+=$(addprefix $(o)/ucw/,varint.test regex.test unicode.test hash-test.test mempool.test stkstring.test \
123     slists.test bbuf.test kmp-test.test getopt.test ff-unicode.test ff-varint.test eltpool.test \
124     fb-socket.test trie-test.test string.test sha1.test asort-test.test binheap-test.test \
125     redblack-test.test fb-file.test fb-grow.test fb-pool.test fb-atomic.test \
126     fb-limfd.test fb-temp.test fb-mem.test fb-buffer.test fb-mmap.test fb-multi.test url.test strtonum-test.test \
127     gary.test time.test crc.test signames.test md5.test bitops.test)
128
129 $(o)/ucw/varint.test: $(o)/ucw/varint-t
130 $(o)/ucw/regex.test: $(o)/ucw/regex-t
131 $(o)/ucw/unicode.test: $(o)/ucw/unicode-t
132 $(o)/ucw/hash-test.test: $(o)/ucw/hash-test
133 $(o)/ucw/mempool.test: $(o)/ucw/mempool-t $(o)/ucw/mempool-fmt-t $(o)/ucw/mempool-str-t
134 $(o)/ucw/stkstring.test: $(o)/ucw/stkstring-t
135 $(o)/ucw/bitops.test: $(o)/ucw/bit-ffs-t $(o)/ucw/bit-fls-t
136 $(o)/ucw/slists.test: $(o)/ucw/slists-t
137 $(o)/ucw/kmp-test.test: $(o)/ucw/kmp-test
138 $(o)/ucw/bbuf.test: $(o)/ucw/bbuf-t
139 $(o)/ucw/getopt.test: $(o)/ucw/getopt-t
140 $(o)/ucw/ff-unicode.test: $(o)/ucw/ff-unicode-t
141 $(o)/ucw/ff-varint.test: $(o)/ucw/ff-varint-t
142 $(o)/ucw/eltpool.test: $(o)/ucw/eltpool-t
143 $(o)/ucw/string.test: $(o)/ucw/str-hex-t $(o)/ucw/str-esc-t $(o)/ucw/str-fix-t
144 $(o)/ucw/sha1.test: $(o)/ucw/sha1-t $(o)/ucw/sha1-hmac-t
145 $(o)/ucw/trie-test.test: $(o)/ucw/trie-test
146 $(o)/ucw/asort-test.test: $(o)/ucw/asort-test
147 $(o)/ucw/binheap-test.test: $(o)/ucw/binheap-test
148 $(o)/ucw/redblack-test.test: $(o)/ucw/redblack-test
149 $(o)/ucw/strtonum-test.test: $(o)/ucw/strtonum-test
150 $(addprefix $(o)/ucw/fb-,file.test grow.test pool.test socket.test atomic.test \
151         limfd.test temp.test mem.test buffer.test mmap.test multi.test): %.test: %-t
152 $(o)/ucw/url.test: $(o)/ucw/url-t
153 $(o)/ucw/gary.test: $(o)/ucw/gary-t
154 $(o)/ucw/time.test: $(o)/ucw/time-conf-t
155 $(o)/ucw/crc.test: $(o)/ucw/crc-t
156 $(o)/ucw/signames.test: $(o)/ucw/signames-t
157 $(o)/ucw/md5.test: $(o)/ucw/md5-t
158
159 ifdef CONFIG_UCW_THREADS
160 TESTS+=$(addprefix $(o)/ucw/,asio.test)
161 $(o)/ucw/asio.test: $(o)/ucw/asio-t
162 endif
163
164 # The version of autoconf.h that is a part of the public API needs to have
165 # the internal symbols filtered out, so we generate ucw/autoconf.h in the
166 # configure script and let the public config.h refer to <ucw/autoconf.h>
167 # instead of plain "autoconf.h".
168
169 API_LIBS+=libucw
170 API_INCLUDES+=$(o)/ucw/.include-stamp
171 $(o)/ucw/.include-stamp: $(addprefix $(s)/ucw/,$(LIBUCW_INCLUDES)) $(o)/ucw/autoconf.h
172         $(Q)$(BUILDSYS)/install-includes $(<D) run/include/ucw $(LIBUCW_INCLUDES)
173         $(Q)$(BUILDSYS)/install-includes $(o)/ucw run/include/ucw autoconf.h
174         $(Q)sed -e 's/^#include "autoconf\.h"/#include <ucw\/autoconf.h>/' <$(s)/ucw/config.h >run/include/ucw/config.h
175         $(Q)touch $@
176 run/lib/pkgconfig/libucw.pc: $(o)/ucw/libucw.pc
177
178 ifdef CONFIG_UCW_PERL
179 include $(s)/ucw/perl/Makefile
180 endif
181
182 ifdef CONFIG_UCW_SHELL_UTILS
183 include $(s)/ucw/shell/Makefile
184 endif
185
186 CONFIGS+=libucw
187
188 INSTALL_LIB_TARGETS+=install-libucw-lib
189 install-libucw-lib:
190         install -d -m 755 $(DESTDIR)$(INSTALL_LIB_DIR)
191         install -m 644 run/lib/libucw.so.$(UCW_ABI_MAJOR) $(DESTDIR)$(INSTALL_LIB_DIR)/libucw.so.$(UCW_ABI_VERSION)
192 .PHONY: install-libucw-lib
193
194 INSTALL_API_TARGETS+=install-libucw-api
195 install-libucw-api:
196         install -d -m 755 $(DESTDIR)$(INSTALL_LIB_DIR) $(DESTDIR)$(INSTALL_INCLUDE_DIR)/ucw/ $(DESTDIR)$(INSTALL_PKGCONFIG_DIR)
197         install -m 644 $(addprefix run/include/ucw/,$(LIBUCW_MAIN_INCLUDES) autoconf.h config.h) $(DESTDIR)$(INSTALL_INCLUDE_DIR)/ucw/
198         install -m 644 run/lib/pkgconfig/libucw.pc $(DESTDIR)$(INSTALL_PKGCONFIG_DIR)
199         ln -sf libucw.so.$(UCW_ABI_VERSION) $(DESTDIR)$(INSTALL_LIB_DIR)/libucw.so
200         install -m 644 run/lib/libucw.a $(DESTDIR)$(INSTALL_LIB_DIR)
201         install -m 644 run/lib/libucw-pic.a $(DESTDIR)$(INSTALL_LIB_DIR)
202 .PHONY: install-libucw-api
203
204 INSTALL_CONFIG_TARGETS+=install-libucw-config
205 install-libucw-config:
206         install -d -m 755 $(DESTDIR)$(INSTALL_CONFIG_DIR)
207         install -m 644 run/$(CONFIG_DIR)/libucw $(DESTDIR)$(INSTALL_CONFIG_DIR)
208 .PHONY: install-libucw-config