cleanup: Turn on -Werror
[secnet] / 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@ -Werror \
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 \
43 -Wno-strict-aliasing -fno-strict-aliasing
44 ALL_CFLAGS:=@DEFS@ -I$(srcdir) -I. $(CFLAGS)
45 CPPFLAGS:=@CPPFLAGS@
46 LDFLAGS:=@LDFLAGS@
47 LDLIBS:=@LIBS@
48
49 prefix:=@prefix@
50 exec_prefix:=@exec_prefix@
51 sbindir:=@sbindir@
52 sysconfdir:=@sysconfdir@
53 transform:=@program_transform_name@
54
55 TARGETS:=secnet
56
57 OBJECTS:=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 \
59 serpent.o md5.o version.o tun.o slip.o sha1.o ipaddr.o log.o \
60 process.o @LIBOBJS@ \
61 hackypar.o
62
63 DISTDIRS:=debian
64 DISTFILES:=BUGS COPYING CREDITS INSTALL LICENSE.txt Makefile.in \
65 NEWS NOTES README TODO \
66 ac_prog_cc_no_writeable_strings.m4 \
67 conffile.c conffile.fl conffile.h conffile.y \
68 conffile_internal.h \
69 config.h.in configure \
70 configure.in depend.sh dh.c \
71 example.conf \
72 getopt.c getopt1.c getopt.h \
73 install-sh ipaddr.c ipaddr.h ipaddr.py linux log.c \
74 magic.h md5.c md5.h \
75 make-secnet-sites \
76 modules.c netlink.c netlink.h process.c process.h \
77 random.c resolver.c rsa.c \
78 secnet.c secnet.h serpent.c serpent.h serpentsboxes.h \
79 snprintf.c snprintf.h \
80 sha1.c site.c slip.c stamp-h.in transform.c tun.c udp.c \
81 unaligned.h util.c util.h \
82 hackypar.c hackypar.h
83 DISTSUBDIRS:=debian/copyright debian/changelog debian/control \
84 debian/init debian/rules debian/compat debian/default
85
86 %.c: %.y
87
88 %.yy.c: %.fl
89 flex --header=$*.yy.h -o$@ $<
90
91 %.tab.c %.tab.h: %.y
92 bison -d -o $@ $<
93
94 %.o: %.c
95 $(CC) $(CPPFLAGS) $(ALL_CFLAGS) -c $< -o $@
96
97 all: $(TARGETS)
98
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
105 ${srcdir}/stamp-h.in: configure.in
106 cd ${srcdir} && autoheader
107 echo timestamp > ${srcdir}/stamp-h.in
108
109 config.h: stamp-h
110 stamp-h: config.h.in config.status
111 ./config.status
112
113 Makefile: Makefile.in config.status
114 ./config.status
115
116 config.status: configure
117 ./config.status --recheck
118 # End of config file remaking rules
119
120 # C and header file dependency rules
121 SOURCES:=$(OBJECTS:.o=.c)
122 DEPENDS:=$(OBJECTS:.o=.d)
123
124 $(DEPENDS): ${srcdir}/depend.sh
125
126 %.d: %.c
127 ${srcdir}/depend.sh $(srcdir) $(CPPFLAGS) $(ALL_CFLAGS) $< > $@
128
129 -include $(DEPENDS)
130
131 # Manual dependencies section
132 conffile.yy.c: conffile.fl conffile.tab.c
133 conffile.yy.h: conffile.yy.c
134 conffile.tab.c: conffile.y
135 # End of manual dependencies section
136
137 secnet: $(OBJECTS)
138 $(CC) $(LDFLAGS) $(ALL_CFLAGS) -o $@ $(OBJECTS) $(LDLIBS)
139
140 version.c: Makefile
141 echo "#include \"secnet.h\"" >$@.new
142 echo "char version[]=\"secnet $(VERSION)\";" >>$@.new
143 mv -f $@.new $@
144
145 install: all
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
150
151 clean:
152 $(RM) -f *.o *.yy.c *.tab.[ch] $(TARGETS) core version.c
153 $(RM) -f *.d *~
154
155 realclean: clean
156 $(RM) -f *~ Makefile config.h *.d \
157 config.log config.status config.cache \
158 stamp-h Makefile.bak
159
160 distclean: realclean
161
162 pfname:=$(PACKAGE)-$(VERSION)
163 dist:
164 $(RM) -rf $(pfname)
165 mkdir $(pfname)
166 for i in $(DISTDIRS) ; do mkdir $(pfname)/$$i ; done
167 for i in $(DISTFILES) ; do ln -s ../$(srcdir)/$$i $(pfname)/ ; done
168 for i in $(DISTSUBDIRS) ; do ln -s ../../$(srcdir)/$$i $(pfname)/$$i ; done
169 tar hcf ../$(pfname).tar --exclude=CVS --exclude=.cvsignore $(pfname)
170 gzip -9f ../$(pfname).tar
171 $(RM) -rf $(pfname)