42adf47daadf1c0b1d64c1ecd1578b6ac5cbb29c
[dss.git] / Makefile
1 VERSION_STRING = 0.1.7
2
3 dss_objects := dss.o str.o file.o exec.o sig.o daemon.o df.o tv.o snap.o ipc.o dss.lsg.o
4 all: dss
5 man: dss.1
6
7 DEBUG_CFLAGS ?=
8 DEBUG_CFLAGS += -Wno-sign-compare -g -Wunused -Wundef
9 DEBUG_CFLAGS += -Wredundant-decls
10 CFLAGS ?=
11 CFLAGS += -Os
12 CFLAGS += -Wall
13 CFLAGS += -Wuninitialized
14 CFLAGS += -Wchar-subscripts
15 CFLAGS += -Wformat-security
16 CFLAGS += -Werror-implicit-function-declaration
17 CFLAGS += -Wmissing-format-attribute
18 CFLAGS += -Wunused-macros
19 CFLAGS += -Wunused-parameter
20 CFLAGS += -Wbad-function-cast
21 CFLAGS += -Wshadow
22
23 Makefile.deps: $(wildcard *.c *.h)
24         gcc -MM -MG *.c > $@
25
26 -include Makefile.deps
27
28 dss: $(dss_objects)
29         $(CC) -o $@ $(dss_objects) $(LDFLAGS) -llopsub
30
31 %.o: %.c Makefile
32         $(CC) -c -DVERSION_STRING='"$(VERSION_STRING)"' $(CFLAGS) $(DEBUG_CFLAGS) $<
33
34 %.png: %.dia
35         dia -e $@ -t png $<
36
37 %.lsg.h: %.suite
38         lopsubgen --gen-h=$@ < $<
39 %.lsg.c: %.suite
40         lopsubgen --gen-c=$@ < $<
41 %.1: %.suite
42         lopsubgen --gen-man=$@ --version-string=$(VERSION_STRING) < $<
43
44 %.1.html: %.1
45         groff -m man -Thtml -P -l -P -r $< | sed -e '1,/^<body>/d; /^<\/body>/,$$d' > $@
46
47 clean:
48         rm -f *.o dss dss.1 dss.1.html Makefile.deps *.png *~ index.html dss.lsg.h dss.lsg.c
49
50
51 index.html: dss.1.html index.html.in INSTALL README NEWS
52         sed -e '/@README@/,$$d' index.html.in > $@
53         markdown README >> $@
54         sed -e '1,/@README@/d' -e '/@NEWS@/,$$d' index.html.in >> $@
55         markdown NEWS >> $@
56         sed -e '1,/@NEWS@/d' -e '/@INSTALL@/,$$d' index.html.in >> $@
57         markdown INSTALL >> $@
58         sed -e '1,/@INSTALL@/d' -e '/@MAN_PAGE@/,$$d' index.html.in >> $@
59         cat dss.1.html >> $@
60         sed -e '1,/@MAN_PAGE@/d' index.html.in >> $@