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