remove duplicate entry
[ipfw-google.git] / Makefile.openwrt
1 # Makefile to build the package in openwrt.
2 # goes into package/network/utils/ipfw3/Makefile
3 #
4 # Edit IPFW_DIR to point to the directory with the sources for ipfw
5
6 IPFW_DIR := $(TOPDIR)/../qemu-misc/ipfw3
7
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=kmod-ipfw3
12 PKG_RELEASE:=1
13
14 # MV is undefined
15 MV ?= mv
16
17 include $(INCLUDE_DIR)/package.mk
18
19 #Stuff depending on kernel version
20 $(warning --- openwrt kernel version $(KERNEL) linux dir $(LINUX_DIR) -------)
21
22 ifeq ($(KERNEL),2.4)
23     VERS:=openwrt
24     CFLAGS_WRT:=-DSYSCTL_NODE -DEMULATE_SYSCTL
25     IPFW_MOD:=ipfw_mod.o
26     IPFW_SRC_DIR:=SUBDIRS
27 else
28     #VERS:=2.6
29     IPFW_MOD:=ipfw_mod.ko
30     IPFW_SRC_DIR:=M
31 endif
32
33 # Description for the package.
34 # The names KernelPackage/ipfw3 must match the arguments to the
35 # call $(eval $(call KernelPackage,ipfw3)) used to build it
36
37 define KernelPackage/ipfw3
38  SUBMENU:=Other modules
39  TITLE:= IPFW and dummynet
40  # FILES is what makes up the module, both kernel and userland
41  # It must be in the KernelPackage section
42  FILES := $(PKG_BUILD_DIR)/kipfw-mod/$(IPFW_MOD) $(PKG_BUILD_DIR)/ipfw/ipfw
43  # AUTOLOAD:=$(call AutoLoad,80,ipfw_mod)
44 endef
45
46 define KernelPackage/ipfw3/description
47  This package contains the ipfw and dummynet module
48 endef
49
50 # Standard entries for the openwrt builds: Build/Prepare and Build/Compile
51 # Remember that commands must start with a tab
52
53 # 'prepare' instructions for both kernel and userland
54 # We copy the entire subtree, then build include_e/ which
55 # contains empty headers used by the kernel sources.
56 define Build/Prepare
57   # $(warning Preparing ipfw sources)
58         mkdir -p $(PKG_BUILD_DIR)
59         $(CP) -Rp $(IPFW_DIR)/* $(PKG_BUILD_DIR)/
60         # The kernel sources are spread in multiple places,
61         # so we put everything in kipfw-mod
62         mkdir -p $(PKG_BUILD_DIR)/kipfw-mod
63         cp -Rp $(IPFW_DIR)/kipfw/* $(PKG_BUILD_DIR)/kipfw-mod
64         cp `find $(IPFW_DIR)/sys -name \*.c` $(PKG_BUILD_DIR)/kipfw-mod
65         # we do not need cross parameters
66         (cd $(PKG_BUILD_DIR)/ipfw && $(MAKE) include_e )
67         (cd $(PKG_BUILD_DIR)/kipfw-mod && $(MAKE) include_e )
68 endef
69
70 define Build/Compile
71         # XXX check whether we need all linux_dir etc.
72         $(MAKE) -C $(PKG_BUILD_DIR)/ipfw \
73                 LINUX_DIR=$(LINUX_DIR) \
74                 $(TARGET_CONFIGURE_OPTS) \
75                 CFLAGS="$(TARGET_CFLAGS) $(CFLAGS_WRT) -I./include_e -I./include -include ../glue.h -DNO_ALTQ -D__BSD_VISIBLE" \
76                 _VER=$(VERS) all
77         $(warning  compile the kernel part for ipfw/openwrt)
78         # compile the kernel part for openwrt
79         $(MAKE) -C "$(LINUX_DIR)" \
80                 CROSS_COMPILE="$(TARGET_CROSS)" \
81                 LINUX_DIR=$(LINUX_DIR) \
82                 KERNELPATH=$(LINUX_DIR) \
83                 ARCH="$(LINUX_KARCH)" \
84                 $(IPFW_SRC_DIR)="$(PKG_BUILD_DIR)/kipfw-mod" \
85                 IPFW3_ROOT="$(PKG_BUILD_DIR)" \
86                 _VER=$(VERS) modules
87 endef
88
89 define Build/Compile_new
90         $(call Build/Compile/Default)
91         $(call Build/Compile/Default,modules)
92 endef
93
94 define Package/ipfw3-userland
95   SECTION:=utils
96   CATEGORY:=Utilities
97   TITLE := /sbin/ipfw
98   DESCRIPTION := This is the control program for ipfw and dummynet
99   DEPENDS := +libc +libgcc
100 endef
101
102 define Package/ipfw3-userland/install
103         $(INSTALL_DIR) $(1) /sbin
104 endef
105
106 # XXX not entirely clear why the install entry for userland works,
107 # given that /sbin/ipfw is in KernelPackage/ipfw3
108
109 $(eval $(call Package,ipfw3-userland))
110 $(eval $(call KernelPackage,ipfw3))