]> git.tuebingen.mpg.de Git - dss.git/blob - Makefile
Fix --config-file for relative paths.
[dss.git] / Makefile
1 # SPDX-License-Identifier: GPL-2.0
2 PREFIX ?= /usr/local
3 INSTALL ?= install
4 INSTALL_PROGRAM ?= $(INSTALL)
5 INSTALL_DATA ?= $(INSTALL) -m 644
6 MKDIR_P := mkdir -p
7
8 VERSION_STRING = 1.0.1
9
10 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
11 all: dss dss.1
12 man: dss.1
13
14 DSS_CPPFLAGS := -DVERSION_STRING='"$(VERSION_STRING)"'
15 DSS_CPPFLAGS += -Wunused-macros
16
17 DSS_CFLAGS := -Wno-sign-compare -g -Wunused -Wundef
18 DSS_CFLAGS += -Wredundant-decls
19 DSS_CFLAGS += -Os
20 DSS_CFLAGS += -Wall
21 DSS_CFLAGS += -Wuninitialized
22 DSS_CFLAGS += -Wchar-subscripts
23 DSS_CFLAGS += -Wformat-security
24 DSS_CFLAGS += -Werror-implicit-function-declaration
25 DSS_CFLAGS += -Wmissing-format-attribute
26 DSS_CFLAGS += -Wunused-parameter
27 DSS_CFLAGS += -Wbad-function-cast
28 DSS_CFLAGS += -Wshadow
29
30 Makefile.deps: $(wildcard *.c *.h)
31         $(CC) -MM -MG $(DSS_CPPFLAGS) $(CPPFLAGS) $(DSS_CFLAGS) $(CFLAGS) *.c > $@
32
33 -include Makefile.deps
34
35 dss: $(dss_objects)
36         $(CC) -o $@ $(dss_objects) $(LDFLAGS) -llopsub
37
38 %.o: %.c Makefile
39         $(CC) -c $(DSS_CPPFLAGS) $(CPPFLAGS) $(DSS_CFLAGS) $(CFLAGS) $<
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 *~ 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 >> $@