1 # Makefile for the UCW Library (c) 1997--2008 Martin Mares <mj@ucw.cz>
4 LIBUCW=$(o)/lib/libucw.pc
6 ifdef CONFIG_UCW_DBTOOL
7 PROGS+=$(o)/lib/db-tool
12 alloc alloc_str realloc bigalloc mempool mempool-str mempool-fmt eltpool \
13 mmap pagecache partmap hashfunc \
14 lists slists simple-lists bitsig \
15 log log-file proctitle \
16 conf-alloc conf-dump conf-input conf-intr conf-journal conf-parse conf-section \
19 fastbuf ff-binary ff-string ff-printf ff-unicode \
20 fb-file carefulio fb-mem fb-temp 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 ctmatch regex \
23 prime primetable random timer randomkey \
27 mainloop exitstatus runcmd sighandler \
28 lizard lizard-safe adler32 \
33 string str-esc str-split str-match str-imatch str-hex \
38 lib.h config.h threads.h \
39 mempool.h pagecache.h \
41 lists.h clists.h slists.h simple-lists.h \
42 string.h stkstring.h unicode.h chartype.h regex.h \
44 unaligned.h prefetch.h \
45 bbuf.h gbuf.h bitarray.h bitsig.h \
46 hashfunc.h hashtable.h \
47 heap.h binheap.h binheap-node.h \
51 conf.h getopt.h ipaccess.h \
53 fastbuf.h lfs.h ff-unicode.h ff-binary.h \
61 kmp.h kmp-search.h binsearch.h \
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
70 ifdef CONFIG_OWN_GETOPT
71 include $(s)/lib/getopt/Makefile
74 include $(s)/lib/sorter/Makefile
76 LIBUCW_MOD_PATHS=$(addprefix $(o)/lib/,$(LIBUCW_MODS))
78 $(o)/lib/libucw.a: $(addsuffix .o,$(LIBUCW_MOD_PATHS))
79 $(o)/lib/libucw.so: $(addsuffix .oo,$(LIBUCW_MOD_PATHS))
81 $(o)/lib/hashfunc.o $(o)/lib/hashfunc.oo: CFLAGS += -funroll-loops
82 $(o)/lib/lizard.o: CFLAGS += $(COPT2) -funroll-loops
84 $(o)/lib/db-test: $(o)/lib/db-test.o $(LIBUCW)
85 $(o)/lib/db-tool: $(o)/lib/db-tool.o $(LIBUCW)
86 $(o)/lib/conf-test: $(o)/lib/conf-test.o $(LIBUCW)
87 $(o)/lib/lfs-test: $(o)/lib/lfs-test.o $(LIBUCW)
88 $(o)/lib/hash-test: $(o)/lib/hash-test.o $(LIBUCW)
89 $(o)/lib/hashfunc-test: $(o)/lib/hashfunc-test.o $(LIBUCW)
90 $(o)/lib/asort-test: $(o)/lib/asort-test.o $(LIBUCW)
91 $(o)/lib/redblack-test: $(o)/lib/redblack-test.o $(LIBUCW)
92 $(o)/lib/binheap-test: $(o)/lib/binheap-test.o $(LIBUCW)
93 $(o)/lib/lizard-test: $(o)/lib/lizard-test.o $(LIBUCW)
94 $(o)/lib/kmp-test: $(o)/lib/kmp-test.o $(LIBUCW) $(LIBCHARSET)
95 $(o)/lib/ipaccess-test: $(o)/lib/ipaccess-test.o $(LIBUCW)
97 TESTS+=$(addprefix $(o)/lib/,regex.test unicode.test hash-test.test mempool.test stkstring.test \
98 slists.test kmp-test.test bbuf.test getopt.test fastbuf.test ff-unicode.test eltpool.test \
99 fb-socket.test string.test)
101 $(o)/lib/regex.test: $(o)/lib/regex-t
102 $(o)/lib/unicode.test: $(o)/lib/unicode-t
103 $(o)/lib/hash-test.test: $(o)/lib/hash-test
104 $(o)/lib/mempool.test: $(o)/lib/mempool-t $(o)/lib/mempool-fmt-t $(o)/lib/mempool-str-t
105 $(o)/lib/stkstring.test: $(o)/lib/stkstring-t
106 $(o)/lib/bitops.test: $(o)/lib/bit-ffs-t $(o)/lib/bit-fls-t
107 $(o)/lib/slists.test: $(o)/lib/slists-t
108 $(o)/lib/kmp-test.test: $(o)/lib/kmp-test
109 $(o)/lib/bbuf.test: $(o)/lib/bbuf-t
110 $(o)/lib/getopt.test: $(o)/lib/getopt-t
111 $(o)/lib/fastbuf.test: $(o)/lib/fb-file-t $(o)/lib/fb-grow-t $(o)/lib/fb-pool-t
112 $(o)/lib/ff-unicode.test: $(o)/lib/ff-unicode-t
113 $(o)/lib/eltpool.test: $(o)/lib/eltpool-t
114 $(o)/lib/fb-socket.test: $(o)/lib/fb-socket-t
115 $(o)/lib/string.test: $(o)/lib/str-hex-t $(o)/lib/str-esc-t
116 $(o)/lib/sha1.test: $(o)/lib/sha1-t
118 ifdef CONFIG_UCW_THREADS
119 TESTS+=$(addprefix $(o)/lib/,asio.test)
120 $(o)/lib/asio.test: $(o)/lib/asio-t
124 API_INCLUDES+=$(o)/lib/.include-stamp
125 $(o)/lib/.include-stamp: $(addprefix $(s)/lib/,$(LIBUCW_INCLUDES)) obj/autoconf.h
126 $(Q)$(s)/build/install-includes $(<D) run/include/lib $(LIBUCW_INCLUDES)
127 $(Q)$(s)/build/install-includes obj run/include/lib autoconf.h
129 run/lib/pkgconfig/libucw.pc: $(o)/lib/libucw.pc
131 ifdef CONFIG_UCW_PERL
132 include $(s)/lib/perl/Makefile
135 ifdef CONFIG_UCW_SHELL_UTILS
136 include $(s)/lib/shell/Makefile