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