chiark / gitweb /
8f3d687b3543bb001bd85a954713eda6d5e1924f
[userv.git] / Makefile.in
1 #  userv - Makefile.in
2 #  
3 #  userv is copyright Ian Jackson and other contributors.
4 #  See README for full authorship information.
5 #  
6 #  This is free software; you can redistribute it and/or modify it
7 #  under the terms of the GNU General Public License as published by
8 #  the Free Software Foundation; either version 3 of the License, or
9 #  (at your option) any later version.
10 #  
11 #  This program is distributed in the hope that it will be useful, but
12 #  WITHOUT ANY WARRANTY; without even the implied warranty of
13 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 #  General Public License for more details.
15 #  
16 #  You should have received a copy of the GNU General Public License
17 #  along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
19
20 VERSION=@VERSION@
21 VEREXT=std
22
23 CC=@CC@
24 CFLAGS=@CFLAGS@ $(XCFLAGS) -DVERSION='"$(VERSION)"' -DVEREXT='"$(VEREXT)"' $(WERROR) $(XCFLAGS)
25 OPTIMISE=@OPTIMISE@
26 CPPFLAGS=@DEBUGDEFS@ $(XCPPFLAGS)
27 LDLIBS=@DEBUGLIBS@ @LIBS@ $(XLDLIBS)
28
29 M4=m4
30 M4FLAGS=
31 LEX=flex
32 MD5SUM=@MD5SUM_SIMPLE@
33 CWD=$(shell pwd)
34
35 INSTALL_GROUP=0  # root or wheel
36 INSTALL_FLAGS=-o root -g $(INSTALL_GROUP)
37
38 INSTALL=@INSTALL@
39 INSTALL_PROGRAM=@INSTALL_PROGRAM@ $(INSTALL_FLAGS)
40 INSTALL_DATA=@INSTALL_DATA@ $(INSTALL_FLAGS)
41 INSTALL_DIR=$(INSTALL) -d
42 INSTALL_DIR_ETC=$(INSTALL_DIR)
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.pdf overview.pdf
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_DIR) $(addprefix $(DESTDIR), $(bindir) $(sbindir))
80                 $(INSTALL_PROGRAM) -m 755 daemon $(DESTDIR)$(sbindir)/uservd
81                 $(INSTALL_PROGRAM) -m 4755 client $(DESTDIR)$(bindir)/userv
82                 set -e; for f in '' /default.d /services.d /override.d; do \
83                         $(INSTALL_DIR_ETC) $(DESTDIR)$(etcsubdir)$$f; \
84                 done
85                 set -e; for f in system.default system.override; do     \
86                         if test ! -f $(DESTDIR)$(etcsubdir)/$$f; then   \
87                                 $(INSTALL_DATA) $$f $(DESTDIR)$(etcsubdir); \
88                         fi;                                             \
89                 done
90
91 install-strip:
92                 $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
93
94 install-doc install-docs:       $(TARGETS_DOC)
95                 $(INSTALL_DIR) $(addprefix $(DESTDIR),                  \
96                         $(docdir) $(docdir)/spec.html $(docdir)/examples \
97                         $(mandir) $(man1dir) $(man8dir)                 \
98                 )
99                 $(INSTALL_DATA) -m 644 $(TARGETS_DOC_PS) $(DESTDIR)$(docdir)/.
100                 $(INSTALL_DATA) -m 644 spec.html/*.html \
101                         $(DESTDIR)$(docdir)/spec.html/.
102                 $(INSTALL_DATA) -m 644 system.default system.override \
103                         $(DESTDIR)$(docdir)/examples/.
104                 $(INSTALL_DATA) -m 644 $(MAN1PAGES) $(DESTDIR)$(man1dir)
105                 $(INSTALL_DATA) -m 644 $(MAN8PAGES) $(DESTDIR)$(man8dir)
106
107 uninstall:
108                 rm -f $(bindir)/userv $(sbindir)/uservd
109
110 uninstall-doc uninstall-docs:
111                 cd $docdir && rm -rf $(TARGETS_DOC_RM)
112
113 check:
114                 @echo There is no validation suite for this package.
115
116 daemon:         overlord.o process.o servexec.o parserlexer.o debug.o lib.o both.o
117                 $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
118
119 client:         client.o both.o
120                 $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
121
122 lexer.l:        language.i4
123
124 spec.sgml:      spec.sgml.in Makefile
125                 sed -e '/<version><\/version>/ s/>/&$(VERSION)/' \
126                         spec.sgml.in >$@.new && mv -f $@.new $@
127
128 client.o:       config.h common.h pcsum.h both.h version.h
129
130 process.o:      config.h common.h pcsum.h both.h daemon.h lib.h tokens.h
131
132 overlord.o:     config.h common.h pcsum.h daemon.h
133
134 servexec.o:     config.h common.h pcsum.h daemon.h lib.h version.h
135
136 lib.o:          config.h common.h lib.h
137
138 debug.o:        config.h common.h pcsum.h daemon.h lib.h tokens.h
139
140 parserlexer.o:  lexer.c parser.c config.h common.h pcsum.h daemon.h lib.h tokens.h
141 # lexer.c #include's parser.c at the end.  Blame flex.
142                 $(CC) -c $(CPPFLAGS) $(CFLAGS) lexer.c -o $@
143
144 pcsum.h:        common.h config.h config.status Makefile
145                 cat $^ | $(MD5SUM) \
146                         | sed -e 's/  -$$//; s/../0x&,/g; s/,$$//;' \
147                         >pcsum.h.new
148                 cmp pcsum.h.new pcsum.h || mv -f pcsum.h.new pcsum.h
149                 @rm -f pcsum.h.new
150
151 version.h:      Makefile
152                 echo '#define VERSION "$(VERSION)"' >$@.new && mv -f $@.new $@
153
154 tokens.h:       language.i4
155
156 autoconf configure:
157                 autoheader
158                 autoconf
159
160 clean:
161                 find -name '*.orig' -o -name '*~' -o -name '.*~' \
162                         -o -name '*#' -o -name '.#*' -o -name '*.bak' \
163                         | xargs -r rm
164                 rm -rf $(TARGETS) *.o core version.h
165                 rm -f overview.eps
166                 rm -f spec.lout* spec.text* spec.ps* spec.sgml.new spec.tex
167                 rm -f lout.li *.ld *.lix *.ldx
168                 rm -f userv-*.tar.gz vd/*
169
170 distclean mostlyclean:  clean
171                 rm -f $(CONFIG_RESULTS)
172
173 maintainer-clean:       distclean
174                 rm -rf $(GENSHIP_CLEAN) spec.html/*.html
175
176 linecount:      $(SOURCES)
177                 wc -l $^
178
179 %.dbk:          %.sgml
180                 debiandoc2dbk -1 $<
181
182 %.html/index.html:      %.sgml
183                         debiandoc2html $<
184
185 %.pdf:          %.dbk
186                 dblatex -b xetex $<
187                 mv -f $<.pdf $@
188
189 overview.pdf:   overview.fig
190                 SOURCE_DATE_EPOCH=$$(stat -c %Y overview.fig) \
191                 fig2dev -L pdf -c -F -l dummy_arg -z A4 $< >$@.new
192                 mv $@.new $@
193
194 %.l:            %.l.m4
195                 $(M4) $(M4FLAGS) -- $< >$@.new && mv $@.new $@
196
197 %.h:            %.h.m4
198                 $(M4) $(M4FLAGS) -- $< >$@.new && mv $@.new $@
199
200 %:              %.m4
201                 $(M4) $(M4FLAGS) -- $< >$@.new && mv $@.new $@