Added the new version for dummynet.
[ipfw.git] / Makefile.openwrt
1 # Makefile to build the package in openwrt.
2 # goes into package/ipfw2/Makefile
3 #
4 # Edit IPFW_DIR to point to the directory with the sources for ipfw
5
6 IPFW_DIR := $(TOPDIR)/../ipfw_mod
7
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=kmod-ipfw2
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/ipfw2 must match the arguments to the
21 # call $(eval $(call KernelPackage,ipfw2)) used to build it
22
23
24 define KernelPackage/ipfw2
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)/dummynet/ipfw_mod.o $(PKG_BUILD_DIR)/ipfw/ipfw
30  # AUTOLOAD:=$(call AutoLoad,80,ipfw_mod)
31 endef
32
33 define KernelPackage/ipfw2/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)/dummynet && $(MAKE) include_e )
49         (cd $(PKG_BUILD_DIR)/dummynet2 && $(MAKE) include_e )
50 endef
51
52 define Build/Compile
53         # compile the kernel part for openwrt
54         $(MAKE) -C "$(LINUX_DIR)" \
55                 CROSS_COMPILE="$(TARGET_CROSS)" \
56                 ARCH="$(LINUX_KARCH)" \
57                 SUBDIRS="$(PKG_BUILD_DIR)/dummynet" \
58                 VER=openwrt modules
59         $(MAKE) -C "$(LINUX_DIR)" \
60                 CROSS_COMPILE="$(TARGET_CROSS)" \
61                 ARCH="$(LINUX_KARCH)" \
62                 SUBDIRS="$(PKG_BUILD_DIR)/dummynet2" \
63                 VER=openwrt modules
64         # compile the userland part for openwrt
65         $(MAKE) -C $(PKG_BUILD_DIR)/ipfw \
66                 $(TARGET_CONFIGURE_OPTS) \
67                 CFLAGS="$(TARGET_CFLAGS) -I./include_e -I./include -include ../glue.h" \
68                 VER=openwrt all
69 endef
70
71 define Package/ipfw2-userland
72   SECTION:=utils
73   CATEGORY:=Utilities
74   TITLE := /sbin/ipfw
75   DESCRIPTION := This is the control program for ipfw and dummynet
76 endef
77
78 define Package/ipfw2-userland/install
79         $(INSTALL_DIR) $(1) /sbin
80 endef
81
82 # XXX not entirely clear why the install entry for userland works,
83 # given that /sbin/ipfw is in KernelPackage/ipfw2
84
85 $(eval $(call Package,ipfw2-userland))
86 $(eval $(call KernelPackage,ipfw2))