chiark / gitweb /
e82baf6ce07fc939ad33493f56469a300f3e0bc4
[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 CFLAGS:=-Wall @WRITESTRINGS@ @CFLAGS@ -Werror \
35         -W -Wno-unused \
36         -Wno-pointer-sign -Wstrict-prototypes -Wmissing-prototypes \
37         -Wmissing-declarations -Wnested-externs -Wredundant-decls \
38         -Wpointer-arith -Wformat=2 -Winit-self \
39         -Wswitch-enum -Wunused-variable -Wbad-function-cast \
40         -Wno-strict-aliasing -fno-strict-aliasing
41 ALL_CFLAGS:=@DEFS@ -I$(srcdir) -I. $(CFLAGS)
42 CPPFLAGS:=@CPPFLAGS@
43 LDFLAGS:=@LDFLAGS@
44 LDLIBS:=@LIBS@
45
46 prefix:=@prefix@
47 exec_prefix:=@exec_prefix@
48 sbindir:=@sbindir@
49 sysconfdir:=@sysconfdir@
50 transform:=@program_transform_name@
51
52 TARGETS:=secnet
53
54 OBJECTS:=secnet.o util.o conffile.yy.o conffile.tab.o conffile.o modules.o \
55         resolver.o random.o udp.o site.o transform.o netlink.o rsa.o dh.o \
56         serpent.o md5.o version.o tun.o slip.o sha1.o ipaddr.o log.o \
57         process.o @LIBOBJS@ \
58         hackypar.o
59
60 DISTDIRS:=debian
61 DISTFILES:=BUGS COPYING CREDITS INSTALL LICENSE.txt Makefile.in \
62         NEWS NOTES README TODO \
63         setup.mac uk.org.greenend.secnet.plist README.mac \
64         ac_prog_cc_no_writeable_strings.m4 \
65         conffile.c conffile.fl conffile.h conffile.y \
66         conffile_internal.h \
67         config.h.in configure \
68         configure.in depend.sh dh.c \
69         example.conf \
70         install-sh ipaddr.c ipaddr.h ipaddr.py linux log.c \
71         magic.h md5.c md5.h \
72         make-secnet-sites \
73         modules.c netlink.c netlink.h process.c process.h \
74         random.c resolver.c rsa.c \
75         secnet.c secnet.h serpent.c serpent.h serpentsboxes.h \
76         snprintf.c snprintf.h \
77         sha1.c site.c slip.c stamp-h.in transform.c tun.c udp.c \
78         unaligned.h util.c util.h \
79         hackypar.c hackypar.h
80 DISTSUBDIRS:=debian/copyright debian/changelog debian/control \
81         debian/init debian/rules debian/compat debian/default
82
83 %.c:    %.y
84
85 %.yy.c: %.fl
86         flex --header=$*.yy.h -o$@ $<
87
88 %.tab.c %.tab.h:        %.y
89         bison -d -o $@ $<
90
91 %.o: %.c
92         $(CC) $(CPPFLAGS) $(ALL_CFLAGS) -c $< -o $@
93
94 all:    $(TARGETS)
95
96 # Automatic remaking of configuration files, from autoconf documentation
97 ${srcdir}/configure: configure.in
98         cd ${srcdir} && autoconf
99
100 # autoheader might not change config.h.in, so touch a stamp file.
101 ${srcdir}/config.h.in: stamp-h.in
102 ${srcdir}/stamp-h.in: configure.in
103         cd ${srcdir} && autoheader
104         echo timestamp > ${srcdir}/stamp-h.in
105
106 config.h: stamp-h
107 stamp-h: config.h.in config.status
108         ./config.status
109
110 Makefile: Makefile.in config.status
111         ./config.status
112
113 config.status: configure
114         ./config.status --recheck
115 # End of config file remaking rules
116
117 # C and header file dependency rules
118 SOURCES:=$(OBJECTS:.o=.c)
119 DEPENDS:=$(OBJECTS:.o=.d)
120
121 $(DEPENDS): ${srcdir}/depend.sh
122
123 %.d: %.c
124         ${srcdir}/depend.sh $(srcdir) $(CPPFLAGS) $(ALL_CFLAGS) $< > $@
125
126 -include $(DEPENDS)
127
128 # Manual dependencies section
129 conffile.yy.c:  conffile.fl conffile.tab.c
130 conffile.yy.h:  conffile.yy.c
131 conffile.tab.c: conffile.y
132 # End of manual dependencies section
133
134 secnet: $(OBJECTS)
135         $(CC) $(LDFLAGS) $(ALL_CFLAGS) -o $@ $(OBJECTS) $(LDLIBS)
136
137 version.c: Makefile
138         echo "#include \"secnet.h\"" >$@.new
139         echo "char version[]=\"secnet $(VERSION)\";" >>$@.new
140         mv -f $@.new $@
141
142 installdirs:
143         $(INSTALL) -d $(prefix)/share/secnet $(sbindir)
144
145 install: installdirs
146         $(INSTALL_PROGRAM) secnet $(sbindir)/`echo secnet|sed '$(transform)'`
147         $(INSTALL_PROGRAM) ${srcdir}/make-secnet-sites $(sbindir)/`echo make-secnet-sites|sed '$(transform)'`
148         $(INSTALL) ${srcdir}/ipaddr.py $(prefix)/share/secnet/ipaddr.py
149
150 clean:
151         $(RM) -f *.o *.yy.c *.tab.[ch] $(TARGETS) core version.c
152         $(RM) -f *.d *~
153
154 realclean:      clean
155         $(RM) -f *~ Makefile config.h  *.d \
156         config.log config.status config.cache \
157         stamp-h Makefile.bak
158
159 distclean:      realclean
160
161 pfname:=$(PACKAGE)-$(VERSION)
162 dist:
163         $(RM) -rf $(pfname)
164         mkdir $(pfname)
165         for i in $(DISTDIRS) ; do mkdir $(pfname)/$$i ; done
166         for i in $(DISTFILES) ; do ln -s ../$(srcdir)/$$i $(pfname)/ ; done
167         for i in $(DISTSUBDIRS) ; do ln -s ../../$(srcdir)/$$i $(pfname)/$$i ; done
168         tar hcf ../$(pfname).tar --exclude=CVS --exclude=.cvsignore $(pfname)
169         gzip -9f ../$(pfname).tar
170         $(RM) -rf $(pfname)