#
# Makefile
#
# ----------------------------------------------------------------------
# sf Firewall Software -- a TCP/IP packet filter for Linux
# Copyright (C) 1996 Robert Muchsel and Roland Schmid
#
# 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.
#
# 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# Please address all correspondence concerning the software to 
# firewall-bugs@switch.ch.
# ----------------------------------------------------------------------
#
# $Id: Makefile,v 1.14 1995/08/05 14:20:59 robby Rel $
#


# Include site dependent options and kernel configuration
include make.options
include ${LINUX}/.config

ifndef CFLAGS
CFLAGS = -O2 -fomit-frame-pointer -Wall -Wstrict-prototypes -pipe
endif

COFLAGS = -kv
CPPFLAGS = $(DEBUG) -D__KERNEL__ -DMODULE -I$(LINUX)/include -I$(LINUX)

SRCS = \
	sf_device.c sf_filter.c sf_config.c sf_daemon.c sf_spy.c sfc.c y.tab.c lex.yy.c sf_proto.c sfident.c

MODULES = \
	sf.o

PROGRAMS = \
	sfc sfident

all: $(MODULES) $(PROGRAMS)

sf.o: sf_device.o sf_filter.o
	ld -r -o sf.o sf_device.o sf_filter.o

sfident: sfident.c
	$(CC) $(CFLAGS) -o sfident sfident.c

sf_filter.o: sf_filter.c
	$(CC) -c $(CFLAGS) $(CPPFLAGS) -o sf_filter.o sf_filter.c
#$(CC) -c $(CFLAGS) $(CPPFLAGS) -DSF_DEBUG -o sf_filter.o sf_filter.c

sfc: y.tab.o sf_config.o sf_daemon.o sf_spy.o sfc.o sf_proto.o
	$(CC) $(CFLAGS) -o sfc y.tab.o sf_config.o sf_daemon.o sf_spy.o sfc.o sf_proto.o

sf_daemon.o: sf_daemon.c
	$(CC) -c $(CFLAGS) -o sf_daemon.o sf_daemon.c

sf_spy.o: sf_spy.c
	$(CC) -c $(CFLAGS) -o sf_spy.o sf_spy.c

sfc.o: sfc.c   
	$(CC) -c $(CFLAGS) -o sfc.o sfc.c

sf_proto.o: sf_proto.c
	$(CC) -c $(CFLAGS) -o sf_proto.o sf_proto.c

sf_config.o: sf_config.c
	$(CC) -c $(CFLAGS) -o sf_config.o sf_config.c

y.tab.o: y.tab.c sf_global.h sf_config.h
	$(CC) -c $(CFLAGS) -w -o y.tab.o y.tab.c

y.tab.c: config.y lex.yy.c
	yacc config.y

lex.yy.c: config.l
	lex config.l

dep:	$(SRCS)
	$(CPP) -M $(CPPFLAGS) $(SRCS) > .depend

clean:
	rm -f core core.* *.o *.a tmp_make *~
	for i in *.c;do rm -f `basename $$i .c`.s;done
	rm -f sfc
	rm -f y.tab.c lex.yy.c

ifeq (.depend,$(wildcard .depend))
include .depend
endif

