]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/ipp2p/Makefile
Load libata prior udev at installer because some SATA doesnt autoload it
[people/pmueller/ipfire-2.x.git] / src / ipp2p / Makefile
CommitLineData
552b817b
MT
1ifneq ($(KERNELRELEASE),)
2obj-m := ipt_ipp2p.o
3
4else
5
6KERNEL_SRC ?= $(firstword $(wildcard /lib/modules/$(shell uname -r)/build /usr/src/linux))
7ifeq ($(KERNEL_SRC),)
8$(error You need to define KERNEL_SRC)
9endif
10
11ifneq ($wildcard $(KERNEL_SRC)/include/linux/modversions.h),)
12MODVERSIONS = -DMODVERSIONS
13endif
14
15_KVER = $(strip $(shell cat $(KERNEL_SRC)/Makefile | grep -e '^VERSION' | cut -d"=" -f2))
16_KPL = $(strip $(shell cat $(KERNEL_SRC)/Makefile | grep -e '^PATCHLEVEL' | cut -d"=" -f2))
17_KSUB = $(strip $(shell cat $(KERNEL_SRC)/Makefile | grep -e '^SUBLEVEL' | cut -d"=" -f2))
18KERNEL_SERIES=$(_KVER).$(_KPL)
19
20ifeq ($(KERNEL_SERIES), 2.6)
21 TARGET=ipt_ipp2p.ko
22else
23 TARGET=ipt_ipp2p.o
24endif
25
26SED = sed
27IPTABLES_BIN = iptables
28
29ifndef $(IPTABLES_SRC)
30IPTVER = \
31 $(shell $(IPTABLES_BIN) --version | $(SED) -e 's/^iptables v//')
32IPTABLES_SRC = $(wildcard /usr/src/iptables-$(IPTVER))
33endif
34
35ifeq ($(IPTABLES_SRC),)
36$(warning You need to install iptables sources and maybe set IPTABLES_SRC)
37endif
38
39IPTABLES_INCLUDE = -I$(IPTABLES_SRC)/include
40
41ifneq ($(IPTVER),)
42 IPTABLES_VERSION = $(IPTVER)
43else
44 IPTABLES_VERSION = $(shell cat $(IPTABLES_SRC)/Makefile | grep -e '^IPTABLES_VERSION:=' | cut -d"=" -f2)
45endif
46
47IPTABLES_OPTION = -DIPTABLES_VERSION=\"$(IPTABLES_VERSION)\"
48
49CC = gcc
50CFLAGS = -O2 -march=i586 -pipe -fomit-frame-pointer
51
52
53
54all: modules libipt_ipp2p.so
55
56modules: $(TARGET)
57
58ipt_ipp2p.o: ipt_ipp2p.h ipt_ipp2p.c
59 $(CC) $(CFLAGS) -I$(KERNEL_SRC)/include -c ipt_ipp2p.c -D__KERNEL__ -DMODULE $(MODVERSIONS)
60
61ipt_ipp2p.ko: ipt_ipp2p.h ipt_ipp2p.c
62 $(MAKE) -C $(KERNEL_SRC) SUBDIRS=$(PWD) modules
63
64
65libipt_ipp2p.so: libipt_ipp2p.c ipt_ipp2p.h
66 $(CC) $(CFLAGS) $(IPTABLES_OPTION) $(IPTABLES_INCLUDE) -fPIC -c libipt_ipp2p.c
67 ld -shared -o libipt_ipp2p.so libipt_ipp2p.o
68
69clean:
70 -rm -f *.o *.so *.ko .*.cmd *.mod.c
71endif