4 # Copyright 1996-2017 Ian Jackson <ian@davenant.greenend.org.uk>.
5 # Copyright 2000 Ben Harris <bjh21@cam.ac.uk>
6 # Copyright 2016-2017 Peter Benie <pjb1008@cam.ac.uk>
8 # This is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
26 CFLAGS=@CFLAGS@ $(XCFLAGS) -DVERSION='"$(VERSION)"' -DVEREXT='"$(VEREXT)"' $(WERROR) $(XCFLAGS)
28 CPPFLAGS=@DEBUGDEFS@ $(XCPPFLAGS)
29 LDLIBS=@DEBUGLIBS@ @LIBS@ $(XLDLIBS)
34 MD5SUM=@MD5SUM_SIMPLE@
37 INSTALL_GROUP=0 # root or wheel
38 INSTALL_FLAGS=-o root -g $(INSTALL_GROUP)
41 INSTALL_PROGRAM=@INSTALL_PROGRAM@ $(INSTALL_FLAGS)
42 INSTALL_DATA=@INSTALL_DATA@ $(INSTALL_FLAGS)
45 share_prefix=$(prefix)/share
46 bindir=$(exec_prefix)/bin
47 mandir=$(share_prefix)/man
48 man1dir=$(mandir)/man1
49 man8dir=$(mandir)/man8
50 sbindir=$(exec_prefix)/sbin
52 etcsubdir=$(etcdir)/userv
53 docdir=$(share_prefix)/doc/userv
55 TARGETS= daemon client
56 TARGETS_DOC_PS= spec.ps overview.ps
57 TARGETS_DOC_RM= $(TARGETS_DOC_PS) spec.html
58 TARGETS_DOC= $(TARGETS_DOC_PS) spec.html/index.html
62 SOURCES= Makefile.in configure.in acconfig.h \
64 overlord.c process.c servexec.c \
65 daemon.h debug.c parser.c lib.c lib.h \
66 language.i4 lexer.l.m4 tokens.h.m4
68 CONFIG_RESULTS= config.status config.log config.h config.cache \
71 GENSHIP_CLEAN= lexer.l lexer.c tokens.h config.h.in spec.sgml $(TARGETS_DOC)
72 GENSHIP= $(GENSHIP_CLEAN) configure
79 $(INSTALL) -d $(addprefix $(DESTDIR), $(bindir) $(sbindir))
80 $(INSTALL_PROGRAM) -m 755 daemon $(DESTDIR)$(sbindir)/uservd
81 $(INSTALL_PROGRAM) -m 4755 client $(DESTDIR)$(bindir)/userv
82 set -e; for f in '' /default.d /services.d /override.d; do \
83 $(INSTALL) -d -m 2755 $(DESTDIR)$(etcsubdir)$$f; \
85 set -e; for f in system.default system.override; do \
86 if test ! -f $(DESTDIR)$(etcsubdir)/$$f; then \
87 $(INSTALL_DATA) $$f $(DESTDIR)$(etcsubdir); \
92 $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
94 install-doc: $(TARGETS_DOC)
95 $(INSTALL) -d -m 2755 $(addprefix $(DESTDIR), \
96 $(docdir) $(docdir)/spec.html \
97 $(mandir) $(man1dir) $(man8dir) \
99 $(INSTALL_DATA) -m 644 $(TARGETS_DOC_PS) $(DESTDIR)$(docdir)/.
100 $(INSTALL_DATA) -m 644 spec.html/*.html \
101 $(DESTDIR)$(docdir)/spec.html/.
102 $(INSTALL_DATA) -m 644 $(MAN1PAGES) $(DESTDIR)$(man1dir)
103 $(INSTALL_DATA) -m 644 $(MAN8PAGES) $(DESTDIR)$(man8dir)
106 rm -f $(bindir)/userv $(sbindir)/uservd
109 cd $docdir && rm -rf $(TARGETS_DOC_RM)
112 @echo There is no validation suite for this package.
114 daemon: overlord.o process.o servexec.o parserlexer.o debug.o lib.o both.o
115 $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
117 client: client.o both.o
118 $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
122 spec.sgml: spec.sgml.in Makefile
123 sed -e '/<version><\/version>/ s/>/&$(VERSION)/' \
124 spec.sgml.in >$@.new && mv -f $@.new $@
126 client.o: config.h common.h pcsum.h both.h version.h
128 process.o: config.h common.h pcsum.h both.h daemon.h lib.h tokens.h
130 overlord.o: config.h common.h pcsum.h daemon.h
132 servexec.o: config.h common.h pcsum.h daemon.h lib.h version.h
134 lib.o: config.h common.h lib.h
136 debug.o: config.h common.h pcsum.h daemon.h lib.h tokens.h
138 parserlexer.o: lexer.c parser.c config.h common.h pcsum.h daemon.h lib.h tokens.h
139 # lexer.c #include's parser.c at the end. Blame flex.
140 $(CC) -c $(CPPFLAGS) $(CFLAGS) lexer.c -o $@
142 pcsum.h: common.h config.h config.status Makefile
144 | sed -e 's/ -$$//; s/../0x&,/g; s/,$$//;' \
146 cmp pcsum.h.new pcsum.h || mv -f pcsum.h.new pcsum.h
150 echo '#define VERSION "$(VERSION)"' >$@.new && mv -f $@.new $@
152 tokens.h: language.i4
159 find -name '*.orig' -o -name '*~' -o -name '.*~' \
160 -o -name '*#' -o -name '.#*' -o -name '*.bak' \
162 rm -rf $(TARGETS) *.o core version.h
164 rm -f spec.lout* spec.text* spec.ps* spec.sgml.new spec.tex
165 rm -f lout.li *.ld *.lix *.ldx
166 rm -f userv-*.tar.gz vd/*
168 distclean mostlyclean: clean
169 rm -f $(CONFIG_RESULTS)
171 maintainer-clean: distclean
172 rm -rf $(GENSHIP_CLEAN) spec.html/*.html
174 dist-prep: $(GENSHIP)
180 dist_tmp=dist_tmp/userv-$(VERSION)
181 dist_prune=\( -name CVS -o -name 'dist_tmp*' -o -name slash-etc -o -name vd \)
182 dist: dist-prep distclean
184 mkdir dist_tmp $(dist_tmp)
185 find $(dist_prune) -prune -o -type d -print | \
186 sed -e 's#.*#mkdir -p $(dist_tmp)/&#' | sh
187 find $(dist_prune) -prune -o -type f -print | \
188 sed -e 's#.*#ln & $(dist_tmp)/&#' | sh
189 cd dist_tmp && tar cf ../$(dist_tmp).tar `basename $(dist_tmp)`
190 gzip -9 $(dist_tmp).tar
191 mv $(dist_tmp).tar.gz .
193 linecount: $(SOURCES)
196 %.html/index.html: %.sgml
200 debiandoc2ps -1 -O $< >$@.new && mv $@.new $@
203 fig2dev -L ps -c -l dummy -P -z A4 $< >$@.new && mv $@.new $@
206 $(M4) $(M4FLAGS) -- $< >$@.new && mv $@.new $@
209 $(M4) $(M4FLAGS) -- $< >$@.new && mv $@.new $@
212 $(M4) $(M4FLAGS) -- $< >$@.new && mv $@.new $@