chiark / gitweb /
bugfixes
[chiark-utils.git] / backup / 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 2, 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, write to the Free Software Foundation, Inc.,
22 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
24 CC=             gcc
25 CFLAGS=         $(WARNINGS) $(OPTIMISE) $(DEBUG)
26 CPPFLAGS=       -DRWBUFFER_SIZE_MB=$(RWBUFFER_SIZE_MB)
27
28 WARNINGS=       -Wall -Wwrite-strings -Wmissing-prototypes \
29                 -Wstrict-prototypes -Wpointer-arith
30 OPTIMISE=       -O2
31 DEBUG=          -g
32 RWBUFFER_SIZE_MB=16
33
34 SYSTEM_GROUP=   root
35
36 prefix=/usr/local
37 etcdir=/etc
38 varlib=/var/lib
39
40 confdir=$(etcdir)/chiark-backup
41 bindir=$(prefix)/bin
42 sharedir=$(prefix)/share/chiark-backup
43 txtdocdir=$(prefix)/share/doc/chiark-backup
44 exampledir=$(txtdocdir)/examples
45 vardir=$(varlib)/chiark-backup
46 mandir=${prefix}/man
47 man1dir=${mandir}/man1
48
49 INSTALL=                install -c
50 INSTALL_SHARE=          $(INSTALL) -m 644 -o root -g $(SYSTEM_GROUP)
51 INSTALL_SCRIPT=         $(INSTALL) -m 755 -o root -g $(SYSTEM_GROUP)
52 INSTALL_PROGRAM=        $(INSTALL_SCRIPT) -s
53 INSTALL_DIRECTORY=      $(INSTALL) -m 2755 -o root -g $(SYSTEM_GROUP) -d
54
55 CTARGETS=       readbuffer writebuffer
56 BINSCRIPTS=     checkallused loaded driver takedown whatsthis labeltape
57 SHARESCRIPTS=   bringup full increm
58 SHAREFILES=     backuplib.pl
59
60 EXAMPLES=       relativity chiark
61
62 all:            $(CTARGETS)
63
64 readbuffer:                             readbuffer.o rwbuffer.o
65 writebuffer:                            writebuffer.o rwbuffer.o
66 readbuffer.o writebuffer.o rwbuffer.o:  rwbuffer.h
67
68 install:                all
69                 $(INSTALL_DIRECTORY) $(confdir) $(bindir) $(sharedir) $(vardir) $(man1dir)
70                 $(INSTALL_PROGRAM) $(CTARGETS) $(bindir)
71                 set -e; for s in $(BINSCRIPTS); do \
72                         $(INSTALL_SCRIPT) $$s $(bindir)/backup-$$s; done
73                 $(INSTALL_SHARE) $(SHAREFILES) $(sharedir)
74                 $(INSTALL_SCRIPT) $(SHARESCRIPTS) $(sharedir)
75                 $(INSTALL) -m 644 readbuffer.1 ${man1dir}/readbuffer.1
76                 $(INSTALL) -m 644 writebuffer.1 ${man1dir}/writebuffer.1
77
78 install-docs:
79                 $(INSTALL_DIRECTORY) $(txtdocdir)
80                 $(INSTALL_SHARE) iwjbackup.txt $(txtdocdir)/README
81
82 install-examples:
83                 set -e; for e in $(EXAMPLES); do \
84                         cd examples/$$e; \
85                         $(INSTALL_DIRECTORY) $(exampledir)/$$e; \
86                         $(INSTALL_SHARE) [^A-Z]*[^~] $(exampledir)/$$e; \
87                         if test -f SYMLINKS.tar; then \
88                                 exec <SYMLINKS.tar; \
89                                 (set -e; cd $(exampledir) && tar -xf -); \
90                         fi; \
91                         cd ../..; \
92                 done
93
94 clean:
95                 rm -f *~ ./#*# *.o
96
97 distclean realclean:    clean
98                 rm -f $(CTARGETS)