]> mj.ucw.cz Git - libucw.git/blob - ucw/Makefile
Moved some utils from utils/ to ucw/
[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 UCW_UTILS=basecode b224 rotate-log urltool daemon-helper hex
8
9 PROGS+=$(addprefix $(o)/ucw/,$(UCW_UTILS))
10 endif
11
12 LIBUCW_MODS= \
13         threads \
14         alloc alloc_str realloc bigalloc mempool mempool-str mempool-fmt eltpool \
15         mmap partmap hashfunc \
16         slists simple-lists bitsig \
17         log log-file proctitle \
18         conf-alloc conf-dump conf-input conf-intr conf-journal conf-parse conf-section \
19         ipaccess \
20         profile \
21         fastbuf ff-binary ff-string ff-printf ff-unicode ff-stkstring \
22         fb-file carefulio fb-mem fb-temp tempfile fb-mmap fb-limfd fb-buffer fb-grow fb-pool fb-atomic fb-param fb-socket \
23         char-cat char-upper char-lower unicode stkstring \
24         wildmatch regex \
25         prime primetable random timer randomkey \
26         bit-ffs bit-fls \
27         url \
28         mainloop exitstatus runcmd sighandler \
29         lizard lizard-safe adler32 \
30         md5 sha1 sha1-hmac \
31         base64 base224 \
32         sync \
33         qache \
34         string str-esc str-split str-match str-imatch str-hex \
35         bbuf \
36         getopt
37
38 LIBUCW_INCLUDES= \
39         lib.h config.h threads.h \
40         mempool.h \
41         arraysort.h \
42         clists.h slists.h simple-lists.h \
43         string.h stkstring.h unicode.h chartype.h regex.h \
44         wildmatch.h \
45         unaligned.h prefetch.h \
46         bbuf.h gbuf.h bitarray.h bitsig.h \
47         hashfunc.h hashtable.h \
48         heap.h binheap.h binheap-node.h \
49         redblack.h \
50         binsearch.h prime.h \
51         bitops.h \
52         conf.h getopt.h ipaccess.h \
53         profile.h \
54         fastbuf.h lfs.h ff-unicode.h ff-binary.h \
55         url.h \
56         mainloop.h \
57         lizard.h \
58         md5.h \
59         base64.h base224.h \
60         qache.h \
61         kmp.h kmp-search.h binsearch.h \
62         partmap.h
63
64 ifdef CONFIG_UCW_THREADS
65 # Some modules require threading
66 LIBUCW_MODS+=threads-conf workqueue asio fb-direct
67 LIBUCW_INCLUDES+=workqueue.h semaphore.h asio.h
68 endif
69
70 ifdef CONFIG_OWN_GETOPT
71 include $(s)/ucw/getopt/Makefile
72 endif
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 $(o)/ucw/basecode: $(o)/ucw/basecode.o $(LIBUCW)
97
98 TESTS+=$(addprefix $(o)/ucw/,regex.test unicode.test hash-test.test mempool.test stkstring.test \
99     slists.test kmp-test.test bbuf.test getopt.test ff-unicode.test eltpool.test \
100     fb-socket.test trie-test.test string.test sha1.test asort-test.test binheap-test.test \
101     redblack-test.test fb-file.test fb-grow.test fb-pool.test fb-atomic.test \
102     fb-limfd.test fb-temp.test fb-mem.test fb-buffer.test fb-mmap.test url.test)
103
104 $(o)/ucw/regex.test: $(o)/ucw/regex-t
105 $(o)/ucw/unicode.test: $(o)/ucw/unicode-t
106 $(o)/ucw/hash-test.test: $(o)/ucw/hash-test
107 $(o)/ucw/mempool.test: $(o)/ucw/mempool-t $(o)/ucw/mempool-fmt-t $(o)/ucw/mempool-str-t
108 $(o)/ucw/stkstring.test: $(o)/ucw/stkstring-t
109 $(o)/ucw/bitops.test: $(o)/ucw/bit-ffs-t $(o)/ucw/bit-fls-t
110 $(o)/ucw/slists.test: $(o)/ucw/slists-t
111 $(o)/ucw/kmp-test.test: $(o)/ucw/kmp-test
112 $(o)/ucw/bbuf.test: $(o)/ucw/bbuf-t
113 $(o)/ucw/getopt.test: $(o)/ucw/getopt-t
114 $(o)/ucw/ff-unicode.test: $(o)/ucw/ff-unicode-t
115 $(o)/ucw/eltpool.test: $(o)/ucw/eltpool-t
116 $(o)/ucw/string.test: $(o)/ucw/str-hex-t $(o)/ucw/str-esc-t
117 $(o)/ucw/sha1.test: $(o)/ucw/sha1-t $(o)/ucw/sha1-hmac-t
118 $(o)/ucw/trie-test.test: $(o)/ucw/trie-test
119 $(o)/ucw/asort-test.test: $(o)/ucw/asort-test
120 $(o)/ucw/binheap-test.test: $(o)/ucw/binheap-test
121 $(o)/ucw/redblack-test.test: $(o)/ucw/redblack-test
122 $(addprefix $(o)/ucw/fb-,file.test grow.test pool.test socket.test atomic.test \
123         limfd.test temp.test mem.test buffer.test mmap.test): %.test: %-t
124 $(o)/ucw/fb-atomic-tt.o: CFLAGS += -DFB_ATOMIC_TRACE
125 $(o)/ucw/url.test: $(o)/ucw/url-t
126
127 ifdef CONFIG_UCW_THREADS
128 TESTS+=$(addprefix $(o)/ucw/,asio.test)
129 $(o)/ucw/asio.test: $(o)/ucw/asio-t
130 endif
131
132 API_LIBS+=libucw
133 API_INCLUDES+=$(o)/ucw/.include-stamp
134 $(o)/ucw/.include-stamp: $(addprefix $(s)/ucw/,$(LIBUCW_INCLUDES)) obj/autoconf.h
135         $(Q)$(s)/build/install-includes $(<D) run/include/ucw $(LIBUCW_INCLUDES)
136         $(Q)$(s)/build/install-includes obj run/include/ucw autoconf.h
137         $(Q)touch $@
138 run/lib/pkgconfig/libucw.pc: $(o)/ucw/libucw.pc
139
140 ifdef CONFIG_UCW_PERL
141 include $(s)/ucw/perl/Makefile
142 endif
143
144 ifdef CONFIG_UCW_SHELL_UTILS
145 include $(s)/ucw/shell/Makefile
146 endif
147
148 ifdef CONFIG_UCW_UTILS
149 $(o)/ucw/b224: $(o)/ucw/b224.o $(LIBUCW)
150 $(o)/ucw/daemon-helper: $(o)/ucw/daemon-helper.o $(LIBUCW)
151 $(o)/ucw/urltool: $(o)/ucw/urltool.o $(LIBUCW)
152 $(o)/ucw/hex: $(o)/ucw/hex.o $(LIBUCW)
153
154 TESTS+=$(o)/ucw/basecode.test
155 $(o)/ucw/basecode.test: $(o)/ucw/basecode
156 endif