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)
12 units := dss str file exec sig daemon df tv snap ipc dss.lsg version
13 objs := $(addsuffix .o, $(units))
14 deps := $(addsuffix .d, $(units))
18 $(objs): dss.lsg.h Makefile
21 DSS_CPPFLAGS += -Wunused-macros
23 DSS_CFLAGS := -Wno-sign-compare -g -Wunused -Wundef
24 DSS_CFLAGS += -Wredundant-decls
27 DSS_CFLAGS += -Wuninitialized
28 DSS_CFLAGS += -Wchar-subscripts
29 DSS_CFLAGS += -Wformat-security
30 DSS_CFLAGS += -Werror-implicit-function-declaration
31 DSS_CFLAGS += -Wmissing-format-attribute
32 DSS_CFLAGS += -Wunused-parameter
33 DSS_CFLAGS += -Wbad-function-cast
34 DSS_CFLAGS += -Wshadow
38 ifeq ("$(origin V)", "command line")
41 SAY = @echo '$(strip $(1))'
45 ./version-gen.sh dss version.c
48 $(CC) -o $@ $(objs) $(LDFLAGS) -llopsub
51 $(CC) -c -o $@ $(DSS_CPPFLAGS) $(CPPFLAGS) $(DSS_CFLAGS) $(CFLAGS) \
52 -MMD -MF $(*F).d -MT $@ $<
53 .PRECIOUS: %.lsg.c %.lsg.h %.1.gz
56 $(LSG) --gen-h=$@ < $<
59 $(LSG) --gen-c=$@ < $<
62 $(LSG) --gen-man=${@:.gz=} --version-string=$(VERSION) < $<
66 zcat $< | groff -m man -Thtml -P -l -P -r \
67 | sed -e '1,/^<body>/d; /^<\/body>/,$$d' > $@
70 $(RM) *.[od] dss dss.1.gz *.html dss.lsg.[ch] version.c
72 ifneq ($(findstring strip, $(MAKECMDGOALS)),)
75 bindir := $(DESTDIR)$(PREFIX)/bin
76 mandir := $(DESTDIR)$(PREFIX)/share/man/man1
77 install install-strip: all
78 $(MKDIR_P) $(bindir) $(mandir)
79 $(INSTALL_PROGRAM) $(strip_option) dss $(bindir)
80 $(INSTALL_DATA) dss.1.gz $(mandir)
82 index.html: dss.1.html index.html.in INSTALL README NEWS
83 sed -e '/@README@/,$$d' index.html.in > $@
85 sed -e '1,/@README@/d' -e '/@NEWS@/,$$d' index.html.in >> $@
87 sed -e '1,/@NEWS@/d' -e '/@INSTALL@/,$$d' index.html.in >> $@
88 markdown INSTALL >> $@
89 sed -e '1,/@INSTALL@/d' -e '/@MAN_PAGE@/,$$d' index.html.in >> $@
91 sed -e '1,/@MAN_PAGE@/d' index.html.in >> $@
93 -include Makefile.local