]> mj.ucw.cz Git - libucw.git/blob - ucw/Makefile
Merge branch 'dev-lib' of ssh://git.ucw.cz/projects/sherlock/GIT/sherlock into dev-lib
[libucw.git] / ucw / Makefile
1 # Makefile for the UCW Library (c) 1997--2008 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         mmap partmap hashfunc \
14         slists simple-lists bitsig \
15         log log-file proctitle \
16         conf-alloc conf-dump conf-input conf-intr conf-journal conf-parse conf-section \
17         ipaccess \
18         profile \
19         fastbuf ff-binary ff-string ff-printf ff-unicode ff-stkstring \
20         fb-file carefulio fb-mem fb-temp tempfile fb-mmap fb-limfd fb-buffer fb-grow fb-pool fb-atomic fb-param fb-socket \
21         char-cat char-upper char-lower unicode stkstring \
22         wildmatch regex \
23         prime primetable random timer randomkey \
24         bit-ffs bit-fls \
25         url \
26         mainloop exitstatus runcmd sighandler \
27         lizard lizard-safe adler32 \
28         md5 sha1 sha1-hmac \
29         base64 base224 \
30         sync \
31         qache \
32         string str-esc str-split str-match str-imatch str-hex \
33         bbuf \
34         getopt
35
36 LIBUCW_MAIN_INCLUDES= \
37         lib.h threads.h \
38         mempool.h \
39         arraysort.h \
40         clists.h slists.h simple-lists.h \
41         string.h stkstring.h unicode.h chartype.h regex.h \
42         wildmatch.h \
43         unaligned.h prefetch.h \
44         bbuf.h gbuf.h bitarray.h bitsig.h \
45         hashfunc.h hashtable.h \
46         heap.h binheap.h binheap-node.h \
47         redblack.h \
48         prime.h \
49         bitops.h \
50         conf.h getopt.h ipaccess.h \
51         profile.h \
52         fastbuf.h lfs.h ff-unicode.h ff-binary.h \
53         url.h \
54         mainloop.h \
55         lizard.h \
56         md5.h \
57         base64.h base224.h \
58         qache.h \
59         kmp.h kmp-search.h binsearch.h \
60         partmap.h
61
62 ifdef CONFIG_UCW_THREADS
63 # Some modules require threading
64 LIBUCW_MODS+=threads-conf workqueue asio fb-direct
65 LIBUCW_MAIN_INCLUDES+=workqueue.h semaphore.h asio.h
66 endif
67
68 ifdef CONFIG_OWN_GETOPT
69 include $(s)/ucw/getopt/Makefile
70 endif
71
72 LIBUCW_INCLUDES=$(LIBUCW_MAIN_INCLUDES)
73
74 include $(s)/ucw/sorter/Makefile
75 include $(s)/ucw/doc/Makefile
76
77 LIBUCW_MOD_PATHS=$(addprefix $(o)/ucw/,$(LIBUCW_MODS))
78
79 $(o)/ucw/libucw.a: $(addsuffix .o,$(LIBUCW_MOD_PATHS))
80 $(o)/ucw/libucw.so: $(addsuffix .oo,$(LIBUCW_MOD_PATHS))
81
82 $(o)/ucw/hashfunc.o $(o)/ucw/hashfunc.oo: CFLAGS += -funroll-loops
83 $(o)/ucw/lizard.o: CFLAGS += $(COPT2) -funroll-loops
84
85 $(o)/ucw/conf-test: $(o)/ucw/conf-test.o $(LIBUCW)
86 $(o)/ucw/lfs-test: $(o)/ucw/lfs-test.o $(LIBUCW)
87 $(o)/ucw/hash-test: $(o)/ucw/hash-test.o $(LIBUCW)
88 $(o)/ucw/hashfunc-test: $(o)/ucw/hashfunc-test.o $(LIBUCW)
89 $(o)/ucw/asort-test: $(o)/ucw/asort-test.o $(LIBUCW)
90 $(o)/ucw/redblack-test: $(o)/ucw/redblack-test.o $(LIBUCW)
91 $(o)/ucw/binheap-test: $(o)/ucw/binheap-test.o $(LIBUCW)
92 $(o)/ucw/lizard-test: $(o)/ucw/lizard-test.o $(LIBUCW)
93 $(o)/ucw/kmp-test: $(o)/ucw/kmp-test.o $(LIBUCW) $(LIBCHARSET)
94 $(o)/ucw/ipaccess-test: $(o)/ucw/ipaccess-test.o $(LIBUCW)
95 $(o)/ucw/trie-test: $(o)/ucw/trie-test.o $(LIBUCW)
96
97 TESTS+=$(addprefix $(o)/ucw/,regex.test unicode.test hash-test.test mempool.test stkstring.test \
98     slists.test kmp-test.test bbuf.test getopt.test ff-unicode.test eltpool.test \
99     fb-socket.test trie-test.test string.test sha1.test asort-test.test binheap-test.test \
100     redblack-test.test fb-file.test fb-grow.test fb-pool.test fb-atomic.test \
101     fb-limfd.test fb-temp.test fb-mem.test fb-buffer.test fb-mmap.test url.test)
102
103 $(o)/ucw/regex.test: $(o)/ucw/regex-t
104 $(o)/ucw/unicode.test: $(o)/ucw/unicode-t
105 $(o)/ucw/hash-test.test: $(o)/ucw/hash-test
106 $(o)/ucw/mempool.test: $(o)/ucw/mempool-t $(o)/ucw/mempool-fmt-t $(o)/ucw/mempool-str-t
107 $(o)/ucw/stkstring.test: $(o)/ucw/stkstring-t
108 $(o)/ucw/bitops.test: $(o)/ucw/bit-ffs-t $(o)/ucw/bit-fls-t
109 $(o)/ucw/slists.test: $(o)/ucw/slists-t
110 $(o)/ucw/kmp-test.test: $(o)/ucw/kmp-test
111 $(o)/ucw/bbuf.test: $(o)/ucw/bbuf-t
112 $(o)/ucw/getopt.test: $(o)/ucw/getopt-t
113 $(o)/ucw/ff-unicode.test: $(o)/ucw/ff-unicode-t
114 $(o)/ucw/eltpool.test: $(o)/ucw/eltpool-t
115 $(o)/ucw/string.test: $(o)/ucw/str-hex-t $(o)/ucw/str-esc-t
116 $(o)/ucw/sha1.test: $(o)/ucw/sha1-t $(o)/ucw/sha1-hmac-t
117 $(o)/ucw/trie-test.test: $(o)/ucw/trie-test
118 $(o)/ucw/asort-test.test: $(o)/ucw/asort-test
119 $(o)/ucw/binheap-test.test: $(o)/ucw/binheap-test
120 $(o)/ucw/redblack-test.test: $(o)/ucw/redblack-test
121 $(addprefix $(o)/ucw/fb-,file.test grow.test pool.test socket.test atomic.test \
122         limfd.test temp.test mem.test buffer.test mmap.test): %.test: %-t
123 $(o)/ucw/url.test: $(o)/ucw/url-t
124
125 ifdef CONFIG_UCW_THREADS
126 TESTS+=$(addprefix $(o)/ucw/,asio.test)
127 $(o)/ucw/asio.test: $(o)/ucw/asio-t
128 endif
129
130 # The version of autoconf.h that is a part of the public API needs to have
131 # the internal symbols filtered out, so we generate ucw/autoconf.h in the
132 # configure script and let the public config.h refer to <ucw/autoconf.h>
133 # instead of plain "autoconf.h".
134
135 API_LIBS+=libucw
136 API_INCLUDES+=$(o)/ucw/.include-stamp
137 $(o)/ucw/.include-stamp: $(addprefix $(s)/ucw/,$(LIBUCW_INCLUDES)) $(o)/ucw/autoconf.h
138         $(Q)$(s)/build/install-includes $(<D) run/include/ucw $(LIBUCW_INCLUDES)
139         $(Q)$(s)/build/install-includes $(o)/ucw run/include/ucw autoconf.h
140         $(Q)sed -e 's/^#include "autoconf\.h"/#include <ucw\/autoconf.h>/' <$(s)/ucw/config.h >run/include/ucw/config.h
141         $(Q)touch $@
142 run/lib/pkgconfig/libucw.pc: $(o)/ucw/libucw.pc
143
144 ifdef CONFIG_UCW_PERL
145 include $(s)/ucw/perl/Makefile
146 endif
147
148 ifdef CONFIG_UCW_SHELL_UTILS
149 include $(s)/ucw/shell/Makefile
150 endif
151
152 INSTALL_TARGETS+=install-libucw
153 install-libucw:
154         install -d -m 755 $(DESTDIR)$(INSTALL_LIB_DIR) $(DESTDIR)$(INSTALL_INCLUDE_DIR)/ucw/ $(DESTDIR)$(INSTALL_PKGCONFIG_DIR) $(DESTDIR)$(INSTALL_CONFIG_DIR)
155         install -m 644 $(addprefix run/include/ucw/,$(LIBUCW_MAIN_INCLUDES) autoconf.h config.h) $(DESTDIR)$(INSTALL_INCLUDE_DIR)/ucw/
156         install -m 644 run/lib/pkgconfig/libucw.pc $(DESTDIR)$(INSTALL_PKGCONFIG_DIR)
157         install -m 644 run/lib/libucw.$(LS) $(DESTDIR)$(INSTALL_LIB_DIR)
158         install -m 644 run/cf/libucw $(DESTDIR)$(INSTALL_CONFIG_DIR)
159
160 .PHONY: install-libucw