]> git.ipfire.org Git - thirdparty/strongswan.git/blob - linux/net/ipsec/Makefile
- import of strongswan-2.7.0
[thirdparty/strongswan.git] / linux / net / ipsec / Makefile
1 # Makefile for KLIPS kernel code as a module
2 # Copyright (C) 1998, 1999, 2000,2001 Richard Guy Briggs.
3 # Copyright (C) 2002 Michael Richardson <mcr@freeswan.org>
4 #
5 # This program is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by the
7 # Free Software Foundation; either version 2 of the License, or (at your
8 # option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 #
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 # for more details.
14 #
15 # RCSID $Id: Makefile,v 1.2 2004/03/22 21:53:19 as Exp $
16 #
17 # Note! Dependencies are done automagically by 'make dep', which also
18 # removes any old dependencies. DON'T put your own dependencies here
19 # unless it's something special (ie not a .c file).
20 #
21
22 ifeq ($(strip $(KLIPSMODULE)),)
23 FREESWANSRCDIR=.
24 else
25 FREESWANSRCDIR=../../..
26 endif
27 -include ${FREESWANSRCDIR}/Makefile.ver
28
29 ifeq ($(strip $(KLIPS_TOP)),)
30 KLIPS_TOP=../..
31 endif
32
33 ifneq ($(strip $(KLIPSMODULE)),)
34
35 ifndef TOPDIR
36 TOPDIR:=/usr/src/linux
37 endif
38 export TOPDIR
39
40 endif
41
42 #
43 # This magic from User-Mode-Linux list. It gets list of -I options, as
44 # UML needs some extra, that varry by revision.
45 #
46 KERNEL_CFLAGS= $(shell $(MAKE) -C $(TOPDIR) --no-print-directory -s -f Makefile ARCH=$(ARCH) MAKEFLAGS= script SCRIPT='@echo $$(CFLAGS)' )
47
48 MODULE_CFLAGS= $(shell $(MAKE) -C $(TOPDIR) --no-print-directory -s -f Makefile ARCH=$(ARCH) MAKEFLAGS= script SCRIPT='@echo $$(MODFLAGS)' )
49
50 subdir- :=
51 subdir-n :=
52 subdir-y :=
53 subdir-m :=
54
55
56 MOD_DESTDIR:=net/ipsec
57
58 export TOPDIR
59
60 all: ipsec.o
61
62 foo:
63 echo KERNEL: ${KERNEL_CFLAGS}
64 echo MODULE: ${MODULE_CFLAGS}
65
66 ipsec.o: foo
67
68 O_TARGET := ipsec.o
69 obj-y := ipsec_init.o ipsec_sa.o ipsec_radij.o radij.o
70 obj-y += ipsec_life.o ipsec_proc.o
71 obj-y += ipsec_tunnel.o ipsec_xmit.o ipsec_rcv.o
72 obj-y += sysctl_net_ipsec.o
73 obj-y += pfkey_v2.o pfkey_v2_parser.o pfkey_v2_ext_process.o
74 #obj-y += version.o
75
76 LIBDESDIR=${KLIPS_TOP}/crypto/ciphers/des
77 VPATH+= ${LIBDESDIR}
78
79 include ${LIBDESDIR}/Makefile.objs
80
81 LIBFREESWANDIR=${KLIPS_TOP}/lib/libfreeswan
82 VPATH+=${LIBFREESWANDIR}
83
84 include ${LIBFREESWANDIR}/Makefile.objs
85
86 # IPcomp stuff
87 obj-$(CONFIG_IPSEC_IPCOMP) += ipcomp.o
88
89 LIBZLIBSRCDIR=${KLIPS_TOP}/lib/zlib
90 VPATH+=${LIBZLIBSRCDIR}
91
92 # LIBCRYPTO Will be overriden eg. when doing "make module"
93 # from freeswan-2 src root
94 # Default value assumes already symlinked libcrypto under $TOPDIR/lib
95 LIBCRYPTO=$(TOPDIR)/lib/libcrypto
96 VPATH+=${LIBCRYPTO}
97
98 alg/static_init_mod.o: dummy
99 $(MAKE) -C alg CC='$(CC)' TOPDIR='$(TOPDIR)' \
100 'EXTRA_CFLAGS=$(EXTRA_CFLAGS)' \
101 static_init_mod.o
102
103
104 alg_modules: dummy
105 $(MAKE) $(MODULE_FLAGS) -C alg CC='$(CC)' TOPDIR='$(TOPDIR)' \
106 'LIBCRYPTO=$(LIBCRYPTO)' \
107 'EXTRA_CFLAGS=$(EXTRA_CFLAGS)' \
108 modules
109
110 # CFLAGS='$(CFLAGS)' \
111 # MODULE_CFLAGS='$(MODULE_CFLAGS)' KERNEL_CFLAGS='$(KERNEL_CFLAGS)' \
112 #
113 include ${LIBZLIBSRCDIR}/Makefile.objs
114
115 export-objs := radij.o
116
117 # New handling of KERNEL_CFLAGS and MODULE_CFLAGS introduced in 2.0
118 # tosses export-objs logic :(
119 CFLAGS_ipsec_alg.o += -DEXPORT_SYMTAB
120 obj-$(CONFIG_IPSEC_ALG) +=ipsec_alg.o alg/static_init_mod.o
121 export-objs += ipsec_alg.o
122 subdir-m += alg
123
124 EXTRA_CFLAGS += $(ALGO_FLAGS)
125
126
127 # include file with .h-style macros that would otherwise be created by
128 # config. Must occur before other includes.
129 ifneq ($(strip $(MODULE_DEF_INCLUDE)),)
130 EXTRA_CFLAGS += -include ${MODULE_DEF_INCLUDE}
131 endif
132
133 # 'override CFLAGS' should really be 'EXTRA_CFLAGS'
134 #EXTRA_CFLAGS += -nostdinc
135 EXTRA_CFLAGS += -I${KLIPS_TOP}/include
136
137 EXTRA_CFLAGS += -I${TOPDIR}/include
138 EXTRA_CFLAGS += -I${LIBZLIBSRCDIR}
139
140 ifeq ($(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION),2.4.2-2)
141 EXTRA_CFLAGS += -DREDHAT_BOGOSITY
142 endif
143
144 ifeq ($(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION),2.4.3-12)
145 EXTRA_CFLAGS += -DREDHAT_BOGOSITY
146 endif
147
148
149 #ifeq ($(CONFIG_IPSEC_DEBUG),y)
150 #EXTRA_CFLAGS += -g
151 #endif
152
153 #ifeq ($(CONFIG_IPSEC_ALG), y)
154 EXTRA_CFLAGS += -DCONFIG_IPSEC_ALG
155 #endif
156 # MOST of these flags are in KERNEL_CFLAGS already!
157
158 EXTRA_CFLAGS += $(KLIPSCOMPILE)
159 EXTRA_CFLAGS += -Wall
160 #EXTRA_CFLAGS += -Werror
161 #EXTRA_CFLAGS += -Wconversion
162 #EXTRA_CFLAGS += -Wmissing-prototypes
163 # cannot use both -Wpointer-arith and -Werror with CONFIG_HIGHMEM
164 # include/linux/highmem.h has an inline function definition that uses void* arithmentic.
165 ifeq ($(CONFIG_NOHIGHMEM),y)
166 EXTRA_CFLAGS += -Wpointer-arith
167 endif
168 #EXTRA_CFLAGS += -Wcast-qual
169 #EXTRA_CFLAGS += -Wmissing-declarations
170 #EXTRA_CFLAGS += -Wstrict-prototypes
171 #EXTRA_CFLAGS += -pedantic
172 #EXTRA_CFLAGS += -O3
173 #EXTRA_CFLAGS += -W
174 #EXTRA_CFLAGS += -Wwrite-strings
175 #EXTRA_CFLAGS += -Wbad-function-cast
176
177 ifneq ($(strip $(KLIPSMODULE)),)
178 # for when we aren't building in the kernel tree
179 EXTRA_CFLAGS += -DARCH=${ARCH}
180 EXTRA_CFLAGS += -DMODVERSIONS
181 EXTRA_CFLAGS += -include ${TOPDIR}/include/linux/modversions.h
182 EXTRA_CFLAGS += ${MODULE_CFLAGS}
183 endif
184
185 EXTRA_CFLAGS += ${KERNEL_CFLAGS}
186
187
188 # GCC 3.2 (and we presume any other 3.x) wants -falign-functions
189 # in place of the traditional -malign-functions. Getting this
190 # wrong leads to a warning, which is fatal due to our use of -Werror.
191 ifeq ($(patsubst 3.%,3,$(shell $(CC) -dumpversion)),3)
192 override CFLAGS:=$(subst -malign-functions=,-falign-functions=,$(CFLAGS))
193 endif
194
195
196 obj-$(CONFIG_IPSEC_AUTH_HMAC_MD5) += ipsec_md5c.o
197 obj-$(CONFIG_IPSEC_AUTH_HMAC_SHA1) += ipsec_sha1.o
198
199 ###
200 ### Pre Rules.make
201 ###
202 # undo O_TARGET, obj-y if no static
203 ifneq ($(CONFIG_IPSEC),y)
204 O_TARGET :=
205 ipsec_obj-y := $(obj-y)
206 obj-y :=
207 subdir-y :=
208 endif
209
210 # Define obj-m if modular ipsec
211 ifeq ($(CONFIG_IPSEC),m)
212 obj-m += ipsec.o
213 endif
214
215
216 # These rules translate from new to old makefile rules
217 # Translate to Rules.make lists.
218 multi-used := $(filter $(list-multi), $(obj-y) $(obj-m))
219 multi-objs := $(foreach m, $(multi-used), $($(basename $(m))-objs))
220 active-objs := $(sort $(multi-objs) $(obj-y) $(obj-m))
221 O_OBJS := $(obj-y)
222 M_OBJS := $(obj-m)
223 MIX_OBJS := $(filter $(export-objs), $(active-objs))
224 OX_OBJS := $(export-objs)
225 SUB_DIRS := $(subdir-y)
226 ALL_SUB_DIRS := $(subdir-y) $(subdir-m)
227 MOD_SUB_DIRS := $(subdir-m)
228
229 # dunno why, but some 2.2 setups may need explicit -DEXPORT_SYMTAB
230 # uncomment next line if ipsec_alg.c compilation fails with
231 # "parse error before `EXPORT_SYMTAB_not_defined'" --Juanjo
232 # CFLAGS_ipsec_alg.o += -DEXPORT_SYMTAB
233 #
234
235 include $(TOPDIR)/Rules.make
236
237 ###
238 ### Post Rules.make
239 ###
240 # for modular ipsec, no O_TARGET defined => define ipsec.o creation rules
241 ifeq ($(CONFIG_IPSEC),m)
242 ipsec.o : $(ipsec_obj-y)
243 rm -f $@
244 $(LD) $(LD_EXTRAFLAGS) -r $(ipsec_obj-y) -o $@
245 endif
246
247 $(ipsec_obj-y) $(obj-y) $(obj-m): $(TOPDIR)/include/linux/config.h $(TOPDIR)/include/linux/autoconf.h
248
249 #$(obj-y) $(obj-m): $(TOPDIR)/include/linux/config.h $(TOPDIR)/include/linux/autoconf.h
250
251 USE_STANDARD_AS_RULE=true
252
253 clean:
254 $(MAKE) -C alg clean
255 -rm -f *.o
256 -rm -f .*.o.flags
257 -rm version.c
258
259 tags TAGS: *.c *.h libfreeswan/*.c libfreeswan/*.h
260 etags *.c ../../include/*.h ../../include/freeswan/*.h
261 ctags *.c ../../include/*.h ../../include/freeswan/*.h
262
263 tar:
264 tar -cvf /dev/f1 .
265
266 #
267 # $Log: Makefile,v $
268 # Revision 1.2 2004/03/22 21:53:19 as
269 # merged alg-0.8.1 branch with HEAD
270 #
271 # Revision 1.1.4.1 2004/03/16 09:48:19 as
272 # alg-0.8.1rc12 patch merged
273 #
274 # Revision 1.1 2004/03/15 20:35:26 as
275 # added files from freeswan-2.04-x509-1.5.3
276 #
277 # Revision 1.61 2003/06/22 21:07:46 mcr
278 # adjusted TAGS target in makefile to be useful in 2.00 source layout.
279 #
280 # Revision 1.60 2003/05/03 23:45:23 mcr
281 # rm .o.flags and generated version.c file.
282 #
283 # Revision 1.59 2003/02/12 19:32:47 rgb
284 # Added ipsec_xmit to the list of object files.
285 #
286 # Revision 1.58 2003/01/03 00:36:44 rgb
287 #
288 # Added emacs compile-command.
289 #
290 # Revision 1.57 2002/11/08 23:49:53 mcr
291 # use KERNEL_CFLAGS and MODULE_CFLAGS to get proper list
292 # of include directories.
293 # This also eliminates some of the guesswork in the kernel
294 # configuration file.
295 #
296 # Revision 1.56 2002/11/08 23:23:18 mcr
297 # attempt to guess kernel compilation flags (i.e. list of -I)
298 # by using some magic targets in the kernel makefile.
299 #
300 # Revision 1.55 2002/11/08 10:13:33 mcr
301 # added additional include directories for module builds for 2.4.19.
302 #
303 # Revision 1.54 2002/10/20 06:10:30 build
304 # CONFIG_NOHIGHMEM for -Wpointer-arith RPM building issues.
305 #
306 # Revision 1.53 2002/10/17 16:32:01 mcr
307 # enable standard AS rules.
308 #
309 # Revision 1.52 2002/10/06 06:13:44 sam
310 # Altering order of includes, so that architecture-specific header files,
311 # used for building RPM modules specifically, are processed first.
312 #
313 # Revision 1.51 2002/10/05 15:06:38 dhr
314 #
315 # - To allow for gcc3.2 (used in Red Hat Linux 8.0): adjust CFLAGS (set
316 # by kernel machinery) to use -falign-functions= in place of
317 # -malign-functions=. Eliminates a warning (fatal with -Werror).
318 #
319 # - When CONFIG_HIGHMEM is on, -Wpointer-arith will warn about
320 # include/linux/highmem.h. Since this is fatal with -Werror, we
321 # suppress -Wpointer-arith if CONFIG_HIGHMEM is set.
322 #
323 # Revision 1.50 2002/09/16 21:19:45 mcr
324 # enable -Werror for production - this helps a lot (found a bug in ipsec_rcv.c)
325 #
326 # Revision 1.49 2002/07/29 05:12:39 mcr
327 # get rid of some extraneous stuff, now handled by a prefix
328 # Makefile when building as a module.
329 #
330 # Revision 1.48 2002/07/28 23:13:49 mcr
331 # set KLIPS_TOP and use it instead of ../..
332 # if KLIPSMODULE, then include a bunch of stuff defined in Makefile.inc
333 # that gets us the "typical" configuration that we want.
334 #
335 # Revision 1.47 2002/06/02 21:51:41 mcr
336 # changed TOPDIR->FREESWANSRCDIR in all Makefiles.
337 # (note that linux/net/ipsec/Makefile uses TOPDIR because this is the
338 # kernel sense.)
339 #
340 # Revision 1.46 2002/05/14 02:35:51 rgb
341 # Added file pfkey_v2_ext_process.c.
342 #
343 # Revision 1.45 2002/05/13 17:21:40 mcr
344 # mkdep dies when given a -I to a directory that does not exist.
345 # arch/${ARCH}/include is for UM arch only, so include it for that
346 # ARCH only.
347 #
348 # Revision 1.44 2002/04/24 20:38:12 mcr
349 # moved more stuff behind $KLIPSMODULE=y to get static linking to work.
350 #
351 # Revision 1.43 2002/04/24 09:16:18 mcr
352 # include local Makefile.ver as well as FS_rootdir version.
353 #
354 # Revision 1.42 2002/04/24 08:50:08 mcr
355 # critical patch is to set TOPDIR with :=.
356 #
357 # Revision 1.40 2002/04/24 00:41:07 mcr
358 # Moved from ./klips/net/ipsec/Makefile,v
359 #
360 # Revision 1.39 2002/01/17 04:39:40 rgb
361 # Take compile options from top level Makefile.inc
362 #
363 # Revision 1.38 2001/11/27 05:28:07 rgb
364 # Shut off -Werror until we figure out a graceful way of quieting down the
365 # pfkey_ops defined but not used complaint in the case of SMP in
366 # pfkey_v2.c.
367 #
368 # Revision 1.37 2001/11/27 05:10:15 rgb
369 # Added -Ilibdes and removed lib/des* symlinks.
370 #
371 # Revision 1.36 2001/11/26 09:23:47 rgb
372 # Merge MCR's ipsec_sa, eroute, proc and struct lifetime changes.
373 #
374 # Revision 1.35.2.1 2001/09/25 02:17:50 mcr
375 # added ipsec_sa, ipsec_life, ipsec_proc.
376 # added -Werror to compile flags (see fix for zlib/zutil.h)
377 #
378 # Revision 1.3 2001/09/21 04:41:26 mcr
379 # actually, ipsec_proc.c and ipsec_life.c were never actually compiled.
380 #
381 # Revision 1.2 2001/09/21 04:11:33 mcr
382 # first compilable version.
383 #
384 # Revision 1.1.1.2 2001/09/17 01:17:52 mcr
385 # snapshot 2001-09-16
386 #
387 # Revision 1.35 2001/09/07 22:09:12 rgb
388 # Quiet down compilation.
389 #
390 # Revision 1.34 2001/08/11 17:10:23 henry
391 # update bogosity stuff to cover RH7.1 update
392 #
393 # Revision 1.33 2001/06/14 19:35:07 rgb
394 # Update copyright date.
395 #
396 # Revision 1.32 2001/06/13 21:00:50 rgb
397 # Added a kludge to get around RedHat kernel version bogosity...
398 #
399 # Revision 1.31 2001/01/29 22:19:06 rgb
400 # Convert to 2.4 new style with back compat.
401 #
402 # Revision 1.30 2000/09/29 19:51:57 rgb
403 # Moved klips/net/ipsec/ipcomp_* to zlib/* (Svenning).
404 #
405 # Revision 1.29 2000/09/15 11:37:01 rgb
406 # Merge in heavily modified Svenning Soerensen's <svenning@post5.tele.dk>
407 # IPCOMP zlib deflate code.
408 #
409 # Revision 1.28 2000/09/15 04:55:25 rgb
410 # Clean up pfkey object inclusion into the default object.
411 #
412 # Revision 1.27 2000/09/12 03:20:47 rgb
413 # Cleared out now unused pfkeyv2 switch.
414 # Enabled sysctl.
415 #
416 # Revision 1.26 2000/09/08 19:12:55 rgb
417 # Change references from DEBUG_IPSEC to CONFIG_IPSEC_DEBUG.
418 #
419 # Revision 1.25 2000/06/16 03:09:16 rgb
420 # Shut up cast lost warning due to changes in 2.4.0-test1.
421 #
422 # Revision 1.24 2000/03/16 06:40:48 rgb
423 # Hardcode PF_KEYv2 support.
424 #
425 # Revision 1.23 2000/02/14 21:10:38 rgb
426 # Added gcc debug flag when KLIPS_DEBUG is swtiched on.
427 #
428 # Revision 1.22 2000/01/21 09:44:29 rgb
429 # Added compiler switches to be a lot more fussy.
430 #
431 # Revision 1.21 1999/11/25 23:35:20 rgb
432 # Removed quotes to fix Alpha compile issues.
433 #
434 # Revision 1.20 1999/11/17 15:49:34 rgb
435 # Changed all occurrences of ../../../lib in pathnames to libfreeswan,
436 # which refers to the /usr/src/linux/net/ipsec/lib directory setup by the
437 # klink target in the top-level Makefile; and libdeslite.o to
438 # libdes/libdes.a.
439 # Added SUB_DIRS := lib definition for the kernel libraries.
440 #
441 # Revision 1.19 1999/04/27 19:06:47 rgb
442 # dd libs and dependancies to tags generation.
443 #
444 # Revision 1.18 1999/04/16 16:28:12 rgb
445 # Minor bugfix to avoid including DES if only AH is used.
446 #
447 # Revision 1.17 1999/04/15 15:37:23 rgb
448 # Forward check changes from POST1_00 branch.
449 #
450 # Revision 1.14.2.1 1999/03/30 17:29:17 rgb
451 # Add support for pfkey.
452 #
453 # Revision 1.16 1999/04/11 00:28:56 henry
454 # GPL boilerplate
455 #
456 # Revision 1.15 1999/04/06 04:54:25 rgb
457 # Fix/Add RCSID Id: and Log: bits to make PHMDs happy. This includes
458 # patch shell fixes.
459 #
460 # Revision 1.14 1999/02/18 16:50:45 henry
461 # update for new DES library
462 #
463 # Revision 1.13 1999/02/12 21:11:45 rgb
464 # Prepare for newer LIBDES (patch from P.Onion).
465 #
466 # Revision 1.12 1999/01/26 02:05:08 rgb
467 # Remove references to INET_GET_PROTOCOL.
468 # Removed CONFIG_IPSEC_ALGO_SWITCH macro.
469 # Change from transform switch to algorithm switch.
470 #
471 # Revision 1.11 1999/01/22 06:16:09 rgb
472 # Added algorithm switch code config option.
473 #
474 # Revision 1.10 1998/11/08 05:31:21 henry
475 # be a little fussier
476 #
477 # Revision 1.9 1998/11/08 05:29:41 henry
478 # revisions for new libdes handling
479 #
480 # Revision 1.8 1998/08/12 00:05:48 rgb
481 # Added new xforms to Makefile (moved des-cbc to des-old).
482 #
483 # Revision 1.7 1998/07/27 21:48:47 rgb
484 # Add libkernel.
485 #
486 # Revision 1.6 1998/07/14 15:50:47 rgb
487 # Add dependancies on linux config files.
488 #
489 # Revision 1.5 1998/07/09 17:44:06 rgb
490 # Added 'clean' and 'tags' targets.
491 # Added TOPDIR macro.
492 # Change module back from symbol exporting to not.
493 #
494 # Revision 1.3 1998/06/25 19:25:04 rgb
495 # Rearrange to support static linking and objects with exported symbol
496 # tables.
497 #
498 # Revision 1.1 1998/06/18 21:27:42 henry
499 # move sources from klips/src to klips/net/ipsec, to keep stupid
500 # kernel-build scripts happier in the presence of symlinks
501 #
502 # Revision 1.3 1998/04/15 23:18:43 rgb
503 # Unfixed the ../../libdes fix to avoid messing up Henry's script.
504 #
505 # Revision 1.2 1998/04/14 17:50:47 rgb
506 # Fixed to find the new location of libdes.
507 #
508 # Revision 1.1 1998/04/09 03:05:22 henry
509 # sources moved up from linux/net/ipsec
510 # modifications to centralize libdes code
511 #
512 # Revision 1.1.1.1 1998/04/08 05:35:02 henry
513 # RGB's ipsec-0.8pre2.tar.gz ipsec-0.8
514 #
515 # Revision 0.5 1997/06/03 04:24:48 ji
516 # Added ESP-3DES-MD5-96
517 #
518 # Revision 0.4 1997/01/15 01:32:59 ji
519 # Added new transforms.
520 #
521 # Revision 0.3 1996/11/20 14:22:53 ji
522 # *** empty log message ***
523 #
524 #
525 # Local Variables:
526 # compile-command: "(cd ../../.. && source umlsetup.sh && make -C ${POOLSPACE} module/ipsec.o)"
527 # End Variables:
528 #
529