# Makefile to build the package in openwrt. # goes into package/ipfw2/Makefile # # Edit IPFW_DIR to point to the directory with the sources for ipfw IPFW_DIR := $(TOPDIR)/../ipfw_mod include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=kmod-ipfw2 PKG_RELEASE:=1 # MV is undefined MV ?= mv include $(INCLUDE_DIR)/package.mk # Description for the package. # The names KernelPackage/ipfw2 must match the arguments to the # call $(eval $(call KernelPackage,ipfw2)) used to build it define KernelPackage/ipfw2 SUBMENU:=Other modules TITLE:= IPFW and dummynet # FILES is what makes up the module, both kernel and userland # It must be in the KernelPackage section FILES := $(PKG_BUILD_DIR)/dummynet/ipfw_mod.o $(PKG_BUILD_DIR)/ipfw/ipfw # AUTOLOAD:=$(call AutoLoad,80,ipfw_mod) endef define KernelPackage/ipfw2/description This package contains the ipfw and dummynet module endef # Standard entries for the openwrt builds: Build/Prepare and Build/Compile # Remember that commands must start with a tab # 'prepare' instructions for both kernel and userland # We copy the entire subtree, then build include_e/ which # contains empty headers used by the kernel sources. define Build/Prepare # $(warning Preparing ipfw sources) mkdir -p $(PKG_BUILD_DIR) $(CP) -Rp $(IPFW_DIR)/* $(PKG_BUILD_DIR)/ (cd $(PKG_BUILD_DIR)/dummynet && $(MAKE) include_e ) endef define Build/Compile # compile the kernel part for openwrt $(MAKE) -C "$(LINUX_DIR)" \ CROSS_COMPILE="$(TARGET_CROSS)" \ ARCH="$(LINUX_KARCH)" \ SUBDIRS="$(PKG_BUILD_DIR)/dummynet" \ VER=openwrt modules # compile the userland part for openwrt $(MAKE) -C $(PKG_BUILD_DIR)/ipfw \ $(TARGET_CONFIGURE_OPTS) \ CFLAGS="$(TARGET_CFLAGS) -I./include -include ../glue.h" \ VER=openwrt all endef define Package/ipfw2-userland SECTION:=utils CATEGORY:=Utilities TITLE := /sbin/ipfw DESCRIPTION := This is the control program for ipfw and dummynet endef define Package/ipfw2-userland/install $(INSTALL_DIR) $(1) /sbin endef # XXX not entirely clear why the install entry for userland works, # given that /sbin/ipfw is in KernelPackage/ipfw2 $(eval $(call Package,ipfw2-userland)) $(eval $(call KernelPackage,ipfw2))