]>
Commit | Line | Data |
---|---|---|
997358a6 MW |
1 | # FreeS/WAN library |
2 | # Copyright (C) 1998-2001 Henry Spencer. | |
3 | # | |
4 | # This program is free software; you can redistribute it and/or modify it | |
5 | # under the terms of the GNU General Public License as published by the | |
6 | # Free Software Foundation; either version 2 of the License, or (at your | |
7 | # option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, but | |
10 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
11 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 | # for more details. | |
13 | # | |
14 | # RCSID $Id: Makefile,v 1.2 2004/03/22 21:53:17 as Exp $ | |
15 | ||
16 | ||
17 | FREESWANSRCDIR=../.. | |
18 | ||
19 | include ${FREESWANSRCDIR}/Makefile.inc | |
20 | include ${FREESWANSRCDIR}/Makefile.ver | |
21 | ||
22 | ||
23 | MANDIR=$(MANTREE)/man3 | |
24 | ||
25 | SRCS=addrtoa.c addrtot.c addrtypeof.c anyaddr.c atoaddr.c \ | |
26 | atoasr.c atosa.c atosubnet.c atoul.c copyright.c datatot.c \ | |
27 | goodmask.c initaddr.c initsaid.c initsubnet.c keyblobtoid.c \ | |
28 | optionsfrom.c pfkey_v2_build.c pfkey_v2_ext_bits.c pfkey_v2_parse.c \ | |
29 | pfkey_v2_debug.c prng.c \ | |
30 | portof.c rangetoa.c rangetosubnet.c sameaddr.c \ | |
31 | satoa.c satot.c subnetof.c subnettoa.c subnettot.c \ | |
32 | subnettypeof.c ttoaddr.c ttodata.c ttoprotoport.c \ | |
33 | ttosa.c ttosubnet.c ttoul.c ultoa.c ultot.c | |
34 | ||
35 | OBJS=${SRCS:.c=.o} version.o | |
36 | ||
37 | KLIPSD=${FREESWANSRCDIR}/linux/include | |
38 | SRCDIR=${FREESWANSRCDIR}/linux/lib/libfreeswan | |
39 | ||
40 | VPATH = ${SRCDIR} | |
41 | ||
42 | HDRS=${KLIPSD}/freeswan.h ${SRCDIR}/internal.h | |
43 | ||
44 | LIB=libfreeswan.a | |
45 | # Original flags | |
46 | CFLAGS=-I. -I${SRCDIR} -I${KLIPSD} -I${FREESWANSRCDIR} $(USERCOMPILE) | |
47 | CFLAGS+= -Wall | |
48 | #CFLAGS+= -Wconversion | |
49 | #CFLAGS+= -Wmissing-prototypes | |
50 | CFLAGS+= -Wpointer-arith | |
51 | CFLAGS+= -Wcast-qual | |
52 | #CFLAGS+= -Wmissing-declarations | |
53 | CFLAGS+= -Wstrict-prototypes | |
54 | #CFLAGS+= -pedantic | |
55 | #CFLAGS+= -W | |
56 | #CFLAGS+= -Wwrite-strings | |
57 | CFLAGS+= -Wbad-function-cast | |
58 | CFLAGS+= -DNAT_TRAVERSAL | |
59 | ||
60 | ||
61 | ARFLAGS=crvs | |
62 | EXTHDRS=des.h | |
63 | EXTLIBS=libdes.a | |
64 | MANS=anyaddr.3 atoaddr.3 atoasr.3 atosa.3 atoul.3 goodmask.3 \ | |
65 | initaddr.3 initsubnet.3 optionsfrom.3 portof.3 rangetosubnet.3 \ | |
66 | sameaddr.3 subnetof.3 ttoaddr.3 ttodata.3 ttosa.3 ttoul.3 version.3 | |
67 | ||
68 | .PHONY: all install clean l t lt tar check depend checkprograms | |
69 | ||
70 | all: $(LIB) | |
71 | programs: $(LIB) | |
72 | ||
73 | install: | |
74 | @mkdir -p $(MANDIR) | |
75 | @for f in $(MANS) ; \ | |
76 | do \ | |
77 | $(INSTALL) $(INSTMANFLAGS) $(SRCDIR)/$$f $(MANDIR)/ipsec_$$f || exit 1 ; \ | |
78 | done | |
340ad20a | 79 | @$(FREESWANSRCDIR)/utils/manlink $(foreach man, $(MANS), ${SRCDIR}/$(man)) | \ |
997358a6 MW |
80 | while read from to; \ |
81 | do \ | |
82 | ln -s -f ipsec_$$from $(MANDIR)/$$to; \ | |
83 | done | |
84 | ||
85 | ||
86 | install_file_list: | |
87 | @for f in $(MANS) ; \ | |
88 | do \ | |
89 | echo $(MANDIR)/ipsec_$$f;\ | |
90 | done; | |
340ad20a | 91 | @$(FREESWANSRCDIR)/utils/manlink $(foreach man, $(MANS), ${SRCDIR}/$(man)) | \ |
997358a6 MW |
92 | while read from to; \ |
93 | do \ | |
94 | echo $(MANDIR)/$$to; \ | |
95 | done | |
96 | ||
97 | $(LIB): $(OBJS) | |
98 | $(AR) $(ARFLAGS) $(LIB) $(OBJS) | |
99 | ||
100 | $(OBJS): $(HDRS) | |
101 | ||
102 | # build version.c using version number from Makefile.ver | |
103 | version.c: ${SRCDIR}/version.in.c ${FREESWANSRCDIR}/Makefile.ver | |
104 | sed '/"/s/xxx/$(IPSECVERSION)/' ${SRCDIR}/version.in.c >$@ | |
105 | ||
106 | #libdes.a: ../libdes/libdes.a | |
107 | # ln -f -s ../libdes/libdes.a | |
108 | # | |
109 | # yes, that's CFLAG=, not CFLAGS= | |
110 | #../libdes/libdes.a: | |
111 | # cd ../libdes ; \ | |
112 | # if test " `arch | sed 's/^i[3456]/x/'`" = " x86" ; \ | |
113 | # then $(MAKE) CC='$(CC)' CFLAG='$(CFLAGS)' TESTING='' x86-elf ; \ | |
114 | # else $(MAKE) CC='$(CC)' CFLAG='$(CFLAGS)' libdes.a ; \ | |
115 | # fi | |
116 | ||
117 | clean: | |
118 | rm -f $(LIB) *.o try* core *.core $(EXTHDRS) $(EXTLIBS) version.c | |
119 | ||
120 | ||
121 | # developer-only stuff | |
122 | l: | |
123 | $(MAKE) $(LIB) ARFLAGS=crv CFLAGS=-O | |
124 | $(RANLIB) $(LIB) | |
125 | ||
126 | t: $(LIB) | |
127 | ln -f -s ${SRCDIR}/atosubnet.c try.c | |
128 | ${CC} ${CFLAGS} -DATOSUBNET_MAIN try.c $(LIB) -o try | |
129 | ./try -r | |
130 | ln -f -s ${SRCDIR}/ttosubnet.c try1a.c | |
131 | ${CC} ${CFLAGS} -DTTOSUBNET_MAIN try1a.c $(LIB) -o try1a | |
132 | ./try1a -r | |
133 | ln -f -s ${SRCDIR}/ttodata.c try2.c | |
134 | ${CC} ${CFLAGS} -DTTODATA_MAIN try2.c $(LIB) -o try2 | |
135 | ./try2 -r | |
136 | ln -f -s ${SRCDIR}/atoasr.c try3.c | |
137 | ${CC} ${CFLAGS} -DATOASR_MAIN try3.c $(LIB) -o try3 | |
138 | ./try3 -r | |
139 | ln -f -s ${SRCDIR}/atosa.c try4.c | |
140 | ${CC} ${CFLAGS} -DATOSA_MAIN try4.c $(LIB) -o try4 | |
141 | ./try4 -r | |
142 | ln -f -s ${SRCDIR}/ttosa.c try4a.c | |
143 | ${CC} ${CFLAGS} -DTTOSA_MAIN try4a.c $(LIB) -o try4a | |
144 | ./try4a -r | |
145 | ln -f -s ${SRCDIR}/rangetosubnet.c try6.c | |
146 | ${CC} ${CFLAGS} -DRANGETOSUBNET_MAIN try6.c $(LIB) -o try6 | |
147 | ./try6 -r | |
148 | ln -f -s ${SRCDIR}/addrtot.c try7.c | |
149 | ${CC} ${CFLAGS} -DADDRTOT_MAIN try7.c $(LIB) -o try7 | |
150 | ./try7 -r | |
151 | ||
152 | lt: $(LIB) | |
153 | $(MAKE) t | |
154 | cp optionsfrom.c try5.c | |
155 | cc -DTEST try5.c $(LIB) -o try5 | |
156 | echo --foo --bar >try5in1 | |
157 | echo --optionsfrom >>try5in1 | |
158 | echo try5in2 >>try5in1 | |
159 | echo --foo >try5in2 | |
160 | ./try5 --foo --bar --optionsfrom try5in1 --bar something | |
161 | ||
162 | tar: clean | |
163 | tar -cvf /tmp/lib.tar Makefile [a-z]* | |
164 | ||
165 | check: | |
166 | echo no checks in lib right now. | |
167 | ||
168 | depend: | |
169 | makedepend -Y -- $(CFLAGS) -- $(SRCS) | |
170 | ||
171 | checkprograms: | |
172 | ||
173 | # DO NOT DELETE | |
174 |