Commit | Line | Data |
---|---|---|
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 | |
20 | PACKAGE:=secnet | |
ca58ee48 | 21 | VERSION:=0.1.18 |
2fe58dfd SE |
22 | |
23 | @SET_MAKE@ | |
24 | ||
25 | srcdir:=@srcdir@ | |
26 | VPATH:=@srcdir@ | |
27 | ||
974d0468 SE |
28 | SHELL:=/bin/sh |
29 | RM:=@RM@ | |
30 | CC:=@CC@ | |
31 | INSTALL:=@INSTALL@ | |
32 | INSTALL_PROGRAM:=@INSTALL_PROGRAM@ | |
2fe58dfd | 33 | |
0ade8ecc | 34 | CFLAGS:=-Wall @WRITESTRINGS@ @CFLAGS@ -Werror \ |
18ca0b44 IJ |
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 \ | |
7f861e63 RK |
39 | -Wswitch-enum -Wunused-variable -Wbad-function-cast \ |
40 | -Wno-strict-aliasing -fno-strict-aliasing | |
fe5e9cc4 | 41 | ALL_CFLAGS:=@DEFS@ -I$(srcdir) -I. $(CFLAGS) |
ea7ec970 | 42 | CPPFLAGS:=@CPPFLAGS@ |
2fe58dfd | 43 | LDFLAGS:=@LDFLAGS@ |
2fe58dfd SE |
44 | LDLIBS:=@LIBS@ |
45 | ||
974d0468 SE |
46 | prefix:=@prefix@ |
47 | exec_prefix:=@exec_prefix@ | |
48 | sbindir:=@sbindir@ | |
49 | sysconfdir:=@sysconfdir@ | |
50 | transform:=@program_transform_name@ | |
51 | ||
2fe58dfd SE |
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 \ | |
7138d0c5 | 56 | serpent.o md5.o version.o tun.o slip.o sha1.o ipaddr.o log.o \ |
3b83c932 SE |
57 | process.o @LIBOBJS@ \ |
58 | hackypar.o | |
9d3a4132 | 59 | |
3b83c932 | 60 | DISTDIRS:=debian |
794f2398 | 61 | DISTFILES:=BUGS COPYING CREDITS INSTALL LICENSE.txt Makefile.in \ |
8dea8d37 | 62 | NEWS NOTES README TODO \ |
3b83c932 | 63 | ac_prog_cc_no_writeable_strings.m4 \ |
9d3a4132 | 64 | conffile.c conffile.fl conffile.h conffile.y \ |
f74f5f43 SE |
65 | conffile_internal.h \ |
66 | config.h.in configure \ | |
3b83c932 | 67 | configure.in depend.sh dh.c \ |
8dea8d37 SE |
68 | example.conf \ |
69 | getopt.c getopt1.c getopt.h \ | |
ff05a229 SE |
70 | install-sh ipaddr.c ipaddr.h ipaddr.py linux log.c \ |
71 | magic.h md5.c md5.h \ | |
8dea8d37 | 72 | make-secnet-sites \ |
7138d0c5 | 73 | modules.c netlink.c netlink.h process.c process.h \ |
9d3a4132 | 74 | random.c resolver.c rsa.c \ |
974d0468 | 75 | secnet.c secnet.h serpent.c serpent.h serpentsboxes.h \ |
8dea8d37 | 76 | snprintf.c snprintf.h \ |
3454dce4 | 77 | sha1.c site.c slip.c stamp-h.in transform.c tun.c udp.c \ |
3b83c932 SE |
78 | unaligned.h util.c util.h \ |
79 | hackypar.c hackypar.h | |
ca58ee48 SE |
80 | DISTSUBDIRS:=debian/copyright debian/changelog debian/control \ |
81 | debian/init debian/rules debian/compat debian/default | |
2fe58dfd SE |
82 | |
83 | %.c: %.y | |
84 | ||
85 | %.yy.c: %.fl | |
27f5042b | 86 | flex --header=$*.yy.h -o$@ $< |
2fe58dfd | 87 | |
76eca292 | 88 | %.tab.c %.tab.h: %.y |
8689b3a9 | 89 | bison -d -o $@ $< |
2fe58dfd | 90 | |
fe5e9cc4 SE |
91 | %.o: %.c |
92 | $(CC) $(CPPFLAGS) $(ALL_CFLAGS) -c $< -o $@ | |
2fe58dfd SE |
93 | |
94 | all: $(TARGETS) | |
95 | ||
8689b3a9 SE |
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 | |
f74f5f43 | 102 | ${srcdir}/stamp-h.in: configure.in |
8689b3a9 SE |
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 | ||
974d0468 | 110 | Makefile: Makefile.in config.status |
8689b3a9 | 111 | ./config.status |
974d0468 SE |
112 | |
113 | config.status: configure | |
8689b3a9 SE |
114 | ./config.status --recheck |
115 | # End of config file remaking rules | |
59635212 | 116 | |
d3fe100d SE |
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 | |
ea7ec970 | 124 | ${srcdir}/depend.sh $(srcdir) $(CPPFLAGS) $(ALL_CFLAGS) $< > $@ |
d3fe100d SE |
125 | |
126 | -include $(DEPENDS) | |
127 | ||
128 | # Manual dependencies section | |
8689b3a9 | 129 | conffile.yy.c: conffile.fl conffile.tab.c |
27f5042b | 130 | conffile.yy.h: conffile.yy.c |
8689b3a9 SE |
131 | conffile.tab.c: conffile.y |
132 | # End of manual dependencies section | |
974d0468 | 133 | |
2fe58dfd | 134 | secnet: $(OBJECTS) |
fe5e9cc4 | 135 | $(CC) $(LDFLAGS) $(ALL_CFLAGS) -o $@ $(OBJECTS) $(LDLIBS) |
2fe58dfd | 136 | |
974d0468 | 137 | version.c: Makefile |
fcbc5905 IJ |
138 | echo "#include \"secnet.h\"" >$@.new |
139 | echo "char version[]=\"secnet $(VERSION)\";" >>$@.new | |
140 | mv -f $@.new $@ | |
974d0468 SE |
141 | |
142 | install: all | |
d3fe100d SE |
143 | $(INSTALL) -d $(prefix)/share/secnet $(sbindir) |
144 | $(INSTALL_PROGRAM) secnet $(sbindir)/`echo secnet|sed '$(transform)'` | |
145 | $(INSTALL_PROGRAM) ${srcdir}/make-secnet-sites $(sbindir)/`echo make-secnet-sites|sed '$(transform)'` | |
146 | $(INSTALL) ${srcdir}/ipaddr.py $(prefix)/share/secnet/ipaddr.py | |
974d0468 | 147 | |
2fe58dfd | 148 | clean: |
8689b3a9 | 149 | $(RM) -f *.o *.yy.c *.tab.[ch] $(TARGETS) core version.c |
2b6ab62e | 150 | $(RM) -f *.d *~ |
2fe58dfd SE |
151 | |
152 | realclean: clean | |
d3fe100d | 153 | $(RM) -f *~ Makefile config.h *.d \ |
8689b3a9 SE |
154 | config.log config.status config.cache \ |
155 | stamp-h Makefile.bak | |
2fe58dfd | 156 | |
469fd1d9 SE |
157 | distclean: realclean |
158 | ||
974d0468 SE |
159 | pfname:=$(PACKAGE)-$(VERSION) |
160 | dist: | |
161 | $(RM) -rf $(pfname) | |
162 | mkdir $(pfname) | |
3b83c932 | 163 | for i in $(DISTDIRS) ; do mkdir $(pfname)/$$i ; done |
8689b3a9 | 164 | for i in $(DISTFILES) ; do ln -s ../$(srcdir)/$$i $(pfname)/ ; done |
3b83c932 | 165 | for i in $(DISTSUBDIRS) ; do ln -s ../../$(srcdir)/$$i $(pfname)/$$i ; done |
fe5e9cc4 | 166 | tar hcf ../$(pfname).tar --exclude=CVS --exclude=.cvsignore $(pfname) |
974d0468 SE |
167 | gzip -9f ../$(pfname).tar |
168 | $(RM) -rf $(pfname) |