1 # Makefile for the UCW Library (c) 1997--2007 Martin Mares <mj@ucw.cz>
5 LIBUCW=$(o)/lib/libucw.pc
7 ifdef CONFIG_UCW_DBTOOL
8 PROGS+=$(o)/lib/db-tool
13 alloc alloc_str realloc bigalloc mempool mempool-str mempool-fmt eltpool \
14 mmap pagecache partmap hashfunc \
15 lists slists simple-lists bitsig \
16 log log-file proctitle \
17 conf-alloc conf-dump conf-input conf-intr conf-journal conf-parse conf-section \
20 fastbuf ff-binary ff-string ff-printf ff-unicode \
21 fb-file carefulio fb-mem fb-temp fb-mmap fb-limfd fb-buffer fb-grow fb-pool fb-atomic fb-param fb-socket \
22 str_ctype str_upper str_lower unicode stkstring \
23 wildmatch wordsplit ctmatch patimatch patmatch regex \
24 prime primetable random timer randomkey \
28 mainloop exitstatus runcmd sighandler \
29 lizard lizard-safe adler32 \
39 lib.h config.h threads.h \
40 mempool.h pagecache.h \
42 lists.h clists.h slists.h simple-lists.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 \
50 conf.h getopt.h ipaccess.h \
52 fastbuf.h lfs.h ff-unicode.h ff-binary.h \
53 chartype.h unicode.h stkstring.h \
54 wildmatch.h patmatch.h \
62 kmp.h kmp-search.h binsearch.h \
65 ifdef CONFIG_UCW_THREADS
66 # Some modules require threading
67 LIBUCW_MODS+=threads-conf workqueue asio fb-direct
68 LIBUCW_INCLUDES+=workqueue.h semaphore.h asio.h
71 ifdef CONFIG_OWN_GETOPT
72 include $(s)/lib/getopt/Makefile
75 include $(s)/lib/sorter/Makefile
77 LIBUCW_MOD_PATHS=$(addprefix $(o)/lib/,$(LIBUCW_MODS))
79 $(o)/lib/libucw.a: $(addsuffix .o,$(LIBUCW_MOD_PATHS))
80 $(o)/lib/libucw.so: $(addsuffix .oo,$(LIBUCW_MOD_PATHS))
82 $(o)/lib/hashfunc.o $(o)/lib/hashfunc.oo: CFLAGS += -funroll-loops
83 $(o)/lib/lizard.o: CFLAGS += $(COPT2) -funroll-loops
85 $(o)/lib/db-test: $(o)/lib/db-test.o $(LIBUCW)
86 $(o)/lib/db-tool: $(o)/lib/db-tool.o $(LIBUCW)
87 $(o)/lib/conf-test: $(o)/lib/conf-test.o $(LIBUCW)
88 $(o)/lib/lfs-test: $(o)/lib/lfs-test.o $(LIBUCW)
89 $(o)/lib/hash-test: $(o)/lib/hash-test.o $(LIBUCW)
90 $(o)/lib/str-test: $(o)/lib/str-test.o $(LIBUCW)
91 $(o)/lib/asort-test: $(o)/lib/asort-test.o $(LIBUCW)
92 $(o)/lib/redblack-test: $(o)/lib/redblack-test.o $(LIBUCW)
93 $(o)/lib/binheap-test: $(o)/lib/binheap-test.o $(LIBUCW)
94 $(o)/lib/lizard-test: $(o)/lib/lizard-test.o $(LIBUCW)
95 $(o)/lib/kmp-test: $(o)/lib/kmp-test.o $(LIBUCW) $(LIBCHARSET)
96 $(o)/lib/ipaccess-test: $(o)/lib/ipaccess-test.o $(LIBUCW)
98 TESTS+=$(addprefix $(o)/lib/,regex.test unicode.test hash-test.test mempool.test stkstring.test \
99 slists.test kmp-test.test bbuf.test getopt.test fastbuf.test ff-unicode.test eltpool.test \
102 $(o)/lib/regex.test: $(o)/lib/regex-t
103 $(o)/lib/unicode.test: $(o)/lib/unicode-t
104 $(o)/lib/hash-test.test: $(o)/lib/hash-test
105 $(o)/lib/mempool.test: $(o)/lib/mempool-t $(o)/lib/mempool-fmt-t $(o)/lib/mempool-str-t
106 $(o)/lib/stkstring.test: $(o)/lib/stkstring-t
107 $(o)/lib/bitops.test: $(o)/lib/bit-ffs-t $(o)/lib/bit-fls-t
108 $(o)/lib/slists.test: $(o)/lib/slists-t
109 $(o)/lib/kmp-test.test: $(o)/lib/kmp-test
110 $(o)/lib/bbuf.test: $(o)/lib/bbuf-t
111 $(o)/lib/getopt.test: $(o)/lib/getopt-t
112 $(o)/lib/fastbuf.test: $(o)/lib/fb-file-t $(o)/lib/fb-grow-t $(o)/lib/fb-pool-t
113 $(o)/lib/ff-unicode.test: $(o)/lib/ff-unicode-t
114 $(o)/lib/eltpool.test: $(o)/lib/eltpool-t
115 $(o)/lib/fb-socket.test: $(o)/lib/fb-socket-t
117 ifdef CONFIG_UCW_THREADS
118 TESTS+=$(addprefix $(o)/lib/,asio.test)
119 $(o)/lib/asio.test: $(o)/lib/asio-t
123 API_INCLUDES+=$(o)/lib/.include-stamp
124 $(o)/lib/.include-stamp: $(addprefix $(s)/lib/,$(LIBUCW_INCLUDES)) obj/autoconf.h
125 $(Q)$(s)/build/install-includes $(<D) run/include/lib $(LIBUCW_INCLUDES)
126 $(Q)$(s)/build/install-includes obj run/include/lib autoconf.h
128 run/lib/pkgconfig/libucw.pc: $(o)/lib/libucw.pc
130 ifdef CONFIG_UCW_PERL
131 include $(s)/lib/perl/Makefile
134 ifdef CONFIG_UCW_SHELL_UTILS
135 include $(s)/lib/shell/Makefile