1 # FreeS/WAN master makefile
2 # Copyright (C) 1998-2002 Henry Spencer.
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>.
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
14 # RCSID $Id: Makefile,v 1.4 2004/11/14 21:50:59 as Exp $
17 FREESWANSRCDIR
=$(shell pwd
)
25 # where KLIPS goes in the kernel
26 # note, some of the patches know the last part of this path
27 KERNELKLIPS
=$(KERNELSRC
)/net
/ipsec
28 KERNELCRYPTODES
=$(KERNELSRC
)/crypto
/ciphers
/des
29 KERNELLIBFREESWAN
=$(KERNELSRC
)/lib
/libfreeswan
30 KERNELLIBZLIB
=$(KERNELSRC
)/lib
/zlib
31 KERNELLIBCRYPTO
=$(KERNELSRC
)/lib
/libcrypto
32 KERNELINCLUDE
=$(KERNELSRC
)/include
33 KERNELALG
=$(KERNELKLIPS
)/alg
35 MAKEUTILS
=packaging
/utils
36 ERRCHECK
=${MAKEUTILS}/errcheck
37 KVUTIL
=${MAKEUTILS}/kernelversion
38 KVSHORTUTIL
=${MAKEUTILS}/kernelversion-short
41 # what variant of our patches should we use, and where is it
42 KERNELREL
=$(shell ${KVSHORTUTIL} ${KERNELSRC}/Makefile
)
44 # directories visited by all recursion
45 SUBDIRS
=doc lib programs linux
47 # declaration for make's benefit
48 .PHONY
: def insert kpatch klink klibcryptolink patches _patches _patches2.2 _patches2.4 \
49 klipsdefaults programs
install clean distclean \
50 ogo oldgo menugo xgo \
51 omod oldmod menumod xmod \
52 pcf ocf mcf xcf rcf nopromptgo \
53 precheck verset confcheck kernel module kinstall minstall \
54 backup unpatch uinstall install_file_list \
55 snapready relready ready buildready devready uml
check taroldinstall \
61 @echo
"Please read doc/intro.html or INSTALL before running make"
64 # everything that's necessary to put Klips into the kernel
65 insert
: patches klink klipsdefaults
67 kpatch
: unapplypatch applypatch klipsdefaults
70 -if
[ -f
${KERNELSRC}/freeswan.patch
]; then \
71 echo Undoing previous patches
; \
72 cat
${KERNELSRC}/freeswan.patch |
(cd
${KERNELSRC} && patch
-p1
-R
--force -E
-z .preipsec
--reverse
--ignore-whitespace
); \
76 echo Now performing forward patches
;
77 make kernelpatch
${KERNELREL} | tee
${KERNELSRC}/freeswan.patch |
(cd
${KERNELSRC} && patch
-p1
-b
-z .preipsec
--forward
--ignore-whitespace
)
80 echo Comparing
${KERNELSRC} to
${FREESWANSRCDIR}/linux.
81 packaging
/utils
/kerneldiff
${KERNELSRC}
83 # create KERNELKLIPS and populate it with symlinks to the sources
85 -[ -L
$(KERNELKLIPS
)/ipsec_init.c
] && rm -rf
${KERNELKLIPS}
86 -[ -L
$(KERNELCRYPTODES
)/cbc_enc.c
] && rm -rf
${KERNELCRYPTODES}
87 -[ -L
$(KERNELLIBFREESWAN
)/subnettoa.c
] && rm -rf
${KERNELLIBFREESWAN}
88 -[ -L
${KERNELLIBZLIB}/deflate.c
] && rm -rf
${KERNELLIBZLIB}
89 -[ -L
${KERNELINCLUDE}/freeswan.h
] && for i in linux
/include/*; do
rm -f
${KERNELINCLUDE}/$$i; done
90 -[ -L
$(KERNELALG
)/Makefile
] && rm -rf
$(KERNELALG
)
91 -[ -L
$(KERNELLIBCRYPTO
) ] && rm -f
$(KERNELLIBCRYPTO
)
92 mkdir
-p
$(KERNELKLIPS
)
93 mkdir
-p
$(KERNELCRYPTODES
)
94 mkdir
-p
$(KERNELLIBFREESWAN
)
95 mkdir
-p
$(KERNELLIBZLIB
)
97 $(KLIPSLINK
) `pwd`/Makefile.ver
$(KERNELKLIPS
)
98 $(KLIPSLINK
) `pwd`/linux
/include/* $(KERNELINCLUDE
)
99 $(KLIPSLINK
) `pwd`/linux
/net
/ipsec
/Makefile
* $(KERNELKLIPS
)
100 $(KLIPSLINK
) `pwd`/linux
/net
/ipsec
/Config.in
$(KERNELKLIPS
)
101 $(KLIPSLINK
) `pwd`/linux
/net
/ipsec
/defconfig
$(KERNELKLIPS
)
102 $(KLIPSLINK
) `pwd`/linux
/net
/ipsec
/*.
[ch
] $(KERNELKLIPS
)
103 $(KLIPSLINK
) `pwd`/linux
/net
/ipsec
/alg
/Makefile
* $(KERNELALG
)
104 $(KLIPSLINK
) `pwd`/linux
/net
/ipsec
/alg
/Config.
* $(KERNELALG
)
105 $(KLIPSLINK
) `pwd`/linux
/net
/ipsec
/alg
/ipsec_alg
*.
[ch
] $(KERNELALG
)
106 $(KLIPSLINK
) `pwd`/linux
/net
/ipsec
/alg
/scripts
$(KERNELALG
)
107 # Each ALGo does it own symlinks
108 $(KLIPSLINK
) `pwd`/lib
/libcrypto
$(KERNELLIBCRYPTO
)
109 $(KLIPSLINK
) `pwd`/linux
/lib
/zlib
/*.
[ch
] $(KERNELLIBZLIB
)
110 $(KLIPSLINK
) `pwd`/linux
/lib
/zlib
/Makefile
* $(KERNELLIBZLIB
)
111 $(KLIPSLINK
) `pwd`/linux
/lib
/libfreeswan
/*.
[ch
] $(KERNELLIBFREESWAN
)
112 $(KLIPSLINK
) `pwd`/linux
/lib
/libfreeswan
/Makefile
* $(KERNELLIBFREESWAN
)
113 $(KLIPSLINK
) `pwd`/linux
/crypto
/ciphers
/des
/*.
[chsS
] $(KERNELCRYPTODES
)
114 $(KLIPSLINK
) `pwd`/linux
/crypto
/ciphers
/des
/Makefile
* $(KERNELCRYPTODES
)
115 sed
'/"/s/xxx/$(IPSECVERSION)/' linux
/lib
/libfreeswan
/version.in.c
>$(KERNELKLIPS
)/version.c
117 # create libcrypto symlink
119 -[ -L
$(KERNELLIBCRYPTO
) ] && rm -f
$(KERNELLIBCRYPTO
)
120 $(KLIPSLINK
) `pwd`/lib
/libcrypto
$(KERNELLIBCRYPTO
)
123 PATCHER
=packaging
/utils
/patcher
126 @echo
\"make patches
\" is obsolete. See
\"make kpatch
\".
130 echo
"===============" >>out.kpatch
131 echo
"`date` `cd $(KERNELSRC) ; pwd`" >>out.kpatch
132 $(MAKE
) __patches
$(KERNELREL
) >>out.kpatch
134 # Linux-2.0.x version
135 __patches __patches2.0
:
136 @
$(PATCHER
) -v
$(KERNELSRC
) Documentation
/Configure.help \
137 'CONFIG_IPSEC' $(PATCHES
)/Documentation
/Configure.help.fs2_0.patch
138 @
$(PATCHER
) -v
$(KERNELSRC
) net
/Config.in \
139 'CONFIG_IPSEC' $(PATCHES
)/net
/Config.in.fs2_0.patch
140 @
$(PATCHER
) -v
$(KERNELSRC
) net
/Makefile \
141 'CONFIG_IPSEC' $(PATCHES
)/net
/Makefile.fs2_0.patch
142 @
$(PATCHER
) -v
$(KERNELSRC
) net
/ipv4
/af_inet.c \
143 'CONFIG_IPSEC' $(PATCHES
)/net
/ipv4
/af_inet.c.fs2_0.patch
144 # Removed patches, will unpatch automatically.
145 @
$(PATCHER
) -v
$(KERNELSRC
) include/linux
/proc_fs.h
146 @
$(PATCHER
) -v
$(KERNELSRC
) net
/core
/dev.c
147 @
$(PATCHER
) -v
$(KERNELSRC
) net
/ipv4
/protocol.c
148 @
$(PATCHER
) -v
$(KERNELSRC
) drivers
/net
/Space.c
149 @
$(PATCHER
) -v
$(KERNELSRC
) net
/netlink.c
150 @
$(PATCHER
) -v
$(KERNELSRC
) drivers
/isdn
/isdn_net.c
152 # Linux-2.2.x version
153 PATCHES24
=klips
/patches2.3
155 @
$(PATCHER
) -v
-c
$(KERNELSRC
) Documentation
/Configure.help \
156 'CONFIG_IPSEC' $(PATCHES
)/Documentation
/Configure.help.fs2_2.patch
157 @
$(PATCHER
) -v
$(KERNELSRC
) net
/Config.in \
158 'CONFIG_IPSEC' $(PATCHES
)/net
/Config.in.fs2_2.patch
159 @
$(PATCHER
) -v
$(KERNELSRC
) net
/Makefile \
160 'CONFIG_IPSEC' $(PATCHES
)/net
/Makefile.fs2_2.patch
161 @
$(PATCHER
) -v
$(KERNELSRC
) net
/ipv4
/af_inet.c \
162 'CONFIG_IPSEC' $(PATCHES
)/net
/ipv4
/af_inet.c.fs2_2.patch
163 @
$(PATCHER
) -v
$(KERNELSRC
) net
/ipv4
/udp.c \
164 'CONFIG_IPSEC' $(PATCHES
)/net
/ipv4
/udp.c.fs2_2.patch
165 @
$(PATCHER
) -v
$(KERNELSRC
) include/net
/sock.h \
166 'CONFIG_IPSEC' $(PATCHES
)/net
/include.net.sock.h.fs2_2.patch
167 # Removed patches, will unpatch automatically.
168 @
$(PATCHER
) -v
$(KERNELSRC
) include/linux
/proc_fs.h
169 @
$(PATCHER
) -v
$(KERNELSRC
) net
/core
/dev.c
170 @
$(PATCHER
) -v
$(KERNELSRC
) net
/ipv4
/protocol.c
171 @
$(PATCHER
) -v
$(KERNELSRC
) drivers
/net
/Space.c
172 @
$(PATCHER
) -v
$(KERNELSRC
) include/linux
/netlink.h
173 @
$(PATCHER
) -v
$(KERNELSRC
) net
/netlink
/af_netlink.c
174 @
$(PATCHER
) -v
$(KERNELSRC
) net
/netlink
/netlink_dev.c
175 @
$(PATCHER
) -v
$(KERNELSRC
) include/linux
/socket.h
176 @
$(PATCHER
) -v
$(KERNELSRC
) drivers
/isdn
/isdn_net.c
178 # Linux-2.4.0 version
179 PATCHES22
=klips
/patches2.2
180 __patches2.3 __patches2.4
:
181 @
$(PATCHER
) -v
-c
$(KERNELSRC
) Documentation
/Configure.help \
182 'CONFIG_IPSEC' $(PATCHES
)/Documentation
/Configure.help.fs2_2.patch
183 @
$(PATCHER
) -v
$(KERNELSRC
) net
/Config.in \
184 'CONFIG_IPSEC' $(PATCHES
)/net
/Config.in.fs2_4.patch
185 @
$(PATCHER
) -v
$(KERNELSRC
) net
/Makefile \
186 'CONFIG_IPSEC' $(PATCHES
)/net
/Makefile.fs2_4.patch
187 @
$(PATCHER
) -v
$(KERNELSRC
) net
/ipv4
/af_inet.c \
188 'CONFIG_IPSEC' $(PATCHES
)/net
/ipv4
/af_inet.c.fs2_4.patch
189 @
$(PATCHER
) -v
$(KERNELSRC
) net
/ipv4
/udp.c \
190 'CONFIG_IPSEC' $(PATCHES
)/net
/ipv4
/udp.c.fs2_4.patch
191 @
$(PATCHER
) -v
$(KERNELSRC
) include/net
/sock.h \
192 'CONFIG_IPSEC' $(PATCHES
)/net
/include.net.sock.h.fs2_4.patch
193 # Removed patches, will unpatch automatically.
194 @
$(PATCHER
) -v
$(KERNELSRC
) include/linux
/proc_fs.h
195 @
$(PATCHER
) -v
$(KERNELSRC
) net
/core
/dev.c
196 @
$(PATCHER
) -v
$(KERNELSRC
) net
/ipv4
/protocol.c
197 @
$(PATCHER
) -v
$(KERNELSRC
) drivers
/net
/Space.c
198 @
$(PATCHER
) -v
$(KERNELSRC
) include/linux
/netlink.h
199 @
$(PATCHER
) -v
$(KERNELSRC
) net
/netlink
/af_netlink.c
200 @
$(PATCHER
) -v
$(KERNELSRC
) net
/netlink
/netlink_dev.c
201 @
$(PATCHER
) -v
$(KERNELSRC
) drivers
/isdn
/isdn_net.c
204 @KERNELDEFCONFIG
=$(KERNELSRC
)/arch
/$(ARCH
)/defconfig
; \
205 KERNELCONFIG
=$(KCFILE
) ; \
206 if
! egrep
-q
'CONFIG_IPSEC' $$KERNELDEFCONFIG ; \
209 cp
-a
$$KERNELDEFCONFIG $$KERNELDEFCONFIG.orig
; \
210 chmod u
+w
$$KERNELDEFCONFIG ; \
211 cat
$$KERNELDEFCONFIG $(KERNELKLIPS
)/defconfig \
212 >$$KERNELDEFCONFIG.tmp
; \
213 rm -f
$$KERNELDEFCONFIG ; \
214 cp
-a
$$KERNELDEFCONFIG.tmp
$$KERNELDEFCONFIG ; \
215 rm -f
$$KERNELDEFCONFIG.tmp
; \
217 if
! egrep
-q
'CONFIG_IPSEC' $$KERNELCONFIG ; \
220 cp
-a
$$KERNELCONFIG $$KERNELCONFIG.orig
; \
221 chmod u
+w
$$KERNELCONFIG ; \
222 cat
$$KERNELCONFIG $(KERNELKLIPS
)/defconfig \
223 >$$KERNELCONFIG.tmp
; \
224 rm -f
$$KERNELCONFIG ; \
225 cp
-a
$$KERNELCONFIG.tmp
$$KERNELCONFIG ; \
226 rm -f
$$KERNELCONFIG.tmp
; \
234 if
[ -f
${LIBDIR}/pluto
]; \
236 echo WARNING
: FreeS
/WAN
1.99 still installed.
;\
237 echo WARNING
: moving
${LIBDIR} to
${LIBDIR}.v1
;\
238 mv
${LIBDIR} ${LIBDIR}.v1
;\
241 install:: checkv199install
243 programs
install clean checkprograms
::
244 @for d in
$(SUBDIRS
) ; \
246 (cd
$$d && $(MAKE
) FREESWANSRCDIR
=..
$@
) || exit
1; \
250 rm -rf
$(RPMTMPDIR
) $(RPMDEST
)
251 rm -f out.
*build out.
*install # but leave out.kpatch
256 if
[ -f umlsetup.sh
]; then source umlsetup.sh
; if
[ -d
"$$POOLSPACE" ]; then
rm -rf
$$POOLSPACE; fi
; fi
260 # proxies for major kernel make operations
262 # do-everything entries
263 KINSERT_PRE
=precheck verset insert
264 PRE
=precheck verset kpatch klibcryptolink
265 POST
=confcheck programs kernel
install
266 MPOST
=confcheck programs module
install
267 ogo
: $(PRE
) pcf
$(POST
)
268 oldgo
: $(PRE
) ocf
$(POST
)
269 nopromptgo
: $(PRE
) rcf
$(POST
)
270 menugo
: $(PRE
) mcf
$(POST
)
271 xgo
: $(PRE
) xcf
$(POST
)
272 omod
: $(PRE
) pcf
$(MPOST
)
273 oldmod
: $(PRE
) ocf
$(MPOST
)
274 menumod
: $(PRE
) mcf
$(MPOST
)
275 xmod
: $(PRE
) xcf
$(MPOST
)
279 @if
test ! -d
$(KERNELSRC
) -a
! -L
$(KERNELSRC
) ; \
281 echo
'*** cannot find directory "$(KERNELSRC)"!!' ; \
282 echo
'*** may be necessary to add symlink to kernel source' ; \
285 @if
! cd
$(KERNELSRC
) ; \
287 echo
'*** cannot "cd $(KERNELSRC)"!!' ; \
288 echo
'*** may be necessary to add symlink to kernel source' ; \
291 @if
test ! -f
$(KCFILE
) ; \
293 echo
'*** cannot find "$(KCFILE)"!!' ; \
294 echo
'*** perhaps kernel has never been configured?' ; \
295 echo
'*** please do that first; the results are necessary.' ; \
298 @if
test ! -f
$(VERFILE
) ; \
300 echo
'*** cannot find "$(VERFILE)"!!' ; \
301 echo
'*** perhaps kernel has never been compiled?' ; \
302 echo
'*** please do that first; the results are necessary.' ; \
306 # set version code if this is a fresh CVS checkout
307 ifeq ($(wildcard cvs.datemark
),cvs.datemark
)
308 verset Makefile.ver
: cvs.datemark
309 echo IPSECVERSION
=`date -r cvs.datemark +cvs%Y%b%d_%H:%M:%S` >Makefile.ver
313 @grep IPSECVERSION Makefile.ver
316 Makefile
: Makefile.ver
318 # configuring (exit statuses disregarded, something fishy here sometimes)
320 -cd
$(KERNELSRC
) ; $(MAKE
) $(KERNMAKEOPTS
) xconfig
322 -cd
$(KERNELSRC
) ; $(MAKE
) $(KERNMAKEOPTS
) menuconfig
324 -cd
$(KERNELSRC
) ; $(MAKE
) $(KERNMAKEOPTS
) config
327 -cd
$(KERNELSRC
) ; $(MAKE
) $(KERNMAKEOPTS
) oldconfig
330 cd
$(KERNELSRC
) ; $(MAKE
) $(KERNMAKEOPTS
) oldconfig_nonint
</dev
/null
331 cd
$(KERNELSRC
) ; $(MAKE
) $(KERNMAKEOPTS
) dep
>/dev
/null
334 @if
test ! -f
$(KCFILE
) ; \
335 then echo
'*** no kernel configuration file written!!' ; exit
1 ; \
337 @if
! egrep
-q
'^CONFIG_IPSEC=[my]' $(KCFILE
) ; \
338 then echo
'*** IPsec not in kernel config ($(KCFILE))!!' ; exit
1 ; \
340 @if
! egrep
-q
'CONFIG_IPSEC[ ]+1' $(ACFILE
) && \
341 ! egrep
-q
'CONFIG_IPSEC_MODULE[ ]+1' $(ACFILE
) ; \
342 then echo
'*** IPsec in kernel config ($(KCFILE)),' ; \
343 echo
'*** but not in config header file ($(ACFILE))!!' ; \
346 @if egrep
-q
'^CONFIG_IPSEC=m' $(KCFILE
) && \
347 ! egrep
-q
'^CONFIG_MODULES=y' $(KCFILE
) ; \
348 then echo
'*** IPsec configured as module in kernel with no module support!!' ; exit
1 ; \
350 @if
! egrep
-q
'CONFIG_IPSEC_AH[ ]+1' $(ACFILE
) && \
351 ! egrep
-q
'CONFIG_IPSEC_ESP[ ]+1' $(ACFILE
) ; \
352 then echo
'*** IPsec configuration must include AH or ESP!!' ; exit
1 ; \
355 # kernel building, with error checks
357 rm -f out.kbuild out.kinstall
358 # undocumented kernel folklore: clean BEFORE dep.
359 # we run make dep seperately, because there is no point in running ERRCHECK
360 # on the make dep output.
361 # see LKML thread "clean before or after dep?"
362 ( cd
$(KERNELSRC
) ; $(MAKE
) $(KERNMAKEOPTS
) $(KERNCLEAN
) $(KERNDEP
) )
363 ( cd
$(KERNELSRC
) ; $(MAKE
) $(KERNMAKEOPTS
) $(KERNEL
) ) 2>&1 | tee out.kbuild
364 @if egrep
-q
'^CONFIG_MODULES=y' $(KCFILE
) ; \
366 ( cd
$(KERNELSRC
) ; \
367 $(MAKE
) $(KERNMAKEOPTS
) modules
2>&1 ) | tee
-a out.kbuild
; \
369 ${ERRCHECK} out.kbuild
371 # this target takes a kernel source tree and it builds a link tree,
372 # and then does make oldconfig for each .config file that was found in configs.
373 # The location for the disk space required for the link tree is found via
376 if
[ -z
"${RH_KERNELSRC_POOL}" ]; then echo Please set RH_KERNELSRC_POOL.
; exit
1; fi
377 mkdir
-p
${RH_KERNELSRC_POOL}
378 KV
=`${KVUTIL} $(RH_KERNELSRC)/Makefile` ; \
379 cd
${RH_KERNELSRC_POOL} && \
380 mkdir
-p
$$KV && cd
$$KV && \
381 for config in
${RH_KERNELSRC}/configs
/*; do \
382 basecfg
=`basename $$config` ;\
383 mkdir
-p
${RH_KERNELSRC_POOL}/$$KV/$$basecfg && \
384 cd
${RH_KERNELSRC_POOL}/$$KV/$$basecfg && \
385 lndir
${RH_KERNELSRC} .
&& \
386 rm -rf
include/asm
&& \
387 (cd
include/linux
&& sed
-e
'/#include "\/boot\/kernel.h"/d' <rhconfig.h
>rhconfig.h-new
&& mv rhconfig.h-new rhconfig.h
) && \
388 rm -f
include/linux
/modules
/*.stamp
&& \
393 # module-only building, with error checks
394 ifneq ($(strip $(MODBUILDDIR
)),)
395 ${MODBUILDDIR}/Makefile
: ${FREESWANSRCDIR}/packaging
/makefiles
/module.make
396 mkdir
-p
${MODBUILDDIR}
397 cp
${FREESWANSRCDIR}/packaging
/makefiles
/module.make
${MODBUILDDIR}/Makefile
398 echo
"# " >>${MODBUILDDIR}/Makefile
399 echo
"# Local Variables: " >>${MODBUILDDIR}/Makefile
400 echo
"# compile-command: \"${MAKE} FREESWANSRCDIR=${FREESWANSRCDIR} ARCH=${ARCH} ${MODULE_FLAGS} MODULE_DEF_INCLUDE=${MODULE_DEF_INCLUDE} ipsec.o\"" >>${MODBUILDDIR}/Makefile
401 echo
"# End: " >>${MODBUILDDIR}/Makefile
403 # clean out the linux/net/ipsec directory so that VPATH will work properly
404 module
: ${MODBUILDDIR}/Makefile
405 ${MAKE} -C linux
/net
/ipsec
${MODULE_FLAGS} MODULE_DEF_INCLUDE
=${MODULE_DEF_INCLUDE} clean
406 ${MAKE} -C
${MODBUILDDIR} ARCH
=${ARCH} ${MODULE_FLAGS} MODULE_DEF_INCLUDE
=${MODULE_DEF_INCLUDE} ipsec.o
407 ${MAKE} -C
${MODBUILDDIR} ARCH
=${ARCH} ${MODULE_FLAGS} MODULE_DEF_INCLUDE
=${MODULE_DEF_INCLUDE} LIBCRYPTO
=${FREESWANSRCDIR}/lib
/libcrypto MODULE_FLAGS
="$(MODULE_FLAGS)" alg_modules
409 modclean
: ${MODBUILDDIR}/Makefile
410 ${MAKE} -C
${MODBUILDDIR} clean
412 # module-only install, with error checks
414 ( FSMODLIB
=`make -C $(KERNELSRC) -p dummy | ( sed -n -e '/^MODLIB/p' -e '/^MODLIB/q' ; cat > /dev/null ) | sed -e 's/^MODLIB[ :=]*\([^;]*\).*/\1/'` ; \
415 if
[ -z
"$$FSMODLIB" ] ; then \
416 FSMODLIB
=`make -C $(KERNELSRC) -n -p modules_install | ( sed -n -e '/^MODLIB/p' -e '/^MODLIB/q' ; cat > /dev/null ) | sed -e 's/^MODLIB[ :=]*\([^;]*\).*/\1/'` ; \
418 if
[ -z
"$$FSMODLIB" ] ; then \
419 echo
"No known place to install module. Aborting." ; \
423 mkdir
-p
$$FSMODLIB/kernel
/net
/ipsec
; \
424 cp
$(MODBUILDDIR
)/ipsec.o
$$FSMODLIB/kernel
/net
/ipsec
; \
425 mkdir
-p
$$FSMODLIB/kernel
/net
/ipsec
/alg
; \
426 for i in
`sed -n '/IPSEC_ALG/s/CONFIG_IPSEC_ALG_\(.*\)=[Mm]/ipsec_\1.o/p' $(KCFILE) | tr '[A-Z]' '[a-z]'`;do \
427 echo
"installing $$i"; \
428 cp
$(MODBUILDDIR
)/alg
/$$i $$FSMODLIB/kernel
/net
/ipsec
/alg
;\
433 ${MAKE} -C linux
/net
/ipsec ARCH
=${ARCH} ${MODULE_FLAGS} MODULE_DEF_INCLUDE
=${MODULE_DEF_INCLUDE} ipsec.o
434 ${MAKE} -C linux
/net
/ipsec ARCH
=${ARCH} ${MODULE_FLAGS} MODULE_DEF_INCLUDE
=${MODULE_DEF_INCLUDE} LIBCRYPTO
=${FREESWANSRCDIR}/lib
/libcrypto MODULE_FLAGS
="$(MODULE_FLAGS)" alg_modules
437 ${MAKE} -C linux
/net
/ipsec ARCH
=${ARCH} ${MODULE_FLAGS} MODULE_DEF_INCLUDE
=${MODULE_DEF_INCLUDE} clean
439 # module-only install, with error checks
441 ( FSMODLIB
=`make -C $(KERNELSRC) -p dummy | ( sed -n -e '/^MODLIB/p' -e '/^MODLIB/q' ; cat > /dev/null ) | sed -e 's/^MODLIB[ :=]*\([^;]*\).*/\1/'` ; \
442 if
[ -z
"$$FSMODLIB" ] ; then \
443 FSMODLIB
=`make -C $(KERNELSRC) -n -p modules_install | ( sed -n -e '/^MODLIB/p' -e '/^MODLIB/q' ; cat > /dev/null ) | sed -e 's/^MODLIB[ :=]*\([^;]*\).*/\1/'` ; \
445 if
[ -z
"$$FSMODLIB" ] ; then \
446 echo
"No known place to install module. Aborting." ; \
450 mkdir
-p
$$FSMODLIB/kernel
/net
/ipsec
; \
451 cp linux
/net
/ipsec
/ipsec.o
$$FSMODLIB/kernel
/net
/ipsec
; \
452 mkdir
-p
$$FSMODLIB/kernel
/net
/ipsec
/alg
; \
453 for i in
`sed -n '/IPSEC_ALG/s/CONFIG_IPSEC_ALG_\(.*\)=[Mm]/ipsec_\1.o/p' $(KCFILE) | tr '[A-Z]' '[a-z]'`;do \
454 echo
"installing $$i"; \
455 cp linux
/net
/ipsec
/alg
/$$i $$FSMODLIB/kernel
/net
/ipsec
/alg
;\
460 # kernel install, with error checks
464 # undocumented kernel folklore: modules_install must precede install (observed on RHL8.0)
465 @if egrep
-q
'^CONFIG_MODULES=y' $(KCFILE
) ; \
467 ( cd
$(KERNELSRC
) ; \
468 $(MAKE
) $(KERNMAKEOPTS
) modules_install
2>&1 ) | tee
-a out.kinstall
; \
470 ( cd
$(KERNELSRC
) ; $(MAKE
) $(KERNMAKEOPTS
) install ) 2>&1 | tee
-a out.kinstall
471 ${ERRCHECK} out.kinstall
474 packaging
/utils
/kernelpatch
2.5
476 kernelpatch2.4 kernelpatch
:
477 packaging
/utils
/kernelpatch
2.4
480 packaging
/utils
/kernelpatch
2.2
483 packaging
/utils
/kernelpatch
2.0
486 @for d in
$(SUBDIRS
) ; \
488 (cd
$$d && $(MAKE
) --no-print-directory FREESWANSRCDIR
=.. install_file_list
) || exit
1; \
491 # take all the patches out of the kernel
492 # (Note, a couple of files are modified by non-patch means; they are
493 # included in "make backup".)
495 @echo
\"make unpatch
\" is obsolete. See make unapplypatch.
499 for f in
`find $(KERNELSRC)/. -name '*.preipsec' -print` ; \
501 echo
"restoring $$f:" ; \
502 dir=`dirname $$f` ; \
503 core
=`basename $$f .preipsec` ; \
505 mv
-f
$$core.preipsec
$$core ; \
506 rm -f
$$core.wipsec
$$core.ipsecmd5
; \
509 # uninstall, as much as possible
511 $(MAKE
) --no-print-directory install_file_list | egrep
-v
'(/ipsec.conf$$|/ipsec.d/)' | xargs
rm -f
514 tar --ignore-failed-read
-c
-z
-f oldFreeSWAN.
tar.gz
`$(MAKE) --no-print-directory install_file_list`
516 # some oddities meant for the developers, probably of no use to users
518 # make tags and TAGS files from ctags and etags for vi and emacs, respectively.
520 etags
`find lib programs linux -name '*.[ch]'`
521 ctags
`find lib programs linux -name '*.[ch]'`
525 # at the moment there is no difference between snapshot and release build
526 snapready
: buildready
532 rm -f dtrmakefile cvs.datemark
535 uml
: programs checkprograms
536 @echo XXX do some checks to see if
all the manual pieces are done.
537 -chmod
+x testing
/utils
/make-uml.sh
538 testing
/utils
/make-uml.sh
`pwd`
541 (touch Makefile.inc
&& source umlsetup.sh
&& cd
$$POOLSPACE && make
$$FREESWANHOSTS $$REGULARHOSTS )
544 # DESTDIR is normally set in Makefile.inc
545 # These recipes explicitly pass it to the second-level makes so that
546 # DESTDIR can be adjusted for building for UML without changing Makefile.inc
547 # See testing/utils/functions.sh
548 # testing/utils/make-uml.sh
549 # testing/utils/uml-functions.sh
550 check: uml Makefile.ver
551 ifneq ($(strip(${REGRESSRESULTS})),)
552 mkdir
-p
${REGRESSRESULTS}
554 @for d in
$(SUBDIRS
); do
(cd
$$d && $(MAKE
) DESTDIR
=${DESTDIR} checkprograms || exit
1); done
555 @for d in
$(SUBDIRS
); \
557 echo
===================================; \
558 echo Now making
check in
$$d; \
559 echo
===================================; \
560 (cd
$$d && $(MAKE
) DESTDIR
=${DESTDIR} check || exit
1);\
562 ifneq ($(strip(${REGRESSRESULTS})),)
563 -perl testing
/utils
/regress-summarize-results.pl
${REGRESSRESULTS}
568 @echo please cd packaging
/redhat and
569 @echo run
"make RH_KERNELSRC=/some/path/to/kernel/src rpm"
572 @echo
"Minimizing size for ipkg binaries..."
573 @cd
$(DESTDIR
)$(INC_USRLOCAL
)/lib
/ipsec
&& \
574 for f in
*; do
(if file
$$f | grep ARM
> /dev
/null
; then
( $(STRIP
) --strip-unneeded
$$f); fi
); done
575 @
rm -r
$(DESTDIR
)$(INC_USRLOCAL
)/man
576 @
rm -f
$(DESTDIR
)$(INC_RCDEFAULT
)/*.old
577 @
rm -f
$(DESTDIR
)$(INC_USRLOCAL
)/lib
/ipsec
/*.old
578 @
rm -f
$(DESTDIR
)$(INC_USRLOCAL
)/libexec
/ipsec
/*.old
579 @
rm -f
$(DESTDIR
)$(INC_USRLOCAL
)/sbin
/*.old
582 @echo
"Moving ipsec.o into temporary location..."
583 KV
=$(shell ${KVUTIL} ${KERNELSRC}/Makefile
) && \
584 mkdir
-p
$(FREESWANSRCDIR
)/packaging
/ipkg
/kernel-module
/lib
/modules
/$$KV/net
/ipsec
585 KV
=$(shell ${KVUTIL} ${KERNELSRC}/Makefile
) && \
586 cp linux
/net
/ipsec
/ipsec.o
$(FREESWANSRCDIR
)/packaging
/ipkg
/kernel-module
/lib
/modules
/$$KV/net
/ipsec
/
587 KV
=$(shell ${KVUTIL} ${KERNELSRC}/Makefile
)
590 rm -rf
$(FREESWANSRCDIR
)/packaging
/ipkg
/kernel-module
/
591 rm -rf
$(FREESWANSRCDIR
)/packaging
/ipkg
/ipkg
/
592 rm -f
$(FREESWANSRCDIR
)/packaging
/ipkg
/control-freeswan
593 rm -f
$(FREESWANSRCDIR
)/packaging
/ipkg
/control-freeswan-module
596 ipkg
: programs
install ipkg_strip ipkg_module
597 @echo
"Generating ipkg...";
598 DESTDIR
=${DESTDIR} FREESWANSRCDIR
=${FREESWANSRCDIR} ARCH
=${ARCH} IPSECVERSION
=${IPSECVERSION} .
/packaging
/ipkg
/generate-ipkg