# Makefile for KLIPS kernel code
# Copyright (C) 1998, 1999  Richard Guy Briggs.
# 
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
# 
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
#
# RCSID $Id: Makefile,v 1.7 2002/08/23 15:23:38 kai Exp $
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
#
# Note 2! The CFLAGS definition is now in the main makefile...

ifndef TOPDIR
TOPDIR  := /usr/src/linux
endif

O_TARGET := ipsec.o

export_objs := ipsec_tunnel.o

obj-y := ipsec_init.o ipsec_xform.o ipsec_radij.o ipsec_tunnel.o ipsec_rcv.o \
	 radij.o libfreeswan/libkernel.a

subdir-$(CONFIG_IPSEC)		+= libfreeswan

obj-y += pfkey_v2.o pfkey_v2_parser.o 

ifeq ($(CONFIG_IPSEC),m)
  obj-m := $(O_TARGET)
endif

override CFLAGS += -Ilibfreeswan

ifeq ($(CONFIG_IPSEC_DEBUG),y)
override CFLAGS += -g
obj-y += ipsec_netlink.o
endif

#override CFLAGS += -DCONFIG_DEBUG_CRYPT
override CFLAGS += -Wall 
#override CFLAGS += -Wconversion 
#override CFLAGS += -Wmissing-prototypes 
override CFLAGS += -Wpointer-arith 
#override CFLAGS += -Wcast-qual 
#override CFLAGS += -Wmissing-declarations 
override CFLAGS += -Wstrict-prototypes
#override CFLAGS += -pedantic
#override CFLAGS += -O3
#override CFLAGS += -W
#override CFLAGS += -Wwrite-strings 
#override CFLAGS += -Wbad-function-cast 

ifeq ($(CONFIG_IPSECTHREAD),y)
obj-y += ipsec_threads/ipsec_threads.o
subdir-$(CONFIG_IPSEC) += ipsec_threads
endif

include $(TOPDIR)/Rules.make

#$(obj-y):  $(TOPDIR)/include/linux/config.h $(TOPDIR)/include/linux/autoconf.h


libfreeswan/libkernel.a:
	$(MAKE) -C libfreeswan

ipsec_threads/ipsec_threads.o:
	$(MAKE) -C ipsec_threads

clean:
	-rm -f *.o

tags TAGS: *.c *.h libfreeswan/*.c libfreeswan/*.h
	find . -name '*.[ch]' |xargs etags
	find . -name '*.[ch]' |xargs ctags

tar:
		tar -cvf /dev/f1 .

