OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / freeswan / lib / Makefile
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.50 2002/03/27 23:08:24 mcr Exp $
15
16
17
18 include ../Makefile.inc
19 include ../Makefile.ver
20
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 \
30         portof.c prng.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 \
33         ttosa.c ttosubnet.c ttoul.c ultoa.c ultot.c \
34         ttoprotoport.c
35
36 OBJS=${SRCS:.c=.o} version.o
37
38 HDRS=freeswan.h internal.h
39 LIB=libfreeswan.a
40 # Original flags
41 CFLAGS=-I. $(USERCOMPILE)
42 CFLAGS+= -Wall
43 #CFLAGS+= -Wconversion
44 #CFLAGS+= -Wmissing-prototypes
45 CFLAGS+= -Wpointer-arith
46 CFLAGS+= -Wcast-qual
47 #CFLAGS+= -Wmissing-declarations
48 CFLAGS+= -Wstrict-prototypes
49 #CFLAGS+= -pedantic
50 #CFLAGS+= -W
51 #CFLAGS+= -Wwrite-strings
52 CFLAGS+= -Wbad-function-cast 
53
54 ARFLAGS=crvs
55 EXTHDRS=des.h
56 EXTLIBS=libdes.a
57 MANS=anyaddr.3 atoaddr.3 atoasr.3 atosa.3 atoul.3 goodmask.3 \
58         initaddr.3 initsubnet.3 keyblobtoid.3 \
59         optionsfrom.3 portof.3 prng.3 rangetosubnet.3 \
60         sameaddr.3 subnetof.3 ttoaddr.3 ttodata.3 ttosa.3 ttoul.3 version.3
61 .PHONY: all install clean l t lt tar check depend checkprograms
62
63
64
65 all:    $(EXTHDRS) $(LIB) $(EXTLIBS)
66 programs: all
67
68 install:
69         mkdir -p $(MANDIR)
70         for f in $(MANS) ; \
71         do \
72                 $(INSTALL) $(INSTMANFLAGS) $$f $(MANDIR)/ipsec_$$f || exit 1 ; \
73                 ../utils/manlink $(MANDIR) ipsec_$$f ; \
74         done
75
76 $(LIB): $(OBJS)
77         $(AR) $(ARFLAGS) $(LIB) $(OBJS)
78
79 $(OBJS):        $(HDRS)
80
81 # build version.c using version number from Makefile.ver
82 version.c:      version.in.c ../Makefile.ver
83         sed '/"/s/xxx/$(IPSECVERSION)/' version.in.c >$@
84
85 des.h:
86         ln -s ../libdes/des.h
87
88 libdes.a:       ../libdes/libdes.a
89         ln -f -s ../libdes/libdes.a
90
91 # yes, that's CFLAG=, not CFLAGS=
92 ../libdes/libdes.a:
93         cd ../libdes ; \
94         if test " `arch | sed 's/^i[3456]/x/'`" = " x86" ; \
95         then $(MAKE) CC='$(CC)' CFLAG='$(CFLAGS)' TESTING='' x86-elf ; \
96         else $(MAKE) CC='$(CC)' CFLAG='$(CFLAGS)' libdes.a ; \
97         fi
98
99 clean:
100         rm -f $(LIB) *.o try* core *.core $(EXTHDRS) $(EXTLIBS) version.c
101         cd ../libdes ; $(MAKE) clean
102
103
104
105 # developer-only stuff
106 l:
107         $(MAKE) $(LIB) ARFLAGS=crv CFLAGS=-O
108         $(RANLIB) $(LIB)
109
110 t:      $(LIB)
111         cp atosubnet.c try.c
112         cc -DATOSUBNET_MAIN try.c $(LIB) -o try
113         ./try -r
114         cp ttosubnet.c try1a.c
115         cc -DTTOSUBNET_MAIN try1a.c $(LIB) -o try1a
116         ./try1a -r
117         cp ttodata.c try2.c
118         cc -DTTODATA_MAIN try2.c $(LIB) -o try2
119         ./try2 -r
120         cp atoasr.c try3.c
121         cc -DATOASR_MAIN try3.c $(LIB) -o try3
122         ./try3 -r
123         cp atosa.c try4.c
124         cc -DATOSA_MAIN try4.c $(LIB) -o try4
125         ./try4 -r
126         cp ttosa.c try4a.c
127         cc -DTTOSA_MAIN try4a.c $(LIB) -o try4a
128         ./try4a -r
129         cp rangetosubnet.c try6.c
130         cc -DRANGETOSUBNET_MAIN try6.c $(LIB) -o try6
131         ./try6 -r
132         cp keyblobtoid.c try7.c
133         cc -DKEYID_MAIN try7.c $(LIB) -o try7
134         ./try7
135         cp prng.c try8.c
136         cc -DPRNG_MAIN try8.c $(LIB) -o try8
137         ./try8 -r
138
139 lt:     $(LIB)
140         $(MAKE) t
141         cp optionsfrom.c try5.c
142         cc -DTEST try5.c $(LIB) -o try5
143         echo --foo --bar >try5in1
144         echo --optionsfrom >>try5in1
145         echo try5in2 >>try5in1
146         echo --foo >try5in2
147         ./try5 --foo --bar --optionsfrom try5in1 --bar something
148
149 tar:    clean
150         tar -cvf /tmp/lib.tar Makefile [a-z]*
151
152 check:
153         echo no checks in lib right now.
154
155 depend:
156         makedepend -Y -- $(CFLAGS) -- $(SRCS)
157
158 checkprograms:
159
160 # DO NOT DELETE
161
162 pfkey_v2_build.o:  freeswan.h ../pluto/constants.h
163 pfkey_v2_build.o: ../pluto/defs.h ../pluto/log.h ./pfkeyv2.h ./pfkey.h
164 pfkey_v2_ext_bits.o:  freeswan.h ./pfkeyv2.h ./pfkey.h
165 pfkey_v2_parse.o:  freeswan.h ../pluto/constants.h
166 pfkey_v2_parse.o: ../pluto/defs.h ../pluto/log.h ./pfkeyv2.h ./pfkey.h
167 pfkey_v2_debug.o:  freeswan.h ./pfkeyv2.h ./pfkey.h