06d4132a27f1ea5c40abbacd2d29e6cdc74c5ad8
[adu.git] / Makefile
1 objects := adu.o string.o cmdline.o fd.o select.o create.o interactive.o select.cmdline.o format.o
2 all: adu
3 version := 0.0.3
4
5 DEBUG_CPPFLAGS += -Wno-sign-compare -g -Wunused -Wundef -W
6 DEBUG_CPPFLAGS += -Wredundant-decls
7 CPPFLAGS += -Os
8 CPPFLAGS += -Wall
9 CPPFLAGS += -Wuninitialized
10 CPPFLAGS += -Wchar-subscripts
11 CPPFLAGS += -Wformat-security
12 CPPFLAGS += -Werror-implicit-function-declaration
13 CPPFLAGS += -Wmissing-format-attribute
14 CPPFLAGS += -Wunused-macros
15 CPPFLAGS += -Wbad-function-cast
16 CPPFLAGS += -D_LARGEFILE64_SOURCE
17 CPPFLAGS += $(shell getconf LFS64_CFLAGS)
18 CPPFLAGS += -DVERSION='"$(version)"'
19
20 LDFLAGS += -D_LARGEFILE64_SOURCE
21 LDFLAGS += $(shell getconf LFS64_LDFLAGS)
22 LDFLAGS += $(shell getconf LFS64_LIBS)
23
24
25 Makefile.deps: $(wildcard *.c *.h)
26 gcc -MM -MG *.c > $@
27
28 -include Makefile.deps
29
30 adu: $(objects)
31 $(CC) -o $@ $(LDFLAGS) $(objects) -lcrypto -losl
32
33 cmdline.o: cmdline.c cmdline.h
34 $(CC) -c $(CPPFLAGS) $<
35
36 cmdline.c cmdline.h: adu.ggo
37 gengetopt --conf-parser < $<
38
39
40 %.o: %.c Makefile
41 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) $<
42
43 select.cmdline.c select.cmdline.h: select.ggo
44 gengetopt --set-package=select \
45 --no-handle-help \
46 --no-handle-error \
47 --no-handle-version \
48 --arg-struct-name=select_args_info \
49 --file-name=$(subst .ggo,,$<).cmdline \
50 --func-name $(subst .ggo,,$<)_cmdline_parser < $<
51
52 select.cmdline.o: select.cmdline.c select.cmdline.h
53 $(CC) -c $(CPPFLAGS) $<
54
55 clean:
56 rm -f *.o adu *cmdline.c *cmdline.h