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