chiark / gitweb /
cgi-fcgi-interp: Rename "command" to "script" throughout
[chiark-utils.git] / cprogs / Makefile
1 # Makefile
2 # simple make settings
3 #
4 # This file is part of chiark backup, a system for backing up GNU/Linux and
5 # other UN*X-compatible machines, as used on chiark.greenend.org.uk.
6 #
7 # chiark backup is:
8 #  Copyright (C) 1997-1998,2000-2001 Ian Jackson <ian@chiark.greenend.org.uk>
9 #  Copyright (C) 1999 Peter Maydell <pmaydell@chiark.greenend.org.uk>
10 #
11 # This is free software; you can redistribute it and/or modify it under the
12 # terms of the GNU General Public License as published by the Free Software
13 # Foundation; either version 3, or (at your option) any later version.
14 #
15 # This is distributed in the hope that it will be useful, but WITHOUT ANY
16 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
18 # details.
19 #
20 # You should have received a copy of the GNU General Public License along
21 # with this program; if not, consult the Free Software Foundation's
22 # website at www.fsf.org, or the GNU Project website at www.gnu.org.
23
24 us=     chiark-utils-bin
25
26 include ../settings.make
27
28 RWBUFFER_SIZE_MB=16
29
30 PROGRAMS=               readbuffer writebuffer with-lock-ex xbatmon-simple \
31                         summer watershed rcopy-repeatedly xduplic-copier \
32                         cgi-fcgi-interp
33 SUIDSBINPROGRAMS=       really
34 DAEMONS=                trivsoundd
35 MAN1PAGES=              readbuffer.1 writebuffer.1 with-lock-ex.1 \
36                         xduplic-copier.1
37 MAN8PAGES=              trivsoundd.8 really.8
38 BUILTTXTDOCS=           watershed.txt
39 TXTDOCS=                $(BUILTTXTDOCS)
40
41 acctdump_cc_out:=$(shell \
42         printf "\#include <sys/types.h>\n\#include <sys/acct.h>" \
43                 | $(CC) -E - 2>&1 >/dev/null \
44 )
45 ifeq (,$(acctdump_cc_out))
46 PROGRAMS+=acctdump
47 MAN8PAGES+=acctdump.8
48 else
49 $(warning Not building acctdump: $(acctdump_cc_out))
50 endif
51
52 TARGETS=        $(PROGRAMS) $(SUIDSBINPROGRAMS) $(DAEMONS) $(BUILTTXTDOCS)
53
54 all:            $(TARGETS)
55
56 readbuffer:                     readbuffer.o                    rwbuffer.o
57 writebuffer:                    writebuffer.o   wrbufcore.o     rwbuffer.o 
58 trivsoundd:                     trivsoundd.o    wrbufcore.o     rwbuffer.o 
59 really:                         really.o myopt.o
60 acctdump:                       acctdump.o      myopt.o
61
62 acctdump.o really.o myopt.o rcopy-repeatedly.o: myopt.h
63 readbuffer.o writebuffer.o rwbuffer.o wrbufcore.o trivsoundd.o: rwbuffer.h
64
65 xbatmon-simple: LDLIBS += -lX11 -lm
66
67 xduplic-copier: LDLIBS += -lXmu -lSM -lICE -lXt -lXext
68 xduplic-copier: LDLIBS += -lX11 -lxcb -lXau -lXdmcp
69
70 summer:         summer.o
71 summer:         LDLIBS += -lnettle -lgmp
72
73 rcopy-repeatedly: rcopy-repeatedly.o myopt.o
74 rcopy-repeatedly: LDLIBS += -lm -lrt
75
76 watershed:      watershed.o common.o
77 watershed:      LDLIBS += -lnettle -lgmp
78
79 cgi-fcgi-interp:        cgi-fcgi-interp.o       myopt.o common.o
80 cgi-fcgi-interp:        LDLIBS += -lnettle -lgmp
81
82 watershed.txt:  watershed.c
83                 sed '/^$$/,$$d' <$^ >$@.new && mv -f $@.new $@
84
85 install:                all
86                 $(INSTALL_DIRECTORY) $(bindir) $(sbindir)
87                 $(INSTALL_PROGRAM) $(PROGRAMS) $(bindir)
88                 $(INSTALL_PROGRAM) $(DAEMONS) $(sbindir)
89                 $(INSTALL) -m 4774 -o root -g $(SYSTEM_GROUP) \
90                         $(SUIDSBINPROGRAMS) $(sbindir)
91
92 install-docs:   watershed.txt
93                 $(INSTALL_DIRECTORY) $(man1dir) $(man8dir) $(txtdocdir)
94                 $(INSTALL) -m 644 $(MAN1PAGES) ${man1dir}/.
95                 $(INSTALL) -m 644 $(MAN8PAGES) ${man8dir}/.
96                 $(INSTALL) -m 644 $(TXTDOCS) ${txtdocdir}/.
97
98 install-examples:
99
100 clean:
101                 rm -f *~ ./#*# *.o $(PROGRAMS)
102
103 distclean realclean:    clean
104                 rm -f $(TARGETS)