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