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