]> git.ipfire.org Git - people/ms/strongswan.git/blame - src/libfreeswan/Makefile
(no commit message)
[people/ms/strongswan.git] / src / libfreeswan / Makefile
CommitLineData
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
17FREESWANSRCDIR=../..
18
19include ${FREESWANSRCDIR}/Makefile.inc
20include ${FREESWANSRCDIR}/Makefile.ver
21
22
23MANDIR=$(MANTREE)/man3
24
25SRCS=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
35OBJS=${SRCS:.c=.o} version.o
36
37KLIPSD=${FREESWANSRCDIR}/linux/include
38SRCDIR=${FREESWANSRCDIR}/linux/lib/libfreeswan
39
40VPATH = ${SRCDIR}
41
42HDRS=${KLIPSD}/freeswan.h ${SRCDIR}/internal.h
43
44LIB=libfreeswan.a
45# Original flags
46CFLAGS=-I. -I${SRCDIR} -I${KLIPSD} -I${FREESWANSRCDIR} $(USERCOMPILE)
47CFLAGS+= -Wall
48#CFLAGS+= -Wconversion
49#CFLAGS+= -Wmissing-prototypes
50CFLAGS+= -Wpointer-arith
51CFLAGS+= -Wcast-qual
52#CFLAGS+= -Wmissing-declarations
53CFLAGS+= -Wstrict-prototypes
54#CFLAGS+= -pedantic
55#CFLAGS+= -W
56#CFLAGS+= -Wwrite-strings
57CFLAGS+= -Wbad-function-cast
58CFLAGS+= -DNAT_TRAVERSAL
59
60
61ARFLAGS=crvs
62EXTHDRS=des.h
63EXTLIBS=libdes.a
64MANS=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
70all: $(LIB)
71programs: $(LIB)
72
73install:
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
86install_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
103version.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
117clean:
118 rm -f $(LIB) *.o try* core *.core $(EXTHDRS) $(EXTLIBS) version.c
119
120
121# developer-only stuff
122l:
123 $(MAKE) $(LIB) ARFLAGS=crv CFLAGS=-O
124 $(RANLIB) $(LIB)
125
126t: $(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
152lt: $(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
162tar: clean
163 tar -cvf /tmp/lib.tar Makefile [a-z]*
164
165check:
166 echo no checks in lib right now.
167
168depend:
169 makedepend -Y -- $(CFLAGS) -- $(SRCS)
170
171checkprograms:
172
173# DO NOT DELETE
174