chiark / gitweb /
6bf4ea49dc672e353294080f66646307b0fa8387
[userv.git] / Makefile.in
1 #  userv - Makefile.in
2 #  
3 #  Copyright (C)1996-1997 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)"'
24 OPTIMISE=@OPTIMISE@
25 CPPFLAGS=@DEBUGDEFS@ $(XCPPFLAGS)
26 LDLIBS=@DEBUGLIBS@ $(XLDLIBS)
27
28 M4=m4
29 M4FLAGS=
30 LEX=flex
31 CWD=$(shell pwd)
32
33 INSTALL=@INSTALL@
34 INSTALL_PROGRAM=@INSTALL_PROGRAM@
35 INSTALL_DATA=@INSTALL_DATA@
36 prefix=@prefix@
37 exec_prefix=$(prefix)
38 bindir=$(exec_prefix)/bin
39 sbindir=$(exec_prefix)/sbin
40 etcdir=/etc
41 etcsubdir=$(etcdir)/userv
42
43 SOURCES=        Makefile.in configure.in acconfig.h                     \
44                 client.c common.h                                       \
45                 overlord.c process.c servexec.c                         \
46                 daemon.h debug.c parser.c lib.c lib.h                   \
47                 language.i4 lexer.l.m4 tokens.h.m4
48 ALSOSHIP=       README INSTALL Changelog COPYING \
49                 system.default system.override \
50                 spec.sgml.in overview.fig overview.ps \
51                 buildship install-sh .cvsignore
52 GENSHIP=        lexer.l lexer.c tokens.h configure config.h.in \
53                 spec.sgml spec.html spec.ps overview.ps
54
55 SHIPTARGETS=    $(SOURCES) $(ALSOSHIP) $(GENSHIP)
56
57 all:            daemon client
58
59 install:        all
60                 $(INSTALL_PROGRAM) -s -o root -g root -m 755 daemon $(sbindir)/uservd
61                 $(INSTALL_PROGRAM) -s -o root -g root -m 4755 client $(bindir)/userv
62                 $(INSTALL) -d -o root -g root -m 2755 $(etcsubdir) \
63         $(etcsubdir)/default.d $(etcsubdir)/services.d $(etcsubdir)/override.d
64                 if ! test -f $(etcsubdir)/system.default; then \
65                         $(INSTALL_DATA) -o root -g root system.default $(etcsubdir); fi
66                 if ! test -f $(etcsubdir)/system.override; then \
67                         $(INSTALL_DATA) -o root -g root system.override $(etcsubdir); fi
68
69 daemon:         overlord.o process.o servexec.o parserlexer.o debug.o lib.o both.o
70                 $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
71
72 client:         client.o both.o
73                 $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
74
75 lexer.l:        language.i4
76
77 spec.sgml:      spec.sgml.in Makefile
78                 sed -e '/<version><\/version>/ s/>/&$(VERSION)/' \
79                         spec.sgml.in >$@.new && mv -f $@.new $@
80
81 client.o:       config.h common.h pcsum.h both.h version.h
82
83 process.o:      config.h common.h pcsum.h both.h daemon.h lib.h tokens.h
84
85 overlord.o:     config.h common.h pcsum.h daemon.h
86
87 servexec.o:     config.h common.h pcsum.h daemon.h lib.h version.h
88
89 lib.o:          config.h common.h lib.h
90
91 debug.o:        config.h common.h pcsum.h daemon.h lib.h tokens.h
92
93 parserlexer.o:  lexer.c parser.c config.h common.h pcsum.h daemon.h lib.h tokens.h
94 # lexer.c #include's parser.c at the end.  Blame flex.
95                 $(CC) -c $(CPPFLAGS) $(CFLAGS) lexer.c -o $@
96
97 pcsum.h:        common.h config.h config.status Makefile
98                 cat $^ | md5sum | sed -e 's/../0x&,/g; s/,$$//;' >pcsum.h.new
99                 cmp pcsum.h.new pcsum.h || mv -f pcsum.h.new pcsum.h
100                 @rm -f pcsum.h.new
101
102 version.h:      Makefile
103                 echo '#define VERSION "$(VERSION)"' >$@.new && mv -f $@.new $@
104
105 tokens.h:       language.i4
106
107 autoconf configure:
108                 autoheader
109                 autoconf
110
111 clean:
112                 rm -f daemon client pcsum.h
113                 rm -f overview.eps
114                 rm -f spec.lout* spec.text* spec.sgml spec.sgml.new spec.ps?*
115                 rm -rf spec.html?*
116                 rm -f lout.li *.lix *.ldx config.cache
117                 rm -f *.o *~ core ./#*#
118
119 distclean:      clean
120                 rm -f config.status config.log Makefile config.h
121
122 realclean:      distclean
123                 rm -f spec.ps* spec.sgml spec.sgml.new
124                 rm -f lexer.l lexer.c tokens.h overview.ps
125                 rm -rf spec.html*
126
127 totalclean:     realclean
128                 rm -f configure config.h.in
129
130 shipprep:       $(SHIPTARGETS)
131
132 ship:           $(SHIPTARGETS)
133                 rm -rf shipcheck
134                 mkdir -p shipcheck/userv-$(VERSION)
135                 cp -a $^ shipcheck/userv-$(VERSION)
136                 cd shipcheck && \
137                  GZIP=-9v tar zvvcf userv-$(VERSION).tar.gz userv-$(VERSION)
138                 rm -rf shipcheck/userv-$(VERSION)
139
140 linecount:      $(SOURCES)
141                 wc -l $^
142
143 %.html:         %.sgml
144                 rm -rf $@; debiandoc2html $<
145
146 %.ps:           %.sgml
147                 debiandoc2ps -1 -O $< >$@.new && mv $@.new $@
148
149 %.ps:           %.fig
150                 fig2dev -L ps -c -l dummy -P -z A4 $< >$@.new && mv $@.new $@
151
152 %.l:            %.l.m4
153                 $(M4) $(M4FLAGS) -- $< >$@.new && mv $@.new $@
154
155 %.h:            %.h.m4
156                 $(M4) $(M4FLAGS) -- $< >$@.new && mv $@.new $@
157
158 %:              %.m4
159                 $(M4) $(M4FLAGS) -- $< >$@.new && mv $@.new $@