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 bindir=$(exec_prefix)/bin
47 man1dir=$(mandir)/man1
48 man8dir=$(mandir)/man8
49 sbindir=$(exec_prefix)/sbin
51 etcsubdir=$(etcdir)/userv
52 docdir=$(prefix)/userv
54 TARGETS= daemon client
55 TARGETS_DOC_PS= spec.ps overview.ps
56 TARGETS_DOC_RM= $(TARGETS_DOC_PS) spec.html
57 TARGETS_DOC= $(TARGETS_DOC_PS) spec.html/index.html
61 SOURCES= Makefile.in configure.in acconfig.h \
63 overlord.c process.c servexec.c \
64 daemon.h debug.c parser.c lib.c lib.h \
65 language.i4 lexer.l.m4 tokens.h.m4
67 CONFIG_RESULTS= config.status config.log config.h config.cache \
70 GENSHIP_CLEAN= lexer.l lexer.c tokens.h config.h.in spec.sgml $(TARGETS_DOC)
71 GENSHIP= $(GENSHIP_CLEAN) configure
78 $(INSTALL_PROGRAM) -m 755 daemon $(sbindir)/uservd
79 $(INSTALL_PROGRAM) -m 4755 client $(bindir)/userv
80 $(INSTALL) -d -m 2755 $(etcsubdir) \
81 $(etcsubdir)/default.d $(etcsubdir)/services.d $(etcsubdir)/override.d
82 if test ! -f $(etcsubdir)/system.default; then \
83 $(INSTALL_DATA) system.default $(etcsubdir); fi
84 if test ! -f $(etcsubdir)/system.override; then \
85 $(INSTALL_DATA) system.override $(etcsubdir); fi
88 $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
90 install-doc: $(TARGETS_DOC)
91 $(INSTALL) -d -m 2755 $(docdir) $(docdir)/spec.html
92 $(INSTALL) -d -m 2755 $(mandir) $(man1dir) $(man8dir)
93 $(INSTALL_DATA) -m 644 $(TARGETS_DOC_PS) $(docdir)/.
94 $(INSTALL_DATA) -m 644 spec.html/*.html $(docdir)/spec.html/.
95 $(INSTALL_DATA) -m 644 $(MAN1PAGES) $(man1dir)
96 $(INSTALL_DATA) -m 644 $(MAN8PAGES) $(man8dir)
99 rm -f $(bindir)/userv $(sbindir)/uservd
102 cd $docdir && rm -rf $(TARGETS_DOC_RM)
105 @echo There is no validation suite for this package.
107 daemon: overlord.o process.o servexec.o parserlexer.o debug.o lib.o both.o
108 $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
110 client: client.o both.o
111 $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
115 spec.sgml: spec.sgml.in Makefile
116 sed -e '/<version><\/version>/ s/>/&$(VERSION)/' \
117 spec.sgml.in >$@.new && mv -f $@.new $@
119 client.o: config.h common.h pcsum.h both.h version.h
121 process.o: config.h common.h pcsum.h both.h daemon.h lib.h tokens.h
123 overlord.o: config.h common.h pcsum.h daemon.h
125 servexec.o: config.h common.h pcsum.h daemon.h lib.h version.h
127 lib.o: config.h common.h lib.h
129 debug.o: config.h common.h pcsum.h daemon.h lib.h tokens.h
131 parserlexer.o: lexer.c parser.c config.h common.h pcsum.h daemon.h lib.h tokens.h
132 # lexer.c #include's parser.c at the end. Blame flex.
133 $(CC) -c $(CPPFLAGS) $(CFLAGS) lexer.c -o $@
135 pcsum.h: common.h config.h config.status Makefile
137 | sed -e 's/ -$$//; s/../0x&,/g; s/,$$//;' \
139 cmp pcsum.h.new pcsum.h || mv -f pcsum.h.new pcsum.h
143 echo '#define VERSION "$(VERSION)"' >$@.new && mv -f $@.new $@
145 tokens.h: language.i4
152 find -name '*.orig' -o -name '*~' -o -name '.*~' \
153 -o -name '*#' -o -name '.#*' -o -name '*.bak' \
155 rm -rf $(TARGETS) *.o core version.h
157 rm -f spec.lout* spec.text* spec.ps* spec.sgml.new spec.tex
158 rm -f lout.li *.ld *.lix *.ldx
159 rm -f userv-*.tar.gz vd/*
161 distclean mostlyclean: clean
162 rm -f $(CONFIG_RESULTS)
164 maintainer-clean: distclean
165 rm -rf $(GENSHIP_CLEAN) spec.html/*.html
167 dist-prep: $(GENSHIP)
173 dist_tmp=dist_tmp/userv-$(VERSION)
174 dist_prune=\( -name CVS -o -name 'dist_tmp*' -o -name slash-etc -o -name vd \)
175 dist: dist-prep distclean
177 mkdir dist_tmp $(dist_tmp)
178 find $(dist_prune) -prune -o -type d -print | \
179 sed -e 's#.*#mkdir -p $(dist_tmp)/&#' | sh
180 find $(dist_prune) -prune -o -type f -print | \
181 sed -e 's#.*#ln & $(dist_tmp)/&#' | sh
182 cd dist_tmp && tar cf ../$(dist_tmp).tar `basename $(dist_tmp)`
183 gzip -9 $(dist_tmp).tar
184 mv $(dist_tmp).tar.gz .
186 linecount: $(SOURCES)
189 %.html/index.html: %.sgml
193 debiandoc2ps -1 -O $< >$@.new && mv $@.new $@
196 fig2dev -L ps -c -l dummy -P -z A4 $< >$@.new && mv $@.new $@
199 $(M4) $(M4FLAGS) -- $< >$@.new && mv $@.new $@
202 $(M4) $(M4FLAGS) -- $< >$@.new && mv $@.new $@
205 $(M4) $(M4FLAGS) -- $< >$@.new && mv $@.new $@