]> git.tuebingen.mpg.de Git - adu.git/blob - Makefile
751506b6fa72c2f683dc5a2cb66d470ef8c3679b
[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 --no-handle-error --no-handle-help --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 adu.1: adu adu.1.inc
56         help2man -h --detailed-help --include adu.1.inc -N ./$< > $@
57
58 %.1.html: %.1
59         man2html $< | sed -e 's|^<DT><DD>$$|<DT><DD><br>|g' > $@
60
61 clean:
62         rm -f *.o adu *cmdline.c *cmdline.h
63
64 index.html: adu.1.html index.html.in INSTALL README
65         sed -e '/@README@/,$$d' index.html.in > $@
66         grutatxt -nb < README >> $@
67         sed -e '1,/@README@/d' -e '/@INSTALL@/,$$d' index.html.in >> $@
68         grutatxt -nb < INSTALL >> $@
69         sed -e '1,/@INSTALL@/d' -e '/@MAN_PAGE@/,$$d' index.html.in >> $@
70         sed -e '1,/Return to Main Contents/d' -e '/Index/,$$d' adu.1.html >> $@
71         sed -e '1,/@MAN_PAGE@/d' index.html.in >> $@