1 objects := adu.o string.o cmdline.o fd.o select.o create.o interactive.o select.cmdline.o format.o user.o bloom.o
4 uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
6 DEBUG_CPPFLAGS += -Wno-sign-compare -g -Wunused -Wundef -W
7 DEBUG_CPPFLAGS += -Wredundant-decls
10 CPPFLAGS += -Wuninitialized
11 CPPFLAGS += -Wchar-subscripts
12 CPPFLAGS += -Wformat-security
13 CPPFLAGS += -Werror-implicit-function-declaration
14 CPPFLAGS += -Wmissing-format-attribute
15 CPPFLAGS += -Wunused-macros
16 CPPFLAGS += -Wbad-function-cast
17 CPPFLAGS += -DVERSION='"$(version)"'
18 CPPFLAGS += -I/usr/local/include
20 LDFLAGS += -L/usr/local/lib
23 ifeq "$(origin CC)" "default"
28 ifeq (,$(findstring BSD,$(uname_S)))
29 CPPFLAGS += -D_LARGEFILE64_SOURCE
30 CPPFLAGS += $(shell getconf LFS64_CFLAGS)
31 LDFLAGS += -D_LARGEFILE64_SOURCE
32 LDFLAGS += $(shell getconf LFS64_LDFLAGS)
33 LDFLAGS += $(shell getconf LFS64_LIBS)
34 CPPFLAGS += -DHAVE_STAT64=1
38 Makefile.deps: $(wildcard *.c *.h)
39 $(CC) $(CPPFLAGS) -MM -MG *.c > $@
41 -include Makefile.deps
44 $(CC) -o $@ $(LDFLAGS) $(objects) -losl
46 cmdline.o: cmdline.c cmdline.h
47 $(CC) -c $(CPPFLAGS) $<
49 cmdline.c cmdline.h: adu.ggo
50 gengetopt --no-handle-error --no-handle-help < $<
54 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) $<
56 select.cmdline.c select.cmdline.h: select.ggo
57 gengetopt --set-package=select \
61 --arg-struct-name=select_args_info \
62 --file-name=$(subst .ggo,,$<).cmdline \
63 --func-name $(subst .ggo,,$<)_cmdline_parser < $<
65 select.cmdline.o: select.cmdline.c select.cmdline.h
66 $(CC) -c $(CPPFLAGS) $<
69 help2man -h --detailed-help --include adu.1.inc -N ./$< > $@
72 man2html $< | sed -e 's|^<DT><DD>$$|<DT><DD><br>|g' > $@
75 rm -f *.o adu *cmdline.c *cmdline.h adu.1 adu.1.html adu.png index.html adu.sk~
77 index.html: adu.1.html index.html.in INSTALL README
78 sed -e '/@README@/,$$d' index.html.in > $@
79 grutatxt -nb < README >> $@
80 sed -e '1,/@README@/d' -e '/@INSTALL@/,$$d' index.html.in >> $@
81 grutatxt -nb < INSTALL >> $@
82 sed -e '1,/@INSTALL@/d' -e '/@MAN_PAGE@/,$$d' index.html.in >> $@
83 sed -e '1,/Return to Main Contents/d' -e '/Index/,$$d' adu.1.html >> $@
84 sed -e '1,/@MAN_PAGE@/d' index.html.in >> $@
87 install -s adu $(PREFIX)/bin
88 install -m 0644 adu.1 $(PREFIX)/man/man1