Sync with the new ipfw3 version.
[ipfw.git] / Makefile.openwrt
1 # Makefile to build the package in openwrt.
2 # goes into package/ipfw3/Makefile
3 #
4 # Edit IPFW_DIR to point to the directory with the sources for ipfw
5
6 IPFW_DIR := $(TOPDIR)/../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 # Description for the package.
20 # The names KernelPackage/ipfw3 must match the arguments to the
21 # call $(eval $(call KernelPackage,ipfw3)) used to build it
22
23
24 define KernelPackage/ipfw3
25  SUBMENU:=Other modules
26  TITLE:= IPFW and dummynet
27  # FILES is what makes up the module, both kernel and userland
28  # It must be in the KernelPackage section
29  FILES := $(PKG_BUILD_DIR)/dummynet2/ipfw_mod.o $(PKG_BUILD_DIR)/ipfw/ipfw
30  # AUTOLOAD:=$(call AutoLoad,80,ipfw_mod)
31 endef
32
33 define KernelPackage/ipfw3/description
34  This package contains the ipfw and dummynet module
35 endef
36
37 # Standard entries for the openwrt builds: Build/Prepare and Build/Compile
38 # Remember that commands must start with a tab
39
40 # 'prepare' instructions for both kernel and userland
41 # We copy the entire subtree, then build include_e/ which
42 # contains empty headers used by the kernel sources.
43 define Build/Prepare
44   # $(warning Preparing ipfw sources)
45         mkdir -p $(PKG_BUILD_DIR)
46         $(CP) -Rp $(IPFW_DIR)/* $(PKG_BUILD_DIR)/
47         (cd $(PKG_BUILD_DIR)/ipfw && $(MAKE) include_e )
48         (cd $(PKG_BUILD_DIR)/dummynet2 && $(MAKE) include_e )
49 endef
50
51 define Build/Compile
52         # compile the kernel part for openwrt
53         $(MAKE) -C "$(LINUX_DIR)" \
54                 CROSS_COMPILE="$(TARGET_CROSS)" \
55                 ARCH="$(LINUX_KARCH)" \
56                 SUBDIRS="$(PKG_BUILD_DIR)/dummynet2" \
57                 VER=openwrt modules
58         # compile the userland part for openwrt
59         $(MAKE) -C $(PKG_BUILD_DIR)/ipfw \
60                 $(TARGET_CONFIGURE_OPTS) \
61                 CFLAGS="$(TARGET_CFLAGS) -DSYSCTL_NODE -DEMULATE_SYSCTL -I./include_e -I./include -include ../glue.h -DNO_ALTQ" \
62                 VER=openwrt all
63 endef
64
65 define Package/ipfw3-userland
66   SECTION:=utils
67   CATEGORY:=Utilities
68   TITLE := /sbin/ipfw
69   DESCRIPTION := This is the control program for ipfw and dummynet
70 endef
71
72 define Package/ipfw3-userland/install
73         $(INSTALL_DIR) $(1) /sbin
74 endef
75
76 # XXX not entirely clear why the install entry for userland works,
77 # given that /sbin/ipfw is in KernelPackage/ipfw3
78
79 $(eval $(call Package,ipfw3-userland))
80 $(eval $(call KernelPackage,ipfw3))