ifneq ($(KERNELRELEASE),) obj-m := ipt_ipp2p.o else KERNEL_SERIES = $(shell uname -r | cut -d. -f1-2) ifeq ($(KERNEL_SERIES), 2.6) TARGET=ipt_ipp2p.ko else TARGET=ipt_ipp2p.o endif SED = sed IPTABLES = /sbin/iptables IPTABLES_VERSION = \ $(shell iptables --version | sed -e 's/^iptables v//') IPTABLES_OPTION = -DIPTABLES_VERSION=\"$(IPTABLES_VERSION)\" KERNEL_SRC = /lib/modules/$(shell uname -r)/build IUSER = -I/var/abs/system/iptables/src/iptables-1.3.1/include CC = gcc CFLAGS = -O3 -Wall all: modules libipt_ipp2p.so modules: $(TARGET) ipt_ipp2p.o: ipt_ipp2p.h ipt_ipp2p.c $(CC) $(CFLAGS) -I$(KERNEL_SRC)/include -c ipt_ipp2p.c -D__KERNEL__ -DMODULE $(MODVERSIONS) ipt_ipp2p.ko: $(MAKE) -C $(KERNEL_SRC) SUBDIRS=$(PWD) modules libipt_ipp2p.so: libipt_ipp2p.c ipt_ipp2p.h $(CC) $(CFLAGS) $(IPTABLES_OPTION) $(IUSER) -fPIC -c libipt_ipp2p.c ld -shared -o libipt_ipp2p.so libipt_ipp2p.o clean: -rm -f *.o *.so *.ko .*.cmd *.mod.c endif