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>
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>.
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
15
# RCSID $Id: Makefile,v 1.65 2004/02/09 16:22:07 paul Exp $
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).
22
ifeq ($(strip $(KLIPSMODULE)),)
25
FREESWANSRCDIR=../../..
27
-include ${FREESWANSRCDIR}/Makefile.ver
29
ifeq ($(strip $(KLIPS_TOP)),)
33
ifneq ($(strip $(KLIPSMODULE)),)
36
TOPDIR:=/usr/src/linux
43
# This magic from User-Mode-Linux list. It gets list of -I options, as
44
# UML needs some extra, that varry by revision.
46
KERNEL_CFLAGS= $(shell $(MAKE) -C $(TOPDIR) --no-print-directory -s -f Makefile ARCH=$(ARCH) MAKEFLAGS= script SCRIPT='@echo $$(CFLAGS)' )
48
MODULE_CFLAGS= $(shell $(MAKE) -C $(TOPDIR) --no-print-directory -s -f Makefile ARCH=$(ARCH) MAKEFLAGS= script SCRIPT='@echo $$(MODFLAGS)' )
56
MOD_DESTDIR:=net/ipsec
63
echo KERNEL: ${KERNEL_CFLAGS}
64
echo MODULE: ${MODULE_CFLAGS}
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 ipsec_ipip.o
72
obj-y += sysctl_net_ipsec.o
73
obj-y += pfkey_v2.o pfkey_v2_parser.o pfkey_v2_ext_process.o
75
obj-$(CONFIG_IPSEC_AH) += ipsec_ah.o
76
obj-$(CONFIG_IPSEC_ESP) += ipsec_esp.o
77
obj-$(CONFIG_IPSEC_IPCOMP)+= ipsec_ipcomp.o
79
LIBDESDIR=${KLIPS_TOP}/crypto/ciphers/des
82
include ${LIBDESDIR}/Makefile.objs
84
LIBFREESWANDIR=${KLIPS_TOP}/lib/libfreeswan
85
VPATH+=${LIBFREESWANDIR}
87
include ${LIBFREESWANDIR}/Makefile.objs
90
obj-$(CONFIG_IPSEC_IPCOMP) += ipcomp.o
92
LIBZLIBSRCDIR=${KLIPS_TOP}/lib/zlib
93
VPATH+=${LIBZLIBSRCDIR}
95
include ${LIBZLIBSRCDIR}/Makefile.objs
97
export-objs := radij.o
101
# include file with .h-style macros that would otherwise be created by
102
# config. Must occur before other includes.
103
ifneq ($(strip $(MODULE_DEF_INCLUDE)),)
104
EXTRA_CFLAGS += -include ${MODULE_DEF_INCLUDE}
107
# 'override CFLAGS' should really be 'EXTRA_CFLAGS'
108
#EXTRA_CFLAGS += -nostdinc
109
EXTRA_CFLAGS += -I${KLIPS_TOP}/include
111
EXTRA_CFLAGS += -I${TOPDIR}/include
112
EXTRA_CFLAGS += -I${LIBZLIBSRCDIR}
114
ifeq ($(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION),2.4.2-2)
115
EXTRA_CFLAGS += -DREDHAT_BOGOSITY
118
ifeq ($(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION),2.4.3-12)
119
EXTRA_CFLAGS += -DREDHAT_BOGOSITY
122
#ifeq ($(CONFIG_IPSEC_DEBUG),y)
126
# MOST of these flags are in KERNEL_CFLAGS already!
128
EXTRA_CFLAGS += $(KLIPSCOMPILE)
129
EXTRA_CFLAGS += -Wall
130
#EXTRA_CFLAGS += -Werror
131
#EXTRA_CFLAGS += -Wconversion
132
#EXTRA_CFLAGS += -Wmissing-prototypes
133
# cannot use both -Wpointer-arith and -Werror with CONFIG_HIGHMEM
134
# include/linux/highmem.h has an inline function definition that uses void* arithmentic.
135
ifeq ($(CONFIG_NOHIGHMEM),y)
136
EXTRA_CFLAGS += -Wpointer-arith
138
#EXTRA_CFLAGS += -Wcast-qual
139
#EXTRA_CFLAGS += -Wmissing-declarations
140
#EXTRA_CFLAGS += -Wstrict-prototypes
141
#EXTRA_CFLAGS += -pedantic
144
#EXTRA_CFLAGS += -Wwrite-strings
145
#EXTRA_CFLAGS += -Wbad-function-cast
147
ifneq ($(strip $(KLIPSMODULE)),)
148
# for when we aren't building in the kernel tree
149
EXTRA_CFLAGS += -DARCH=${ARCH}
150
EXTRA_CFLAGS += -DMODVERSIONS
151
EXTRA_CFLAGS += -include ${TOPDIR}/include/linux/modversions.h
152
EXTRA_CFLAGS += ${MODULE_CFLAGS}
155
EXTRA_CFLAGS += ${KERNEL_CFLAGS}
157
#EXTRA_CFLAGS += -DRJ_DEBUG -DRJ_DEBUG2
160
# GCC 3.2 (and we presume any other 3.x) wants -falign-functions
161
# in place of the traditional -malign-functions. Getting this
162
# wrong leads to a warning, which is fatal due to our use of -Werror.
163
ifeq ($(patsubst 3.%,3,$(shell $(CC) -dumpversion)),3)
164
override CFLAGS:=$(subst -malign-functions=,-falign-functions=,$(CFLAGS))
168
obj-$(CONFIG_IPSEC_AUTH_HMAC_MD5) += ipsec_md5c.o
169
obj-$(CONFIG_IPSEC_AUTH_HMAC_SHA1) += ipsec_sha1.o
171
# These rules translate from new to old makefile rules
172
# Translate to Rules.make lists.
173
multi-used := $(filter $(list-multi), $(obj-y) $(obj-m))
174
multi-objs := $(foreach m, $(multi-used), $($(basename $(m))-objs))
175
active-objs := $(sort $(multi-objs) $(obj-y) $(obj-m))
178
MIX_OBJS := $(filter $(export-objs), $(active-objs))
179
#OX_OBJS := $(export-objs)
180
SUB_DIRS := $(subdir-y)
181
ALL_SUB_DIRS := $(subdir-y) $(subdir-m)
182
MOD_SUB_DIRS := $(subdir-m)
184
include $(TOPDIR)/Rules.make
186
$(obj-y) $(obj-m): $(TOPDIR)/include/linux/config.h $(TOPDIR)/include/linux/autoconf.h
188
USE_STANDARD_AS_RULE=true
195
tags TAGS: *.c *.h libfreeswan/*.c libfreeswan/*.h
196
etags *.c ../../include/*.h ../../include/freeswan/*.h
197
ctags *.c ../../include/*.h ../../include/freeswan/*.h
204
# Revision 1.65 2004/02/09 16:22:07 paul
205
# Added -f to rm version.c in clean target to prevent bogus error
207
# Revision 1.64 2003/12/22 19:40:57 mcr
208
# NAT-T patches 0.6c.
210
# Revision 1.63 2003/12/13 19:10:21 mcr
211
# refactored rcv and xmit code - same as FS 2.05.
213
# Revision 1.62 2003/10/31 02:27:55 mcr
214
# pulled up port-selector patches and sa_id elimination.
216
# Revision 1.61.4.1 2003/10/29 01:30:41 mcr
217
# elimited "struct sa_id".
219
# Revision 1.61 2003/06/22 21:07:46 mcr
220
# adjusted TAGS target in makefile to be useful in 2.00 source layout.
222
# Revision 1.60 2003/05/03 23:45:23 mcr
223
# rm .o.flags and generated version.c file.
225
# Revision 1.59 2003/02/12 19:32:47 rgb
226
# Added ipsec_xmit to the list of object files.
228
# Revision 1.58 2003/01/03 00:36:44 rgb
230
# Added emacs compile-command.
232
# Revision 1.57 2002/11/08 23:49:53 mcr
233
# use KERNEL_CFLAGS and MODULE_CFLAGS to get proper list
234
# of include directories.
235
# This also eliminates some of the guesswork in the kernel
236
# configuration file.
238
# Revision 1.56 2002/11/08 23:23:18 mcr
239
# attempt to guess kernel compilation flags (i.e. list of -I)
240
# by using some magic targets in the kernel makefile.
242
# Revision 1.55 2002/11/08 10:13:33 mcr
243
# added additional include directories for module builds for 2.4.19.
245
# Revision 1.54 2002/10/20 06:10:30 build
246
# CONFIG_NOHIGHMEM for -Wpointer-arith RPM building issues.
248
# Revision 1.53 2002/10/17 16:32:01 mcr
249
# enable standard AS rules.
251
# Revision 1.52 2002/10/06 06:13:44 sam
252
# Altering order of includes, so that architecture-specific header files,
253
# used for building RPM modules specifically, are processed first.
255
# Revision 1.51 2002/10/05 15:06:38 dhr
257
# - To allow for gcc3.2 (used in Red Hat Linux 8.0): adjust CFLAGS (set
258
# by kernel machinery) to use -falign-functions= in place of
259
# -malign-functions=. Eliminates a warning (fatal with -Werror).
261
# - When CONFIG_HIGHMEM is on, -Wpointer-arith will warn about
262
# include/linux/highmem.h. Since this is fatal with -Werror, we
263
# suppress -Wpointer-arith if CONFIG_HIGHMEM is set.
265
# Revision 1.50 2002/09/16 21:19:45 mcr
266
# enable -Werror for production - this helps a lot (found a bug in ipsec_rcv.c)
268
# Revision 1.49 2002/07/29 05:12:39 mcr
269
# get rid of some extraneous stuff, now handled by a prefix
270
# Makefile when building as a module.
272
# Revision 1.48 2002/07/28 23:13:49 mcr
273
# set KLIPS_TOP and use it instead of ../..
274
# if KLIPSMODULE, then include a bunch of stuff defined in Makefile.inc
275
# that gets us the "typical" configuration that we want.
277
# Revision 1.47 2002/06/02 21:51:41 mcr
278
# changed TOPDIR->FREESWANSRCDIR in all Makefiles.
279
# (note that linux/net/ipsec/Makefile uses TOPDIR because this is the
282
# Revision 1.46 2002/05/14 02:35:51 rgb
283
# Added file pfkey_v2_ext_process.c.
285
# Revision 1.45 2002/05/13 17:21:40 mcr
286
# mkdep dies when given a -I to a directory that does not exist.
287
# arch/${ARCH}/include is for UM arch only, so include it for that
290
# Revision 1.44 2002/04/24 20:38:12 mcr
291
# moved more stuff behind $KLIPSMODULE=y to get static linking to work.
293
# Revision 1.43 2002/04/24 09:16:18 mcr
294
# include local Makefile.ver as well as FS_rootdir version.
296
# Revision 1.42 2002/04/24 08:50:08 mcr
297
# critical patch is to set TOPDIR with :=.
299
# Revision 1.40 2002/04/24 00:41:07 mcr
300
# Moved from ./klips/net/ipsec/Makefile,v
302
# Revision 1.39 2002/01/17 04:39:40 rgb
303
# Take compile options from top level Makefile.inc
305
# Revision 1.38 2001/11/27 05:28:07 rgb
306
# Shut off -Werror until we figure out a graceful way of quieting down the
307
# pfkey_ops defined but not used complaint in the case of SMP in
310
# Revision 1.37 2001/11/27 05:10:15 rgb
311
# Added -Ilibdes and removed lib/des* symlinks.
313
# Revision 1.36 2001/11/26 09:23:47 rgb
314
# Merge MCR's ipsec_sa, eroute, proc and struct lifetime changes.
316
# Revision 1.35.2.1 2001/09/25 02:17:50 mcr
317
# added ipsec_sa, ipsec_life, ipsec_proc.
318
# added -Werror to compile flags (see fix for zlib/zutil.h)
320
# Revision 1.3 2001/09/21 04:41:26 mcr
321
# actually, ipsec_proc.c and ipsec_life.c were never actually compiled.
323
# Revision 1.2 2001/09/21 04:11:33 mcr
324
# first compilable version.
326
# Revision 1.1.1.2 2001/09/17 01:17:52 mcr
327
# snapshot 2001-09-16
329
# Revision 1.35 2001/09/07 22:09:12 rgb
330
# Quiet down compilation.
332
# Revision 1.34 2001/08/11 17:10:23 henry
333
# update bogosity stuff to cover RH7.1 update
335
# Revision 1.33 2001/06/14 19:35:07 rgb
336
# Update copyright date.
338
# Revision 1.32 2001/06/13 21:00:50 rgb
339
# Added a kludge to get around RedHat kernel version bogosity...
341
# Revision 1.31 2001/01/29 22:19:06 rgb
342
# Convert to 2.4 new style with back compat.
344
# Revision 1.30 2000/09/29 19:51:57 rgb
345
# Moved klips/net/ipsec/ipcomp_* to zlib/* (Svenning).
347
# Revision 1.29 2000/09/15 11:37:01 rgb
348
# Merge in heavily modified Svenning Soerensen's <svenning@post5.tele.dk>
349
# IPCOMP zlib deflate code.
351
# Revision 1.28 2000/09/15 04:55:25 rgb
352
# Clean up pfkey object inclusion into the default object.
354
# Revision 1.27 2000/09/12 03:20:47 rgb
355
# Cleared out now unused pfkeyv2 switch.
358
# Revision 1.26 2000/09/08 19:12:55 rgb
359
# Change references from DEBUG_IPSEC to CONFIG_IPSEC_DEBUG.
361
# Revision 1.25 2000/06/16 03:09:16 rgb
362
# Shut up cast lost warning due to changes in 2.4.0-test1.
364
# Revision 1.24 2000/03/16 06:40:48 rgb
365
# Hardcode PF_KEYv2 support.
367
# Revision 1.23 2000/02/14 21:10:38 rgb
368
# Added gcc debug flag when KLIPS_DEBUG is swtiched on.
370
# Revision 1.22 2000/01/21 09:44:29 rgb
371
# Added compiler switches to be a lot more fussy.
373
# Revision 1.21 1999/11/25 23:35:20 rgb
374
# Removed quotes to fix Alpha compile issues.
376
# Revision 1.20 1999/11/17 15:49:34 rgb
377
# Changed all occurrences of ../../../lib in pathnames to libfreeswan,
378
# which refers to the /usr/src/linux/net/ipsec/lib directory setup by the
379
# klink target in the top-level Makefile; and libdeslite.o to
381
# Added SUB_DIRS := lib definition for the kernel libraries.
383
# Revision 1.19 1999/04/27 19:06:47 rgb
384
# dd libs and dependancies to tags generation.
386
# Revision 1.18 1999/04/16 16:28:12 rgb
387
# Minor bugfix to avoid including DES if only AH is used.
389
# Revision 1.17 1999/04/15 15:37:23 rgb
390
# Forward check changes from POST1_00 branch.
392
# Revision 1.14.2.1 1999/03/30 17:29:17 rgb
393
# Add support for pfkey.
395
# Revision 1.16 1999/04/11 00:28:56 henry
398
# Revision 1.15 1999/04/06 04:54:25 rgb
399
# Fix/Add RCSID Id: and Log: bits to make PHMDs happy. This includes
402
# Revision 1.14 1999/02/18 16:50:45 henry
403
# update for new DES library
405
# Revision 1.13 1999/02/12 21:11:45 rgb
406
# Prepare for newer LIBDES (patch from P.Onion).
408
# Revision 1.12 1999/01/26 02:05:08 rgb
409
# Remove references to INET_GET_PROTOCOL.
410
# Removed CONFIG_IPSEC_ALGO_SWITCH macro.
411
# Change from transform switch to algorithm switch.
413
# Revision 1.11 1999/01/22 06:16:09 rgb
414
# Added algorithm switch code config option.
416
# Revision 1.10 1998/11/08 05:31:21 henry
417
# be a little fussier
419
# Revision 1.9 1998/11/08 05:29:41 henry
420
# revisions for new libdes handling
422
# Revision 1.8 1998/08/12 00:05:48 rgb
423
# Added new xforms to Makefile (moved des-cbc to des-old).
425
# Revision 1.7 1998/07/27 21:48:47 rgb
428
# Revision 1.6 1998/07/14 15:50:47 rgb
429
# Add dependancies on linux config files.
431
# Revision 1.5 1998/07/09 17:44:06 rgb
432
# Added 'clean' and 'tags' targets.
433
# Added TOPDIR macro.
434
# Change module back from symbol exporting to not.
436
# Revision 1.3 1998/06/25 19:25:04 rgb
437
# Rearrange to support static linking and objects with exported symbol
440
# Revision 1.1 1998/06/18 21:27:42 henry
441
# move sources from klips/src to klips/net/ipsec, to keep stupid
442
# kernel-build scripts happier in the presence of symlinks
444
# Revision 1.3 1998/04/15 23:18:43 rgb
445
# Unfixed the ../../libdes fix to avoid messing up Henry's script.
447
# Revision 1.2 1998/04/14 17:50:47 rgb
448
# Fixed to find the new location of libdes.
450
# Revision 1.1 1998/04/09 03:05:22 henry
451
# sources moved up from linux/net/ipsec
452
# modifications to centralize libdes code
454
# Revision 1.1.1.1 1998/04/08 05:35:02 henry
455
# RGB's ipsec-0.8pre2.tar.gz ipsec-0.8
457
# Revision 0.5 1997/06/03 04:24:48 ji
458
# Added ESP-3DES-MD5-96
460
# Revision 0.4 1997/01/15 01:32:59 ji
461
# Added new transforms.
463
# Revision 0.3 1996/11/20 14:22:53 ji
464
# *** empty log message ***
468
# compile-command: "(cd ../../.. && source umlsetup.sh && make -C ${POOLSPACE} module/ipsec.o)"