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)
11 units := dss str file exec sig daemon df tv snap ipc dss.lsg version
12 objs := $(addsuffix .o, $(units))
13 deps := $(addsuffix .d, $(units))
17 $(objs): dss.lsg.h Makefile
20 DSS_CPPFLAGS += -Wunused-macros
22 DSS_CFLAGS := -Wno-sign-compare -g -Wunused -Wundef
23 DSS_CFLAGS += -Wredundant-decls
26 DSS_CFLAGS += -Wuninitialized
27 DSS_CFLAGS += -Wchar-subscripts
28 DSS_CFLAGS += -Wformat-security
29 DSS_CFLAGS += -Werror-implicit-function-declaration
30 DSS_CFLAGS += -Wmissing-format-attribute
31 DSS_CFLAGS += -Wunused-parameter
32 DSS_CFLAGS += -Wbad-function-cast
33 DSS_CFLAGS += -Wshadow
37 ifeq ("$(origin V)", "command line")
40 SAY = @echo '$(strip $(1))'
44 ./version-gen.sh dss version.c
47 $(CC) -o $@ $(objs) $(LDFLAGS) -llopsub
50 $(CC) -c -o $@ $(DSS_CPPFLAGS) $(CPPFLAGS) $(DSS_CFLAGS) $(CFLAGS) \
51 -MMD -MF $(*F).d -MT $@ $<
54 $(LSG) --gen-h=$@ < $<
57 $(LSG) --gen-c=$@ < $<
60 $(LSG) --gen-man=$@ --version-string=$(VERSION) < $<
63 groff -m man -Thtml -P -l -P -r $< | sed -e '1,/^<body>/d; /^<\/body>/,$$d' > $@
67 $(RM) *.[od] dss dss.1 *.html dss.lsg.[ch] version.c
69 ifneq ($(findstring strip, $(MAKECMDGOALS)),)
72 bindir := $(DESTDIR)$(PREFIX)/bin
73 mandir := $(DESTDIR)$(PREFIX)/share/man/man1
74 install install-strip: all
75 $(MKDIR_P) $(bindir) $(mandir)
76 $(INSTALL_PROGRAM) $(strip_option) dss $(bindir)
77 $(INSTALL_DATA) dss.1 $(mandir)
79 index.html: dss.1.html index.html.in INSTALL README NEWS
80 sed -e '/@README@/,$$d' index.html.in > $@
82 sed -e '1,/@README@/d' -e '/@NEWS@/,$$d' index.html.in >> $@
84 sed -e '1,/@NEWS@/d' -e '/@INSTALL@/,$$d' index.html.in >> $@
85 markdown INSTALL >> $@
86 sed -e '1,/@INSTALL@/d' -e '/@MAN_PAGE@/,$$d' index.html.in >> $@
88 sed -e '1,/@MAN_PAGE@/d' index.html.in >> $@
90 -include Makefile.local