chiark / gitweb /
build system: remove *~ files in clean target
[secnet.git] / Makefile.in
1 # Makefile for secnet
2 # Copyright (C) 1995-2001 Stephen Early <steve@greenend.org.uk>
3
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 .PHONY: all clean realclean distclean dist install
19
20 PACKAGE:=secnet
21 VERSION:=0.1.18
22
23 @SET_MAKE@
24
25 srcdir:=@srcdir@
26 VPATH:=@srcdir@
27
28 SHELL:=/bin/sh
29 RM:=@RM@
30 CC:=@CC@
31 INSTALL:=@INSTALL@
32 INSTALL_PROGRAM:=@INSTALL_PROGRAM@
33
34 # Use -DHACKY_PARALLEL if you are compiling secnet for an extremely
35 # slow machine
36 #CFLAGS:=-Wall @WRITESTRINGS@ @CFLAGS@ -DHACKY_PARALLEL
37 CFLAGS:=-Wall @WRITESTRINGS@ @CFLAGS@
38 ALL_CFLAGS:=@DEFS@ -I$(srcdir) -I. $(CFLAGS)
39 CPPFLAGS:=@CPPFLAGS@
40 LDFLAGS:=@LDFLAGS@
41 LDLIBS:=@LIBS@
42
43 prefix:=@prefix@
44 exec_prefix:=@exec_prefix@
45 sbindir:=@sbindir@
46 sysconfdir:=@sysconfdir@
47 transform:=@program_transform_name@
48
49 TARGETS:=secnet
50
51 OBJECTS:=secnet.o util.o conffile.yy.o conffile.tab.o conffile.o modules.o \
52         resolver.o random.o udp.o site.o transform.o netlink.o rsa.o dh.o \
53         serpent.o md5.o version.o tun.o slip.o sha1.o ipaddr.o log.o \
54         process.o @LIBOBJS@ \
55         hackypar.o
56
57 DISTDIRS:=debian
58 DISTFILES:=BUGS COPYING CREDITS INSTALL LICENSE.txt Makefile.in \
59         NEWS NOTES README TODO \
60         ac_prog_cc_no_writeable_strings.m4 \
61         conffile.c conffile.fl conffile.h conffile.y \
62         conffile_internal.h \
63         config.h.in configure \
64         configure.in depend.sh dh.c \
65         example.conf \
66         getopt.c getopt1.c getopt.h \
67         install-sh ipaddr.c ipaddr.h ipaddr.py linux log.c \
68         magic.h md5.c md5.h \
69         make-secnet-sites \
70         modules.c netlink.c netlink.h process.c process.h \
71         random.c resolver.c rsa.c \
72         secnet.c secnet.h serpent.c serpent.h serpentsboxes.h \
73         snprintf.c snprintf.h \
74         sha1.c site.c slip.c stamp-h.in transform.c tun.c udp.c \
75         unaligned.h util.c util.h \
76         hackypar.c hackypar.h
77 DISTSUBDIRS:=debian/copyright debian/changelog debian/control \
78         debian/init debian/rules debian/compat debian/default
79
80 %.c:    %.y
81
82 %.yy.c: %.fl
83         flex -o$@ $<
84
85 %.tab.c %.tab.h:        %.y
86         bison -d -o $@ $<
87
88 %.o: %.c
89         $(CC) $(CPPFLAGS) $(ALL_CFLAGS) -c $< -o $@
90
91 all:    $(TARGETS)
92
93 # Automatic remaking of configuration files, from autoconf documentation
94 ${srcdir}/configure: configure.in
95         cd ${srcdir} && autoconf
96
97 # autoheader might not change config.h.in, so touch a stamp file.
98 ${srcdir}/config.h.in: stamp-h.in
99 ${srcdir}/stamp-h.in: configure.in
100         cd ${srcdir} && autoheader
101         echo timestamp > ${srcdir}/stamp-h.in
102
103 config.h: stamp-h
104 stamp-h: config.h.in config.status
105         ./config.status
106
107 Makefile: Makefile.in config.status
108         ./config.status
109
110 config.status: configure
111         ./config.status --recheck
112 # End of config file remaking rules
113
114 # C and header file dependency rules
115 SOURCES:=$(OBJECTS:.o=.c)
116 DEPENDS:=$(OBJECTS:.o=.d)
117
118 $(DEPENDS): ${srcdir}/depend.sh
119
120 %.d: %.c
121         ${srcdir}/depend.sh $(srcdir) $(CPPFLAGS) $(ALL_CFLAGS) $< > $@
122
123 -include $(DEPENDS)
124
125 # Manual dependencies section
126 conffile.yy.c:  conffile.fl conffile.tab.c
127 conffile.tab.c: conffile.y
128 # End of manual dependencies section
129
130 secnet: $(OBJECTS)
131         $(CC) $(LDFLAGS) $(ALL_CFLAGS) -o $@ $(OBJECTS) $(LDLIBS)
132
133 version.c: Makefile
134         echo "char version[]=\"secnet $(VERSION)\";" >version.c
135
136 install: all
137         $(INSTALL) -d $(prefix)/share/secnet $(sbindir)
138         $(INSTALL_PROGRAM) secnet $(sbindir)/`echo secnet|sed '$(transform)'`
139         $(INSTALL_PROGRAM) ${srcdir}/make-secnet-sites $(sbindir)/`echo make-secnet-sites|sed '$(transform)'`
140         $(INSTALL) ${srcdir}/ipaddr.py $(prefix)/share/secnet/ipaddr.py
141
142 clean:
143         $(RM) -f *.o *.yy.c *.tab.[ch] $(TARGETS) core version.c
144         $(RM) -f *.d *~
145
146 realclean:      clean
147         $(RM) -f *~ Makefile config.h  *.d \
148         config.log config.status config.cache \
149         stamp-h Makefile.bak
150
151 distclean:      realclean
152
153 pfname:=$(PACKAGE)-$(VERSION)
154 dist:
155         $(RM) -rf $(pfname)
156         mkdir $(pfname)
157         for i in $(DISTDIRS) ; do mkdir $(pfname)/$$i ; done
158         for i in $(DISTFILES) ; do ln -s ../$(srcdir)/$$i $(pfname)/ ; done
159         for i in $(DISTSUBDIRS) ; do ln -s ../../$(srcdir)/$$i $(pfname)/$$i ; done
160         tar hcf ../$(pfname).tar --exclude=CVS --exclude=.cvsignore $(pfname)
161         gzip -9f ../$(pfname).tar
162         $(RM) -rf $(pfname)