3 # Copyright (C)1996-1997,1999 Ian Jackson
5 # This is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with userv; if not, write to the Free Software
17 # Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 CFLAGS=@CFLAGS@ $(XCFLAGS) -DVERSION='"$(VERSION)"' -DVEREXT='"$(VEREXT)"' $(WERROR)
25 CPPFLAGS=@DEBUGDEFS@ $(XCPPFLAGS)
26 LDLIBS=@DEBUGLIBS@ @LIBS@ $(XLDLIBS)
34 INSTALL_FLAGS=-u root -g $(INSTALL_GROUP)
37 INSTALL_PROGRAM=@INSTALL_PROGRAM@ $(INSTALL_FLAGS)
38 INSTALL_DATA=@INSTALL_DATA@ $(INSTALL_FLAGS)
41 bindir=$(exec_prefix)/bin
42 sbindir=$(exec_prefix)/sbin
44 etcsubdir=$(etcdir)/userv
45 docdir=$(prefix)/userv
47 TARGETS= daemon client
48 TARGETS_DOC_PS= spec.ps overview.ps
49 TARGETS_DOC= spec.html $(TARGETS_DOC_PS)
51 SOURCES= Makefile.in configure.in acconfig.h \
53 overlord.c process.c servexec.c \
54 daemon.h debug.c parser.c lib.c lib.h \
55 language.i4 lexer.l.m4 tokens.h.m4
57 ALSOSHIP= README INSTALL Changelog COPYING \
58 system.default system.override \
59 spec.sgml.in overview.fig overview.ps \
60 buildship install-sh .cvsignore
62 GENSHIP_CLEAN= pcsum.h lexer.l lexer.c tokens.h config.h.in spec.sgml $(TARGETS_DOC)
63 GENSHIP= $(GENSHIP_CLEAN) configure
65 SHIPTARGETS= $(SOURCES) $(ALSOSHIP) $(GENSHIP)
72 $(INSTALL_PROGRAM) -m 755 daemon $(sbindir)/uservd
73 $(INSTALL_PROGRAM) -m 4755 client $(bindir)/userv
74 $(INSTALL) -d -m 2755 $(etcsubdir) \
75 $(etcsubdir)/default.d $(etcsubdir)/services.d $(etcsubdir)/override.d
76 if test ! -f $(etcsubdir)/system.default; then
77 $(INSTALL_DATA) system.default $(etcsubdir); fi
78 if test ! -f $(etcsubdir)/system.override; then \
79 $(INSTALL_DATA) system.override $(etcsubdir); fi
82 $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
84 install-doc: $(TARGETS_DOC)
85 $(INSTALL) -d -m 2755 $(docdir) $(docdir)/spec.html
86 $(INSTALL_DATA) -m 644 $(TARGETS_DOC_PS) $(docdir)/.
87 $(INSTALL_DATA) -m 644 spec.html/*.html $(docdir)/spec.html/.
90 rm -f $(bindir)/userv $(sbindir)/uservd
93 cd $docdir && rm -rf $(TARGETS_DOC)
95 daemon: overlord.o process.o servexec.o parserlexer.o debug.o lib.o both.o
96 $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
98 client: client.o both.o
99 $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
103 spec.sgml: spec.sgml.in Makefile
104 sed -e '/<version><\/version>/ s/>/&$(VERSION)/' \
105 spec.sgml.in >$@.new && mv -f $@.new $@
107 client.o: config.h common.h pcsum.h both.h version.h
109 process.o: config.h common.h pcsum.h both.h daemon.h lib.h tokens.h
111 overlord.o: config.h common.h pcsum.h daemon.h
113 servexec.o: config.h common.h pcsum.h daemon.h lib.h version.h
115 lib.o: config.h common.h lib.h
117 debug.o: config.h common.h pcsum.h daemon.h lib.h tokens.h
119 parserlexer.o: lexer.c parser.c config.h common.h pcsum.h daemon.h lib.h tokens.h
120 # lexer.c #include's parser.c at the end. Blame flex.
121 $(CC) -c $(CPPFLAGS) $(CFLAGS) lexer.c -o $@
123 pcsum.h: common.h config.h config.status Makefile
124 cat $^ | md5sum | sed -e 's/ -$$//; s/../0x&,/g; s/,$$//;' >pcsum.h.new
125 cmp pcsum.h.new pcsum.h || mv -f pcsum.h.new pcsum.h
129 echo '#define VERSION "$(VERSION)"' >$@.new && mv -f $@.new $@
131 tokens.h: language.i4
135 rm -f spec.lout* spec.text* spec.sgml spec.sgml.new spec.ps?*
137 rm -f lout.li *.lix *.ldx config.cache
138 rm -f *.o *~ core ./#*#
145 rm -rf $(TARGETS) *.o
147 distclean mostlyclean: clean
148 rm -f config.status config.log Makefile config.h
150 maintainer-clean: distclean
151 rm -rf $(GENSHIP_CLEAN)
153 dist-prep: $(SHIPTARGETS)
157 mkdir -p shipcheck/userv-$(VERSION)
158 cp -a $^ shipcheck/userv-$(VERSION)
160 GZIP=-9v tar zvvcf userv-$(VERSION).tar.gz userv-$(VERSION)
161 rm -rf shipcheck/userv-$(VERSION)
163 linecount: $(SOURCES)
167 rm -rf $@; debiandoc2html $<
170 debiandoc2ps -1 -O $< >$@.new && mv $@.new $@
173 fig2dev -L ps -c -l dummy -P -z A4 $< >$@.new && mv $@.new $@
176 $(M4) $(M4FLAGS) -- $< >$@.new && mv $@.new $@
179 $(M4) $(M4FLAGS) -- $< >$@.new && mv $@.new $@
182 $(M4) $(M4FLAGS) -- $< >$@.new && mv $@.new $@