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)
31 MD5SUM=@MD5SUM_SIMPLE@
35 INSTALL_FLAGS=-o root -g $(INSTALL_GROUP)
38 INSTALL_PROGRAM=@INSTALL_PROGRAM@ $(INSTALL_FLAGS)
39 INSTALL_DATA=@INSTALL_DATA@ $(INSTALL_FLAGS)
42 bindir=$(exec_prefix)/bin
44 man1dir=$(mandir)/man1
45 sbindir=$(exec_prefix)/sbin
47 etcsubdir=$(etcdir)/userv
48 docdir=$(prefix)/userv
50 TARGETS= daemon client
51 TARGETS_DOC_PS= spec.ps overview.ps
52 TARGETS_DOC_RM= $(TARGETS_DOC_PS) spec.html
53 TARGETS_DOC= $(TARGETS_DOC_PS) spec.html/index.html
56 SOURCES= Makefile.in configure.in acconfig.h \
58 overlord.c process.c servexec.c \
59 daemon.h debug.c parser.c lib.c lib.h \
60 language.i4 lexer.l.m4 tokens.h.m4
62 CONFIG_RESULTS= config.status config.log config.h config.cache \
65 GENSHIP_CLEAN= lexer.l lexer.c tokens.h config.h.in spec.sgml $(TARGETS_DOC)
66 GENSHIP= $(GENSHIP_CLEAN) configure
73 $(INSTALL_PROGRAM) -m 755 daemon $(sbindir)/uservd
74 $(INSTALL_PROGRAM) -m 4755 client $(bindir)/userv
75 $(INSTALL) -d -m 2755 $(etcsubdir) \
76 $(etcsubdir)/default.d $(etcsubdir)/services.d $(etcsubdir)/override.d
77 if test ! -f $(etcsubdir)/system.default; then \
78 $(INSTALL_DATA) system.default $(etcsubdir); fi
79 if test ! -f $(etcsubdir)/system.override; then \
80 $(INSTALL_DATA) system.override $(etcsubdir); fi
83 $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
85 install-doc: $(TARGETS_DOC)
86 $(INSTALL) -d -m 2755 $(docdir) $(docdir)/spec.html
87 $(INSTALL) -d -m 2755 $(mandir) $(man1dir)
88 $(INSTALL_DATA) -m 644 $(TARGETS_DOC_PS) $(docdir)/.
89 $(INSTALL_DATA) -m 644 spec.html/*.html $(docdir)/spec.html/.
90 $(INSTALL_DATA) -m 644 $(MAN1PAGES) $(man1dir)
93 rm -f $(bindir)/userv $(sbindir)/uservd
96 cd $docdir && rm -rf $(TARGETS_DOC_RM)
98 daemon: overlord.o process.o servexec.o parserlexer.o debug.o lib.o both.o
99 $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
101 client: client.o both.o
102 $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
106 spec.sgml: spec.sgml.in Makefile
107 sed -e '/<version><\/version>/ s/>/&$(VERSION)/' \
108 spec.sgml.in >$@.new && mv -f $@.new $@
110 client.o: config.h common.h pcsum.h both.h version.h
112 process.o: config.h common.h pcsum.h both.h daemon.h lib.h tokens.h
114 overlord.o: config.h common.h pcsum.h daemon.h
116 servexec.o: config.h common.h pcsum.h daemon.h lib.h version.h
118 lib.o: config.h common.h lib.h
120 debug.o: config.h common.h pcsum.h daemon.h lib.h tokens.h
122 parserlexer.o: lexer.c parser.c config.h common.h pcsum.h daemon.h lib.h tokens.h
123 # lexer.c #include's parser.c at the end. Blame flex.
124 $(CC) -c $(CPPFLAGS) $(CFLAGS) lexer.c -o $@
126 pcsum.h: common.h config.h config.status Makefile
128 | sed -e 's/ -$$//; s/../0x&,/g; s/,$$//;' \
130 cmp pcsum.h.new pcsum.h || mv -f pcsum.h.new pcsum.h
134 echo '#define VERSION "$(VERSION)"' >$@.new && mv -f $@.new $@
136 tokens.h: language.i4
143 find -name '*.orig' -o -name '*~' -o -name '.*~' \
144 -o -name '*#' -o -name '.#*' -o -name '*.bak' \
146 rm -rf $(TARGETS) *.o core version.h
148 rm -f spec.lout* spec.text* spec.ps?* spec.sgml.new
149 rm -f lout.li *.ld *.lix *.ldx
150 rm -f userv-*.tar.gz vd/*
152 distclean mostlyclean: clean
153 rm -f $(CONFIG_RESULTS)
155 maintainer-clean: distclean
156 rm -rf $(GENSHIP_CLEAN) spec.html/*.html
158 dist-prep: $(GENSHIP)
164 dist_tmp=dist_tmp/userv-$(VERSION)
165 dist_prune=\( -name CVS -o -name 'dist_tmp*' -o -name slash-etc -o -name vd \)
166 dist: dist-prep distclean
168 mkdir dist_tmp $(dist_tmp)
169 find $(dist_prune) -prune -o -type d -print | \
170 sed -e 's#.*#mkdir -p $(dist_tmp)/&#' | sh
171 find $(dist_prune) -prune -o -type f -print | \
172 sed -e 's#.*#ln & $(dist_tmp)/&#' | sh
173 cd dist_tmp && tar cf ../$(dist_tmp).tar `basename $(dist_tmp)`
174 gzip -9 $(dist_tmp).tar
175 mv $(dist_tmp).tar.gz .
177 linecount: $(SOURCES)
180 %.html/index.html: %.sgml
184 debiandoc2ps -1 -O $< >$@.new && mv $@.new $@
187 fig2dev -L ps -c -l dummy -P -z A4 $< >$@.new && mv $@.new $@
190 $(M4) $(M4FLAGS) -- $< >$@.new && mv $@.new $@
193 $(M4) $(M4FLAGS) -- $< >$@.new && mv $@.new $@
196 $(M4) $(M4FLAGS) -- $< >$@.new && mv $@.new $@