# Makefile for lib
#
# $Id: Makefile,v 3.0 1999/12/17 11:37:22 kaf24 Exp kaf24 $
#

include Rules.mk

OBJECTS = ipv4/af_inet.o ipv4/protocol.o ipv4/ip_fragment.o ipv4/ip_input.o \
	  ipv4/ip_options.o ipv4/ip_output.o ipv4/ip_sockglue.o ipv4/udp.o \
	  ipv4/tcp.o ipv4/tcp_input.o ipv4/tcp_output.o ipv4/tcp_ipv4.o \
          ipv4/tcp_timer.o ipv4/fake-linux.o tcp_signals.o\
          socketcall.o hash.o skbuff.o trace.o lowlevel.o profile.o

SRCS = $(patsubst %.o,%.c,$(OBJECTS))

# This is a bit ugly, but it's convenient to have a single place where 
# tracing levels are defined for all source files. Format of each entry here
# is <file base>.<trace level>
# Trace levels: 0 = none; 1 = assert; 2 = error; 3 = warn; 4 = all
TRC = socketcall.3 hash.3 trace.3 lowlevel.3 tcp_signals.3 skbuff.3

all: libusernet.a
	cd test; $(MAKE) all

libusernet.a: libusernet.a( $(OBJECTS) ipv4/fake-checksum.o)

clean:
	cd test; $(MAKE) clean; cd ..;
	rm -f ipv4/*.o ipv4/*~ *.o *.a *~ sta* core

# Even more ugly -- we have to go round the houses to extract the correct
# trace-level digit from the TRC variable :-(
%.o : %.c
	$(CC) $(CFLAGS) -c $< -o $@ \
        -DTRACE_LEVEL=$(patsubst .%,%,$(suffix $(filter $(<:.c=)%,$(TRC))))

depend:
	cd test; $(MAKE) depend; cd ..;
	makedepend $(PROF) $(DEBUG) $(INCLUDES) $(SRCS)

# DO NOT DELETE THIS LINE -- make depend depends on it.
