chiark / gitweb /
Version number upped for release.
[userv.git] / Makefile.in
1 #  userv - Makefile.in
2 #  
3 #  Copyright (C)1996-1997,1999 Ian Jackson
4 #  
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.
9 #  
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.
14 #  
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.
18
19 VERSION=@VERSION@
20 VEREXT=std
21
22 CC=@CC@
23 CFLAGS=@CFLAGS@ $(XCFLAGS) -DVERSION='"$(VERSION)"' -DVEREXT='"$(VEREXT)"' $(WERROR)
24 OPTIMISE=@OPTIMISE@
25 CPPFLAGS=@DEBUGDEFS@ $(XCPPFLAGS)
26 LDLIBS=@DEBUGLIBS@ @LIBS@ $(XLDLIBS)
27
28 M4=m4
29 M4FLAGS=
30 LEX=flex
31 CWD=$(shell pwd)
32
33 INSTALL_GROUP=root
34 INSTALL_FLAGS=-o root -g $(INSTALL_GROUP)
35
36 INSTALL=@INSTALL@
37 INSTALL_PROGRAM=@INSTALL_PROGRAM@ $(INSTALL_FLAGS)
38 INSTALL_DATA=@INSTALL_DATA@ $(INSTALL_FLAGS)
39 prefix=@prefix@
40 exec_prefix=$(prefix)
41 bindir=$(exec_prefix)/bin
42 sbindir=$(exec_prefix)/sbin
43 etcdir=/etc
44 etcsubdir=$(etcdir)/userv
45 docdir=$(prefix)/userv
46
47 TARGETS=        daemon client
48 TARGETS_DOC_PS= spec.ps overview.ps
49 TARGETS_DOC=    spec.html $(TARGETS_DOC_PS)
50
51 SOURCES=        Makefile.in configure.in acconfig.h                     \
52                 client.c common.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
56
57 CONFIG_RESULTS= config.status config.log config.h config.cache \
58                 Makefile pcsum.h
59
60 GENSHIP_CLEAN=  lexer.l lexer.c tokens.h config.h.in spec.sgml $(TARGETS_DOC)
61 GENSHIP=        $(GENSHIP_CLEAN) configure
62
63 all:            $(TARGETS)
64
65 docs:           $(TARGETS_DOC)
66
67 install:        all
68                 $(INSTALL_PROGRAM) -m 755 daemon $(sbindir)/uservd
69                 $(INSTALL_PROGRAM) -m 4755 client $(bindir)/userv
70                 $(INSTALL) -d -m 2755 $(etcsubdir) \
71         $(etcsubdir)/default.d $(etcsubdir)/services.d $(etcsubdir)/override.d
72                 if test ! -f $(etcsubdir)/system.default; then \
73                         $(INSTALL_DATA) system.default $(etcsubdir); fi
74                 if test ! -f $(etcsubdir)/system.override; then \
75                         $(INSTALL_DATA) system.override $(etcsubdir); fi
76
77 install-strip:
78                 $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
79
80 install-doc:    $(TARGETS_DOC)
81                 $(INSTALL) -d -m 2755 $(docdir) $(docdir)/spec.html
82                 $(INSTALL_DATA) -m 644 $(TARGETS_DOC_PS) $(docdir)/.
83                 $(INSTALL_DATA) -m 644 spec.html/*.html $(docdir)/spec.html/.
84
85 uninstall:
86                 rm -f $(bindir)/userv $(sbindir)/uservd
87
88 uninstall-doc:
89                 cd $docdir && rm -rf $(TARGETS_DOC)
90
91 daemon:         overlord.o process.o servexec.o parserlexer.o debug.o lib.o both.o
92                 $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
93
94 client:         client.o both.o
95                 $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
96
97 lexer.l:        language.i4
98
99 spec.sgml:      spec.sgml.in Makefile
100                 sed -e '/<version><\/version>/ s/>/&$(VERSION)/' \
101                         spec.sgml.in >$@.new && mv -f $@.new $@
102
103 client.o:       config.h common.h pcsum.h both.h version.h
104
105 process.o:      config.h common.h pcsum.h both.h daemon.h lib.h tokens.h
106
107 overlord.o:     config.h common.h pcsum.h daemon.h
108
109 servexec.o:     config.h common.h pcsum.h daemon.h lib.h version.h
110
111 lib.o:          config.h common.h lib.h
112
113 debug.o:        config.h common.h pcsum.h daemon.h lib.h tokens.h
114
115 parserlexer.o:  lexer.c parser.c config.h common.h pcsum.h daemon.h lib.h tokens.h
116 # lexer.c #include's parser.c at the end.  Blame flex.
117                 $(CC) -c $(CPPFLAGS) $(CFLAGS) lexer.c -o $@
118
119 pcsum.h:        common.h config.h config.status Makefile
120                 cat $^ | md5sum | sed -e 's/  -$$//; s/../0x&,/g; s/,$$//;' >pcsum.h.new
121                 cmp pcsum.h.new pcsum.h || mv -f pcsum.h.new pcsum.h
122                 @rm -f pcsum.h.new
123
124 version.h:      Makefile
125                 echo '#define VERSION "$(VERSION)"' >$@.new && mv -f $@.new $@
126
127 tokens.h:       language.i4
128
129                 rm -f *.o *~ core ./#*#
130
131 autoconf configure:
132                 autoheader
133                 autoconf
134
135 clean:
136                 find -name '*.orig' -o -name '*~' -o -name '.*~' \
137                         -o -name '*#' -o -name '.#*' -o -name '*.bak' \
138                         | xargs -r rm
139                 rm -rf $(TARGETS) *.o version.h
140                 rm -f overview.eps
141                 rm -f spec.lout* spec.text* spec.ps?* spec.sgml.new
142                 rm -f lout.li *.ld *.lix *.ldx
143                 rm -f userv-*.tar.gz vd/*
144
145 distclean mostlyclean:  clean
146                 rm -f $(CONFIG_RESULTS)
147
148 maintainer-clean:       distclean
149                 rm -rf $(GENSHIP_CLEAN) spec.html/*.html
150
151 dist-prep:      $(GENSHIP)
152
153 pre-checkin:
154                 ./configure
155                 $(MAKE) dist-prep
156
157 dist_tmp=dist_tmp/userv-$(VERSION)
158 dist_prune=\( -name CVS -o -name 'dist_tmp*' -o -name slash-etc -o -name vd \)
159 dist:                   dist-prep distclean
160         rm -rf dist_tmp*
161         mkdir dist_tmp $(dist_tmp)
162         find $(dist_prune) -prune -o -type d -print | \
163                 sed -e 's#.*#mkdir -p $(dist_tmp)/&#' | sh
164         find $(dist_prune) -prune -o -type f -print | \
165                 sed -e 's#.*#ln & $(dist_tmp)/&#' | sh
166         cd dist_tmp && tar cf ../$(dist_tmp).tar `basename $(dist_tmp)`
167         gzip -9 $(dist_tmp).tar
168         mv $(dist_tmp).tar.gz .
169
170 linecount:      $(SOURCES)
171                 wc -l $^
172
173 %.html:         %.sgml
174                 debiandoc2html $<
175
176 %.ps:           %.sgml
177                 debiandoc2ps -1 -O $< >$@.new && mv $@.new $@
178
179 %.ps:           %.fig
180                 fig2dev -L ps -c -l dummy -P -z A4 $< >$@.new && mv $@.new $@
181
182 %.l:            %.l.m4
183                 $(M4) $(M4FLAGS) -- $< >$@.new && mv $@.new $@
184
185 %.h:            %.h.m4
186                 $(M4) $(M4FLAGS) -- $< >$@.new && mv $@.new $@
187
188 %:              %.m4
189                 $(M4) $(M4FLAGS) -- $< >$@.new && mv $@.new $@