]> git.tuebingen.mpg.de Git - dss.git/blob - Makefile
build: Combine CFLAGS and DEBUG_CFLAGS.
[dss.git] / Makefile
1 PREFIX ?= /usr/local
2 INSTALL ?= install
3 INSTALL_PROGRAM ?= $(INSTALL)
4 INSTALL_DATA ?= $(INSTALL) -m 644
5 MKDIR_P := mkdir -p
6
7 VERSION_STRING = 0.1.7
8
9 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
10 all: dss dss.1
11 man: dss.1
12
13 DSS_CFLAGS := -Wno-sign-compare -g -Wunused -Wundef
14 DSS_CFLAGS += -Wredundant-decls
15 DSS_CFLAGS += -Os
16 DSS_CFLAGS += -Wall
17 DSS_CFLAGS += -Wuninitialized
18 DSS_CFLAGS += -Wchar-subscripts
19 DSS_CFLAGS += -Wformat-security
20 DSS_CFLAGS += -Werror-implicit-function-declaration
21 DSS_CFLAGS += -Wmissing-format-attribute
22 DSS_CFLAGS += -Wunused-macros
23 DSS_CFLAGS += -Wunused-parameter
24 DSS_CFLAGS += -Wbad-function-cast
25 DSS_CFLAGS += -Wshadow
26
27 Makefile.deps: $(wildcard *.c *.h)
28         gcc -MM -MG *.c > $@
29
30 -include Makefile.deps
31
32 dss: $(dss_objects)
33         $(CC) -o $@ $(dss_objects) $(LDFLAGS) -llopsub
34
35 %.o: %.c Makefile
36         $(CC) -c -DVERSION_STRING='"$(VERSION_STRING)"' $(DSS_CFLAGS) $(CFLAGS) $<
37
38 %.png: %.dia
39         dia -e $@ -t png $<
40
41 %.lsg.h: %.suite
42         lopsubgen --gen-h=$@ < $<
43 %.lsg.c: %.suite
44         lopsubgen --gen-c=$@ < $<
45 %.1: %.suite
46         lopsubgen --gen-man=$@ --version-string=$(VERSION_STRING) < $<
47
48 %.1.html: %.1
49         groff -m man -Thtml -P -l -P -r $< | sed -e '1,/^<body>/d; /^<\/body>/,$$d' > $@
50
51 clean:
52         rm -f *.o dss dss.1 dss.1.html Makefile.deps *.png *~ index.html dss.lsg.h dss.lsg.c
53
54 ifneq ($(findstring strip, $(MAKECMDGOALS)),)
55        strip_option := -s
56 endif
57 bindir := $(DESTDIR)$(PREFIX)/bin
58 mandir := $(DESTDIR)$(PREFIX)/share/man/man1
59 install install-strip: all
60         $(MKDIR_P) $(bindir) $(mandir)
61         $(INSTALL_PROGRAM) $(strip_option) dss $(bindir)
62         $(INSTALL_DATA) dss.1 $(mandir)
63
64 index.html: dss.1.html index.html.in INSTALL README NEWS
65         sed -e '/@README@/,$$d' index.html.in > $@
66         markdown README >> $@
67         sed -e '1,/@README@/d' -e '/@NEWS@/,$$d' index.html.in >> $@
68         markdown NEWS >> $@
69         sed -e '1,/@NEWS@/d' -e '/@INSTALL@/,$$d' index.html.in >> $@
70         markdown INSTALL >> $@
71         sed -e '1,/@INSTALL@/d' -e '/@MAN_PAGE@/,$$d' index.html.in >> $@
72         cat dss.1.html >> $@
73         sed -e '1,/@MAN_PAGE@/d' index.html.in >> $@