1 # Makefile for the UCW Library (c) 1997--2008 Martin Mares <mj@ucw.cz>
4 LIBUCW=$(o)/ucw/libucw.pc
6 ifdef CONFIG_UCW_DBTOOL
7 PROGS+=$(o)/ucw/db-tool
10 PROGS+=$(o)/ucw/basecode
14 alloc alloc_str realloc bigalloc mempool mempool-str mempool-fmt eltpool \
15 mmap pagecache partmap hashfunc \
16 lists slists simple-lists bitsig \
17 log log-file proctitle \
18 conf-alloc conf-dump conf-input conf-intr conf-journal conf-parse conf-section \
21 fastbuf ff-binary ff-string ff-printf ff-unicode \
22 fb-file carefulio fb-mem fb-temp 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 ctmatch regex \
25 prime primetable random timer randomkey \
29 mainloop exitstatus runcmd sighandler \
30 lizard lizard-safe adler32 \
35 string str-esc str-split str-match str-imatch str-hex \
40 lib.h config.h threads.h \
41 mempool.h pagecache.h \
43 lists.h clists.h slists.h simple-lists.h \
44 string.h stkstring.h unicode.h chartype.h regex.h \
46 unaligned.h prefetch.h \
47 bbuf.h gbuf.h bitarray.h bitsig.h \
48 hashfunc.h hashtable.h \
49 heap.h binheap.h binheap-node.h \
53 conf.h getopt.h ipaccess.h \
55 fastbuf.h lfs.h ff-unicode.h ff-binary.h \
63 kmp.h kmp-search.h binsearch.h \
66 ifdef CONFIG_UCW_THREADS
67 # Some modules require threading
68 LIBUCW_MODS+=threads-conf workqueue asio fb-direct
69 LIBUCW_INCLUDES+=workqueue.h semaphore.h asio.h
72 ifdef CONFIG_OWN_GETOPT
73 include $(s)/ucw/getopt/Makefile
76 include $(s)/ucw/sorter/Makefile
78 LIBUCW_MOD_PATHS=$(addprefix $(o)/ucw/,$(LIBUCW_MODS))
80 $(o)/ucw/libucw.a: $(addsuffix .o,$(LIBUCW_MOD_PATHS))
81 $(o)/ucw/libucw.so: $(addsuffix .oo,$(LIBUCW_MOD_PATHS))
83 $(o)/ucw/hashfunc.o $(o)/ucw/hashfunc.oo: CFLAGS += -funroll-loops
84 $(o)/ucw/lizard.o: CFLAGS += $(COPT2) -funroll-loops
86 $(o)/ucw/db-test: $(o)/ucw/db-test.o $(LIBUCW)
87 $(o)/ucw/db-tool: $(o)/ucw/db-tool.o $(LIBUCW)
88 $(o)/ucw/conf-test: $(o)/ucw/conf-test.o $(LIBUCW)
89 $(o)/ucw/lfs-test: $(o)/ucw/lfs-test.o $(LIBUCW)
90 $(o)/ucw/hash-test: $(o)/ucw/hash-test.o $(LIBUCW)
91 $(o)/ucw/hashfunc-test: $(o)/ucw/hashfunc-test.o $(LIBUCW)
92 $(o)/ucw/asort-test: $(o)/ucw/asort-test.o $(LIBUCW)
93 $(o)/ucw/redblack-test: $(o)/ucw/redblack-test.o $(LIBUCW)
94 $(o)/ucw/binheap-test: $(o)/ucw/binheap-test.o $(LIBUCW)
95 $(o)/ucw/lizard-test: $(o)/ucw/lizard-test.o $(LIBUCW)
96 $(o)/ucw/kmp-test: $(o)/ucw/kmp-test.o $(LIBUCW) $(LIBCHARSET)
97 $(o)/ucw/ipaccess-test: $(o)/ucw/ipaccess-test.o $(LIBUCW)
98 $(o)/ucw/trie-test: $(o)/ucw/trie-test.o $(LIBUCW)
99 $(o)/ucw/basecode: $(o)/ucw/basecode.o $(LIBUCW)
101 TESTS+=$(addprefix $(o)/ucw/,regex.test unicode.test hash-test.test mempool.test stkstring.test \
102 slists.test kmp-test.test bbuf.test getopt.test fastbuf.test ff-unicode.test eltpool.test \
103 fb-socket.test trie-test.test string.test sha1.test asort-test.test binheap-test.test \
104 redblack-test.test basecode.test)
106 $(o)/ucw/regex.test: $(o)/ucw/regex-t
107 $(o)/ucw/unicode.test: $(o)/ucw/unicode-t
108 $(o)/ucw/hash-test.test: $(o)/ucw/hash-test
109 $(o)/ucw/mempool.test: $(o)/ucw/mempool-t $(o)/ucw/mempool-fmt-t $(o)/ucw/mempool-str-t
110 $(o)/ucw/stkstring.test: $(o)/ucw/stkstring-t
111 $(o)/ucw/bitops.test: $(o)/ucw/bit-ffs-t $(o)/ucw/bit-fls-t
112 $(o)/ucw/slists.test: $(o)/ucw/slists-t
113 $(o)/ucw/kmp-test.test: $(o)/ucw/kmp-test
114 $(o)/ucw/bbuf.test: $(o)/ucw/bbuf-t
115 $(o)/ucw/getopt.test: $(o)/ucw/getopt-t
116 $(o)/ucw/fastbuf.test: $(o)/ucw/fb-file-t $(o)/ucw/fb-grow-t $(o)/ucw/fb-pool-t
117 $(o)/ucw/ff-unicode.test: $(o)/ucw/ff-unicode-t
118 $(o)/ucw/eltpool.test: $(o)/ucw/eltpool-t
119 $(o)/ucw/fb-socket.test: $(o)/ucw/fb-socket-t
120 $(o)/ucw/string.test: $(o)/ucw/str-hex-t $(o)/ucw/str-esc-t
121 $(o)/ucw/sha1.test: $(o)/ucw/sha1-t $(o)/ucw/sha1-hmac-t
122 $(o)/ucw/trie-test.test: $(o)/ucw/trie-test
123 $(o)/ucw/asort-test.test: $(o)/ucw/asort-test
124 $(o)/ucw/binheap-test.test: $(o)/ucw/binheap-test
125 $(o)/ucw/redblack-test.test: $(o)/ucw/redblack-test
126 $(o)/ucw/basecode.test: $(o)/ucw/basecode
128 ifdef CONFIG_UCW_THREADS
129 TESTS+=$(addprefix $(o)/ucw/,asio.test)
130 $(o)/ucw/asio.test: $(o)/ucw/asio-t
134 API_INCLUDES+=$(o)/ucw/.include-stamp
135 $(o)/ucw/.include-stamp: $(addprefix $(s)/ucw/,$(LIBUCW_INCLUDES)) obj/autoconf.h
136 $(Q)$(s)/build/install-includes $(<D) run/include/ucw $(LIBUCW_INCLUDES)
137 $(Q)$(s)/build/install-includes obj run/include/ucw autoconf.h
139 run/lib/pkgconfig/libucw.pc: $(o)/ucw/libucw.pc
141 ifdef CONFIG_UCW_PERL
142 include $(s)/ucw/perl/Makefile
145 ifdef CONFIG_UCW_SHELL_UTILS
146 include $(s)/ucw/shell/Makefile