1 # SPDX-License-Identifier: GPL-2.0
4 INSTALL_PROGRAM ?= $(INSTALL)
5 INSTALL_DATA ?= $(INSTALL) -m 644
7 VERSION := $(shell ./version-gen.sh dss version.c)
9 units := dss str file exec sig daemon df tv snap ipc dss.lsg version
10 objs := $(addsuffix .o, $(units))
11 deps := $(addsuffix .d, $(units))
15 $(objs): dss.lsg.h Makefile
18 DSS_CPPFLAGS += -Wunused-macros
20 DSS_CFLAGS := -Wno-sign-compare -g -Wunused -Wundef
21 DSS_CFLAGS += -Wredundant-decls
24 DSS_CFLAGS += -Wuninitialized
25 DSS_CFLAGS += -Wchar-subscripts
26 DSS_CFLAGS += -Wformat-security
27 DSS_CFLAGS += -Werror-implicit-function-declaration
28 DSS_CFLAGS += -Wmissing-format-attribute
29 DSS_CFLAGS += -Wunused-parameter
30 DSS_CFLAGS += -Wbad-function-cast
31 DSS_CFLAGS += -Wshadow
35 ifeq ("$(origin V)", "command line")
38 SAY = @echo '$(strip $(1))'
42 ./version-gen.sh dss version.c
45 $(CC) -o $@ $(objs) $(LDFLAGS) -llopsub
48 $(CC) -c -o $@ $(DSS_CPPFLAGS) $(CPPFLAGS) $(DSS_CFLAGS) $(CFLAGS) \
49 -MMD -MF $(*F).d -MT $@ $<
52 lopsubgen --gen-h=$@ < $<
55 lopsubgen --gen-c=$@ < $<
58 lopsubgen --gen-man=$@ --version-string=$(VERSION) < $<
61 groff -m man -Thtml -P -l -P -r $< | sed -e '1,/^<body>/d; /^<\/body>/,$$d' > $@
65 rm -f *.[od] dss dss.1 *.html dss.lsg.[ch] version.c
67 ifneq ($(findstring strip, $(MAKECMDGOALS)),)
70 bindir := $(DESTDIR)$(PREFIX)/bin
71 mandir := $(DESTDIR)$(PREFIX)/share/man/man1
72 install install-strip: all
73 $(MKDIR_P) $(bindir) $(mandir)
74 $(INSTALL_PROGRAM) $(strip_option) dss $(bindir)
75 $(INSTALL_DATA) dss.1 $(mandir)
77 index.html: dss.1.html index.html.in INSTALL README NEWS
78 sed -e '/@README@/,$$d' index.html.in > $@
80 sed -e '1,/@README@/d' -e '/@NEWS@/,$$d' index.html.in >> $@
82 sed -e '1,/@NEWS@/d' -e '/@INSTALL@/,$$d' index.html.in >> $@
83 markdown INSTALL >> $@
84 sed -e '1,/@INSTALL@/d' -e '/@MAN_PAGE@/,$$d' index.html.in >> $@
86 sed -e '1,/@MAN_PAGE@/d' index.html.in >> $@
88 -include Makefile.local