diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/host-build.mk | 123 | ||||
-rw-r--r-- | include/host.mk | 31 | ||||
-rw-r--r-- | include/image.mk | 96 | ||||
-rw-r--r-- | include/kernel-build.mk | 145 | ||||
-rw-r--r-- | include/kernel.mk | 106 | ||||
-rw-r--r-- | include/modules-2.4.mk | 196 | ||||
-rw-r--r-- | include/modules-2.6.mk | 233 | ||||
-rw-r--r-- | include/netfilter.mk | 122 | ||||
-rw-r--r-- | include/package.mk | 372 | ||||
-rw-r--r-- | include/prereq-build.mk | 105 | ||||
-rw-r--r-- | include/prereq.mk | 54 | ||||
-rw-r--r-- | include/shell.sh | 15 | ||||
-rw-r--r-- | include/target.mk | 31 | ||||
-rw-r--r-- | include/verbose.mk | 43 |
14 files changed, 1672 insertions, 0 deletions
diff --git a/include/host-build.mk b/include/host-build.mk new file mode 100644 index 0000000..a1287da --- /dev/null +++ b/include/host-build.mk @@ -0,0 +1,123 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(INCLUDE_DIR)/host.mk + +ifneq ($(strip $(PKG_CAT)),) + ifeq ($(PKG_CAT),unzip) + UNPACK=unzip -d $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_SOURCE) + else + UNPACK=$(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(PKG_BUILD_DIR)/.. $(TAR_OPTIONS) - + endif + define Build/Prepare/Default + $(UNPACK) + @if [ -d ./patches ]; then \ + $(PATCH) $(PKG_BUILD_DIR) ./patches; \ + fi + endef +endif + +define Build/Prepare + $(call Build/Prepare/Default) +endef + +define Build/Configure/Default + @(cd $(PKG_BUILD_DIR)/$(3); \ + [ -x configure ] && \ + $(2) \ + CPPFLAGS="-I$(STAGING_DIR)/host/include" \ + LDFLAGS="-L$(STAGING_DIR)/host/lib" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --program-prefix="" \ + --program-suffix="" \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + $(1); \ + true; \ + ) +endef + +define Build/Configure + $(call Build/Configure/Default) +endef + +define Build/Compile/Default + $(MAKE) -C $(PKG_BUILD_DIR) $(1) +endef + +define Build/Compile + $(call Build/Compile/Default) +endef + + +ifneq ($(strip $(PKG_SOURCE)),) + download: $(DL_DIR)/$(PKG_SOURCE) + + $(DL_DIR)/$(PKG_SOURCE): + mkdir -p $(DL_DIR) + $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL) + + $(PKG_BUILD_DIR)/.prepared: $(DL_DIR)/$(PKG_SOURCE) +endif + +define HostBuild + $(PKG_BUILD_DIR)/.prepared: + @-rm -rf $(PKG_BUILD_DIR) + @mkdir -p $(PKG_BUILD_DIR) + $(call Build/Prepare) + touch $$@ + + $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared + $(call Build/Configure) + touch $$@ + + $(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/.configured + $(call Build/Compile) + touch $$@ + + $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed: $(PKG_BUILD_DIR)/.built + $(call Build/Install) + touch $$@ + + ifdef Build/Install + install-targets: $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed + endif + + package-clean: FORCE + $(call Build/Clean) + $(call Build/Uninstall) + rm -f $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed + + download: + prepare: $(PKG_BUILD_DIR)/.prepared + configure: $(PKG_BUILD_DIR)/.configured + + compile-targets: $(PKG_BUILD_DIR)/.built + compile: compile-targets + + install-targets: + install: install-targets + + clean-targets: + clean: FORCE + @$(MAKE) clean-targets + $(call Build/Clean) + rm -rf $(PKG_BUILD_DIR) + +endef diff --git a/include/host.mk b/include/host.mk new file mode 100644 index 0000000..3a5fd96 --- /dev/null +++ b/include/host.mk @@ -0,0 +1,31 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/.host.mk + +export TAR + +$(TOPDIR)/.host.mk: $(INCLUDE_DIR)/host.mk + @( \ + HOST_OS=`uname`; \ + case "$$HOST_OS" in \ + Linux) HOST_ARCH=`uname -m`;; \ + *) HOST_ARCH=`uname -p`;; \ + esac; \ + GNU_HOST_NAME=`gcc -dumpmachine`; \ + [ -n "$$GNU_HOST_NAME" ] || \ + GNU_HOST_NAME=`$(SCRIPT_DIR)/config.guess`; \ + echo "HOST_OS:=$$HOST_OS" > $@; \ + echo "HOST_ARCH:=$$HOST_ARCH" >> $@; \ + echo "GNU_HOST_NAME:=$$GNU_HOST_NAME" >> $@; \ + if tar --version 2>&1 | grep 'GNU' >/dev/null; then \ + echo "TAR_WILDCARDS:=--wildcards" >> $@; \ + fi; \ + TAR=`which gtar tar | head -n 1`; \ + echo "TAR:=$$TAR" >> $@; \ + ) + diff --git a/include/image.mk b/include/image.mk new file mode 100644 index 0000000..0651679 --- /dev/null +++ b/include/image.mk @@ -0,0 +1,96 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD) + +ifneq ($(CONFIG_BIG_ENDIAN),y) +JFFS2OPTS := --pad --little-endian --squash +SQUASHFS_OPTS := -le +else +JFFS2OPTS := --pad --big-endian --squash +SQUASHFS_OPTS := -be +endif + +ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y) + ifeq ($(CONFIG_TARGET_ROOTFS_JFFS2),y) + define Image/mkfs/jffs2 + rm -rf $(BUILD_DIR)/root/jffs + + $(STAGING_DIR)/bin/mkfs.jffs2 $(JFFS2OPTS) -e 0x10000 -o $(KDIR)/root.jffs2-64k -d $(BUILD_DIR)/root + $(STAGING_DIR)/bin/mkfs.jffs2 $(JFFS2OPTS) -e 0x20000 -o $(KDIR)/root.jffs2-128k -d $(BUILD_DIR)/root + + # add End-of-Filesystem markers + echo -ne '\xde\xad\xc0\xde' >> $(KDIR)/root.jffs2-64k + echo -ne '\xde\xad\xc0\xde' >> $(KDIR)/root.jffs2-128k + + $(call Image/Build,jffs2-64k) + $(call Image/Build,jffs2-128k) + endef + endif + + ifeq ($(CONFIG_TARGET_ROOTFS_SQUASHFS),y) + define Image/mkfs/squashfs + @mkdir -p $(BUILD_DIR)/root/jffs + $(STAGING_DIR)/bin/mksquashfs-lzma $(BUILD_DIR)/root $(KDIR)/root.squashfs -nopad -noappend -root-owned $(SQUASHFS_OPTS) + $(call Image/Build,squashfs) + endef + endif + + ifeq ($(CONFIG_TARGET_ROOTFS_TGZ),y) + define Image/mkfs/tgz + tar -zcf $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-rootfs.tgz --owner=root --group=root -C $(BUILD_DIR)/root/ . + endef + endif + + +endif + +ifeq ($(CONFIG_TARGET_ROOTFS_EXT2FS),y) + define Image/mkfs/ext2 + $(STAGING_DIR)/bin/genext2fs -q -b 8192 -I 1500 -d $(BUILD_DIR)/root/ $(KDIR)/root.ext2 + $(call Image/Build,ext2) + endef +endif + + +define Image/mkfs/prepare/default + find $(BUILD_DIR)/root -type f -not -perm +0100 | xargs chmod 0644 + find $(BUILD_DIR)/root -type f -perm +0100 | xargs chmod 0755 + find $(BUILD_DIR)/root -type d | xargs chmod 0755 + mkdir -p $(BUILD_DIR)/root/tmp + chmod 0777 $(BUILD_DIR)/root/tmp +endef + +define Image/mkfs/prepare + $(call Image/mkfs/prepare/default) +endef + +define BuildImage +compile: + $(call Build/Compile) + +install: + $(call Image/Prepare) + $(call Image/mkfs/prepare) + $(call Image/BuildKernel) + $(call Image/mkfs/jffs2) + $(call Image/mkfs/squashfs) + $(call Image/mkfs/tgz) + $(call Image/mkfs/ext2) + +clean: + $(call Build/Clean) +endef + +compile-targets: +install-targets: +clean-targets: + +download: +prepare: +compile: compile-targets +install: compile install-targets +clean: clean-targets diff --git a/include/kernel-build.mk b/include/kernel-build.mk new file mode 100644 index 0000000..5544a82 --- /dev/null +++ b/include/kernel-build.mk @@ -0,0 +1,145 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(INCLUDE_DIR)/host.mk +-include $(INCLUDE_DIR)/modules-$(KERNEL).mk + +LINUX_SOURCE:=linux-$(LINUX_VERSION).tar.bz2 +LINUX_SITE=http://www.us.kernel.org/pub/linux/kernel/v$(KERNEL) \ + http://www.us.kernel.org/pub/linux/kernel/v$(KERNEL) \ + http://www.kernel.org/pub/linux/kernel/v$(KERNEL) \ + http://www.de.kernel.org/pub/linux/kernel/v$(KERNEL) + +KERNEL_IDIR:=$(KERNEL_BUILD_DIR)/kernel-ipkg +KERNEL_IPKG:=$(KERNEL_BUILD_DIR)/kernel_$(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE)_$(ARCH).ipk +TARGETS += $(KERNEL_IPKG) +INSTALL_TARGETS += $(KERNEL_IPKG) + +LINUX_KARCH:=$(shell echo $(ARCH) | sed -e 's/i[3-9]86/i386/' \ + -e 's/mipsel/mips/' \ + -e 's/mipseb/mips/' \ + -e 's/powerpc/ppc/' \ + -e 's/sh[234]/sh/' \ + -e 's/armeb/arm/' \ +) + + +$(TARGETS): $(PACKAGE_DIR) + +$(PACKAGE_DIR): + mkdir -p $@ + +$(DL_DIR)/$(LINUX_SOURCE): + -mkdir -p $(DL_DIR) + $(SCRIPT_DIR)/download.pl $(DL_DIR) $(LINUX_SOURCE) $(LINUX_KERNEL_MD5SUM) $(LINUX_SITE) + +$(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE) + -mkdir -p $(KERNEL_BUILD_DIR) + bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(KERNEL_BUILD_DIR) $(TAR_OPTIONS) - + touch $@ + +ifeq ($(KERNEL),2.4) +$(LINUX_DIR)/.configured: $(LINUX_DIR)/.patched + $(SED) "s,\-mcpu=,\-mtune=,g;" $(LINUX_DIR)/arch/mips/Makefile + $(MAKE) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" CC="$(KERNEL_CC)" ARCH=$(LINUX_KARCH) oldconfig include/linux/compile.h include/linux/version.h + touch $@ + +$(LINUX_DIR)/.depend_done: $(LINUX_DIR)/.configured + $(MAKE) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" ARCH=$(LINUX_KARCH) dep + touch $@ + +$(LINUX_DIR)/vmlinux: $(LINUX_DIR)/.depend_done +else +$(LINUX_DIR)/.configured: $(LINUX_DIR)/.patched + $(MAKE) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" CC="$(KERNEL_CC)" ARCH=$(LINUX_KARCH) oldconfig prepare scripts + touch $@ +endif + +ramdisk-config: $(LINUX_DIR)/.configured FORCE + mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old + grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config +ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y) + echo 'CONFIG_INITRAMFS_SOURCE="../../root"' >> $(LINUX_DIR)/.config + echo 'CONFIG_INITRAMFS_ROOT_UID=0' >> $(LINUX_DIR)/.config + echo 'CONFIG_INITRAMFS_ROOT_GID=0' >> $(LINUX_DIR)/.config + mkdir -p $(BUILD_DIR)/root/etc/init.d + $(CP) ../generic-2.6/files/init $(BUILD_DIR)/root/ +else + rm -f $(BUILD_DIR)/root/init $(BUILD_DIR)/root/etc/init.d/S00initramfs + echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config +endif + +$(LINUX_DIR)/vmlinux: $(LINUX_DIR)/.linux-compile pkg-install ramdisk-config + $(MAKE) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" CC="$(KERNEL_CC)" ARCH=$(LINUX_KARCH) $(KERNELNAME) + +$(LINUX_KERNEL): $(LINUX_DIR)/vmlinux + $(KERNEL_CROSS)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S $< $@ + touch -c $(LINUX_KERNEL) + +$(LINUX_DIR)/.modules_done: + rm -rf $(KERNEL_BUILD_DIR)/modules + $(MAKE) -C "$(LINUX_DIR)" CROSS_COMPILE="$(KERNEL_CROSS)" CC="$(KERNEL_CC)" ARCH=$(LINUX_KARCH) modules + $(MAKE) -C "$(LINUX_DIR)" CROSS_COMPILE="$(KERNEL_CROSS)" CC="$(KERNEL_CC)" ARCH=$(LINUX_KARCH) DEPMOD=true INSTALL_MOD_PATH=$(KERNEL_BUILD_DIR)/modules modules_install + touch $(LINUX_DIR)/.modules_done + +modules: $(LINUX_DIR)/.modules_done +packages: $(TARGETS) + +$(LINUX_DIR)/.linux-compile: + @rm -f $(BUILD_DIR)/linux + ln -sf $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) $(BUILD_DIR)/linux + @$(MAKE) modules + touch $@ + +$(KERNEL_IPKG): + rm -rf $(KERNEL_IDIR) + mkdir -p $(KERNEL_IDIR)/etc + $(SCRIPT_DIR)/make-ipkg-dir.sh $(KERNEL_IDIR) ../control/kernel.control $(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE) $(ARCH) + if [ -f ./config/$(BOARD).modules ]; then \ + cp ./config/$(BOARD).modules $(KERNEL_IDIR)/etc/modules; \ + fi + $(IPKG_BUILD) $(KERNEL_IDIR) $(KERNEL_BUILD_DIR) + +$(TOPDIR)/.kernel.mk: $(TOPDIR)/target/linux/$(BOARD)-$(KERNEL)/Makefile + echo "CONFIG_BOARD:=$(BOARD)" > $@ + echo "CONFIG_KERNEL:=$(KERNEL)" >> $@ + echo "CONFIG_LINUX_VERSION:=$(LINUX_VERSION)" >> $@ + echo "CONFIG_LINUX_RELEASE:=$(LINUX_RELEASE)" >> $@ + echo "CONFIG_LINUX_KARCH:=$(LINUX_KARCH)" >> $@ + +pkg-install: FORCE + @for pkg in $(INSTALL_TARGETS); do \ + $(IPKG) install $$pkg || echo; \ + done + +download: $(DL_DIR)/$(LINUX_SOURCE) +prepare: $(LINUX_DIR)/.configured + @mkdir -p $(LINUX_DIR) $(PACKAGE_DIR) + +compile: prepare $(LINUX_DIR)/.linux-compile + @$(MAKE) packages + +install: compile $(LINUX_KERNEL) + +mostlyclean: FORCE + rm -f $(LINUX_DIR)/.linux-compile + rm -f $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/.modules_done + rm -f $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/.drivers-unpacked + $(MAKE) -C $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) clean + rm -f $(LINUX_KERNEL) + +rebuild: FORCE + -$(MAKE) mostlyclean + if [ -f $(LINUX_KERNEL) ]; then \ + $(MAKE) clean; \ + fi + $(MAKE) compile $(MAKE_TRACE) + +clean: FORCE + rm -f $(STAMP_DIR)/.linux-compile + rm -rf $(KERNEL_BUILD_DIR) + rm -f $(TARGETS) + diff --git a/include/kernel.mk b/include/kernel.mk new file mode 100644 index 0000000..580e395 --- /dev/null +++ b/include/kernel.mk @@ -0,0 +1,106 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +ifeq ($(DUMP),1) + KERNEL:=<KERNEL> + BOARD:=<BOARD> + LINUX_VERSION:=<LINUX_VERSION> +else + + include $(TOPDIR)/.kernel.mk + include $(INCLUDE_DIR)/target.mk + + # check to see if .kernel.mk matches target.mk + ifeq ($(CONFIG_BOARD)-$(CONFIG_KERNEL),$(BOARD)-$(KERNEL)) + LINUX_VERSION:=$(CONFIG_LINUX_VERSION) + LINUX_RELEASE:=$(CONFIG_LINUX_RELEASE) + LINUX_KARCH:=$(CONFIG_LINUX_KARCH) + else + # oops, old .kernel.config; rebuild it (hiding the misleading errors this produces) + $(warning rebuilding .kernel.mk) + $(TOPDIR)/.kernel.mk: FORCE + @$(MAKE) -C $(TOPDIR)/target/linux/$(BOARD)-$(KERNEL) $@ &>/dev/null + endif + + ifeq ($(KERNEL),2.6) + LINUX_KMOD_SUFFIX=ko + else + LINUX_KMOD_SUFFIX=o + endif + + KERNELNAME= + ifneq (,$(findstring x86,$(BOARD))) + KERNELNAME="bzImage" + endif + ifneq (,$(findstring ppc,$(BOARD))) + KERNELNAME="uImage" + endif + + ifneq (,$(findstring uml,$(BOARD))) + LINUX_KARCH:=um + KERNEL_CC:=$(HOSTCC) + KERNEL_CROSS:= + else + KERNEL_CC:=$(TARGET_CC) + KERNEL_CROSS:=$(TARGET_CROSS) + endif + + KERNEL_BUILD_DIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD) + LINUX_DIR := $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) + + MODULES_SUBDIR:=lib/modules/$(LINUX_VERSION) + MODULES_DIR := $(KERNEL_BUILD_DIR)/modules/$(MODULES_SUBDIR) + TARGET_MODULES_DIR := $(LINUX_TARGET_DIR)/$(MODULES_SUBDIR) + KMOD_BUILD_DIR := $(KERNEL_BUILD_DIR)/linux-modules + + LINUX_KERNEL:=$(KERNEL_BUILD_DIR)/vmlinux +endif + +# FIXME: remove this crap +define KMOD_template +ifeq ($$(strip $(4)),) +KDEPEND_$(1):=m +else +KDEPEND_$(1):=$($(4)) +endif + +IDEPEND_$(1):=kernel ($(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE)) $(foreach pkg,$(5),", $(pkg)") + +PKG_$(1) := $(PACKAGE_DIR)/kmod-$(2)_$(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE)_$(ARCH).ipk +I_$(1) := $(KMOD_BUILD_DIR)/ipkg/$(2) + +ifeq ($$(KDEPEND_$(1)),m) +ifneq ($$(CONFIG_PACKAGE_KMOD_$(1)),) +TARGETS += $$(PKG_$(1)) +endif +ifeq ($$(CONFIG_PACKAGE_KMOD_$(1)),y) +INSTALL_TARGETS += $$(PKG_$(1)) +endif +endif + +$$(PKG_$(1)): $(LINUX_DIR)/.modules_done + rm -rf $$(I_$(1)) + $(SCRIPT_DIR)/make-ipkg-dir.sh $$(I_$(1)) ../control/kmod-$(2).control $(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE) $(ARCH) + echo "Depends: $$(IDEPEND_$(1))" >> $$(I_$(1))/CONTROL/control +ifneq ($(strip $(3)),) + mkdir -p $$(I_$(1))/lib/modules/$(LINUX_VERSION) + $(CP) $(3) $$(I_$(1))/lib/modules/$(LINUX_VERSION) +endif +ifneq ($(6),) + mkdir -p $$(I_$(1))/etc/modules.d + for module in $(7); do \ + echo $$$$module >> $$(I_$(1))/etc/modules.d/$(6)-$(2); \ + done + echo "#!/bin/sh" >> $$(I_$(1))/CONTROL/postinst + echo "[ -z \"\$$$$IPKG_INSTROOT\" ] || exit" >> $$(I_$(1))/CONTROL/postinst + echo ". /etc/functions.sh" >> $$(I_$(1))/CONTROL/postinst + echo "load_modules /etc/modules.d/$(6)-$(2)" >> $$(I_$(1))/CONTROL/postinst + chmod 0755 $$(I_$(1))/CONTROL/postinst +endif + $(8) + $(IPKG_BUILD) $$(I_$(1)) $(PACKAGE_DIR) +endef + diff --git a/include/modules-2.4.mk b/include/modules-2.4.mk new file mode 100644 index 0000000..e8c67ac --- /dev/null +++ b/include/modules-2.4.mk @@ -0,0 +1,196 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(INCLUDE_DIR)/netfilter.mk + +# Networking + +$(eval $(call KMOD_template,ATM,atm,\ + $(MODULES_DIR)/kernel/net/atm/atm.o \ + $(MODULES_DIR)/kernel/net/atm/br2684.o \ +,CONFIG_ATM,,50,atm)) + +# Block devices + +$(eval $(call KMOD_template,LOOP,loop,\ + $(MODULES_DIR)/kernel/drivers/block/loop.o \ +,CONFIG_BLK_DEV_LOOP,,20,loop)) + +$(eval $(call KMOD_template,NBD,nbd,\ + $(MODULES_DIR)/kernel/drivers/block/nbd.o \ +,CONFIG_BLK_DEV_NBD,,20,nbd)) + + +# Filesystems + +$(eval $(call KMOD_template,FS_CIFS,fs-cifs,\ + $(MODULES_DIR)/kernel/fs/cifs/cifs.o \ +,CONFIG_CIFS,,30,cifs)) + +$(eval $(call KMOD_template,FS_MINIX,fs-minix,\ + $(MODULES_DIR)/kernel/fs/minix/*.o \ +,CONFIG_MINIX_FS,,30,minix)) + +$(eval $(call KMOD_template,FS_EXT2,fs-ext2,\ + $(MODULES_DIR)/kernel/fs/ext2/*.o \ +,CONFIG_EXT2_FS,,30,ext2)) + +$(eval $(call KMOD_template,FS_EXT3,fs-ext3,\ + $(MODULES_DIR)/kernel/fs/ext3/*.o \ + $(MODULES_DIR)/kernel/fs/jbd/*.o \ +,CONFIG_EXT3_FS,,30,jbd ext3)) + +$(eval $(call KMOD_template,FS_HFSPLUS,fs-hfsplus,\ + $(MODULES_DIR)/kernel/fs/hfsplus/*.o \ +,CONFIG_HFSPLUS_FS,,30,hfsplus)) + +$(eval $(call KMOD_template,FS_NFS,fs-nfs,\ + $(MODULES_DIR)/kernel/fs/lockd/*.o \ + $(MODULES_DIR)/kernel/fs/nfs/*.o \ + $(MODULES_DIR)/kernel/net/sunrpc/*.o \ +,CONFIG_NFS_FS,,30,sunrpc lockd nfs)) + +$(eval $(call KMOD_template,FS_VFAT,fs-vfat,\ + $(MODULES_DIR)/kernel/fs/vfat/vfat.o \ + $(MODULES_DIR)/kernel/fs/fat/fat.o \ +,CONFIG_VFAT_FS,,30,fat vfat)) + +$(eval $(call KMOD_template,FS_XFS,fs-xfs,\ + $(MODULES_DIR)/kernel/fs/xfs/*.o \ +,CONFIG_XFS_FS,,30,xfs)) + + +# Multimedia + +$(eval $(call KMOD_template,PWC,pwc,\ + $(MODULES_DIR)/kernel/drivers/usb/pwc.o \ +,CONFIG_USB_PWC,kmod-videodev,63,pwc)) + +$(eval $(call KMOD_template,SOUNDCORE,soundcore,\ + $(MODULES_DIR)/kernel/drivers/sound/soundcore.o \ +,CONFIG_SOUND,,30,soundcore)) + +$(eval $(call KMOD_template,VIDEODEV,videodev,\ + $(MODULES_DIR)/kernel/drivers/media/video/videodev.o \ +,CONFIG_VIDEO_DEV,,62,videodev)) + + +# Network devices + +$(eval $(call KMOD_template,NET_AIRO,net-airo,\ + $(MODULES_DIR)/kernel/drivers/net/wireless/airo.o \ +,CONFIG_AIRO,,10,airo)) + +$(eval $(call KMOD_template,NET_HERMES,net-hermes,\ + $(MODULES_DIR)/kernel/drivers/net/wireless/hermes.o \ + $(MODULES_DIR)/kernel/drivers/net/wireless/orinoco.o \ +,CONFIG_HERMES,,10,hermes orinoco)) + +$(eval $(call KMOD_template,NET_HERMES_PCI,net-hermes-pci,\ + $(MODULES_DIR)/kernel/drivers/net/wireless/orinoco_pci.o \ +,CONFIG_PCI_HERMES,kmod-net-hermes,11,orinoco_pci)) + +$(eval $(call KMOD_template,NET_HERMES_PCI,net-hermes-plx,\ + $(MODULES_DIR)/kernel/drivers/net/wireless/orinoco_plx.o \ +,CONFIG_PLX_HERMES,kmod-net-hermes,11,orinoco_plx)) + +$(eval $(call KMOD_template,NET_PRISM54,net-prism54,\ + $(MODULES_DIR)/kernel/drivers/net/wireless/prism54/prism54.o \ +,CONFIG_PRISM54,,10,prism54)) + + +# PCMCIA/CardBus + +$(eval $(call KMOD_template,PCMCIA_CORE,pcmcia-core,\ + $(MODULES_DIR)/kernel/drivers/pcmcia/pcmcia_core.o \ + $(MODULES_DIR)/kernel/drivers/pcmcia/yenta_socket.o \ + $(MODULES_DIR)/kernel/drivers/pcmcia/ds.o \ +,CONFIG_PCMCIA,,50,pcmcia_core yenta_socket ds)) + +$(eval $(call KMOD_template,PCMCIA_SERIAL,pcmcia-serial,\ + $(MODULES_DIR)/kernel/drivers/char/pcmcia/serial_cs.o \ +,CONFIG_PCMCIA_SERIAL_CS,kmod-pcmcia-core,51,serial_cs)) + + +# USB + +$(eval $(call KMOD_template,USB,usb-core,\ + $(MODULES_DIR)/kernel/drivers/usb/usbcore.o \ +,CONFIG_USB,,50,usbcore)) + +$(eval $(call KMOD_template,USB_OHCI,usb-ohci,\ + $(MODULES_DIR)/kernel/drivers/usb/host/usb-ohci.o \ +,CONFIG_USB_OHCI,kmod-usb-core,60,usb-ohci)) + +$(eval $(call KMOD_template,USB_UHCI,usb-uhci,\ + $(MODULES_DIR)/kernel/drivers/usb/host/uhci.o \ +,CONFIG_USB_UHCI_ALT,kmod-usb-core,60,uhci)) + +$(eval $(call KMOD_template,USB2,usb2,\ + $(MODULES_DIR)/kernel/drivers/usb/host/ehci-hcd.o \ +,CONFIG_USB_EHCI_HCD,kmod-usb-core,60,ehci-hcd)) + +$(eval $(call KMOD_template,USB_ACM,usb-acm,\ + $(MODULES_DIR)/kernel/drivers/usb/acm.o \ +,CONFIG_USB_ACM)) + +$(eval $(call KMOD_template,USB_AUDIO,usb-audio,\ + $(MODULES_DIR)/kernel/drivers/usb/audio.o \ +,CONFIG_USB_AUDIO,kmod-soundcore kmod-usb-core,61,audio)) + +$(eval $(call KMOD_template,USB_PRINTER,usb-printer,\ + $(MODULES_DIR)/kernel/drivers/usb/printer.o \ +,CONFIG_USB_PRINTER,kmod-usb-core,60,printer)) + +$(eval $(call KMOD_template,USB_SERIAL,usb-serial,\ + $(MODULES_DIR)/kernel/drivers/usb/serial/usbserial.o \ +,CONFIG_USB_SERIAL,kmod-usb-core,60,usbserial)) + +$(eval $(call KMOD_template,USB_SERIAL_BELKIN,usb-serial-belkin,\ + $(MODULES_DIR)/kernel/drivers/usb/serial/belkin_sa.o \ +,CONFIG_USB_SERIAL_BELKIN,kmod-usb-serial,61,belkin_sa)) + +$(eval $(call KMOD_template,USB_SERIAL_FTDI,usb-serial-ftdi,\ + $(MODULES_DIR)/kernel/drivers/usb/serial/ftdi_sio.o \ +,CONFIG_USB_SERIAL_FTDI_SIO,kmod-usb-serial,61,ftdi_sio)) + +$(eval $(call KMOD_template,USB_SERIAL_MCT_U232,usb-serial-mct-u232,\ + $(MODULES_DIR)/kernel/drivers/usb/serial/mct_u232.o \ +,CONFIG_USB_SERIAL_MCT_U232,kmod-usb-serial,61,mct_u232)) + +$(eval $(call KMOD_template,USB_SERIAL_PL2303,usb-serial-pl2303,\ + $(MODULES_DIR)/kernel/drivers/usb/serial/pl2303.o \ +,CONFIG_USB_SERIAL_PL2303,kmod-usb-serial,61,pl2303)) + +$(eval $(call KMOD_template,USB_SERIAL_VISOR,usb-serial-visor,\ + $(MODULES_DIR)/kernel/drivers/usb/serial/visor.o \ +,CONFIG_USB_SERIAL_VISOR,kmod-usb-serial,61,visor)) + +$(eval $(call KMOD_template,USB_STORAGE,usb-storage,\ + $(MODULES_DIR)/kernel/drivers/scsi/*.o \ + $(MODULES_DIR)/kernel/drivers/usb/storage/*.o \ +,CONFIG_USB_STORAGE,kmod-usb-core,60,scsi_mod sd_mod usb-storage)) + + +# Misc. devices + +$(eval $(call KMOD_template,AX25,ax25,\ + $(MODULES_DIR)/kernel/net/ax25/ax25.o \ + $(MODULES_DIR)/kernel/drivers/net/hamradio/mkiss.o \ +,CONFIG_AX25,,90,ax25 mkiss)) + +$(eval $(call KMOD_template,BLUETOOTH,bluetooth,\ + $(MODULES_DIR)/kernel/net/bluetooth/*.o \ + $(MODULES_DIR)/kernel/net/bluetooth/rfcomm/*.o \ + $(MODULES_DIR)/kernel/drivers/bluetooth/*.o \ +,CONFIG_BLUEZ)) + +$(eval $(call KMOD_template,SOFTDOG,softdog,\ + $(MODULES_DIR)/kernel/drivers/char/softdog.o \ +,CONFIG_SOFT_WATCHDOG,,95,softdog)) + + + diff --git a/include/modules-2.6.mk b/include/modules-2.6.mk new file mode 100644 index 0000000..9bb08261 --- /dev/null +++ b/include/modules-2.6.mk @@ -0,0 +1,233 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +NF_2_6:=1 +include $(INCLUDE_DIR)/netfilter.mk + +# Networking + +$(eval $(call KMOD_template,ATM,atm,\ + $(MODULES_DIR)/kernel/net/atm/atm.ko \ + $(MODULES_DIR)/kernel/net/atm/br2684.ko \ + $(MODULES_DIR)/kernel/drivers/atm/atmtcp.ko \ +,CONFIG_ATM,,50,atm)) + +# Block devices + +$(eval $(call KMOD_template,LOOP,loop,\ + $(MODULES_DIR)/kernel/drivers/block/loop.ko \ +,CONFIG_BLK_DEV_LOOP,,20,loop)) + +$(eval $(call KMOD_template,NBD,nbd,\ + $(MODULES_DIR)/kernel/drivers/block/nbd.ko \ +,CONFIG_BLK_DEV_NBD,,20,nbd)) + +# Filesystems + +$(eval $(call KMOD_template,FS_CIFS,fs-cifs,\ + $(MODULES_DIR)/kernel/fs/cifs/cifs.ko \ +,CONFIG_CIFS,kmod-nls-base,30,cifs)) + +$(eval $(call KMOD_template,FS_MINIX,fs-minix,\ + $(MODULES_DIR)/kernel/fs/minix/minix.ko \ +,CONFIG_MINIX_FS,,30,minix)) + +$(eval $(call KMOD_template,FS_EXT2,fs-ext2,\ + $(MODULES_DIR)/kernel/fs/ext2/ext2.ko \ +,CONFIG_EXT2_FS,,30,ext2)) + +$(eval $(call KMOD_template,FS_EXT3,fs-ext3,\ + $(MODULES_DIR)/kernel/fs/ext3/ext3.ko \ + $(MODULES_DIR)/kernel/fs/jbd/jbd.ko \ +,CONFIG_EXT3_FS,,30,jbd ext3)) + +$(eval $(call KMOD_template,FS_HFSPLUS,fs-hfsplus,\ + $(MODULES_DIR)/kernel/fs/hfsplus/hfsplus.ko \ +,CONFIG_HFSPLUS_FS,kmod-nls-base,30,hfsplus)) + +$(eval $(call KMOD_template,FS_NFS,fs-nfs,\ + $(MODULES_DIR)/kernel/fs/lockd/lockd.ko \ + $(MODULES_DIR)/kernel/fs/nfs/nfs.ko \ + $(MODULES_DIR)/kernel/net/sunrpc/sunrpc.ko \ +,CONFIG_NFS_FS,,30,sunrpc lockd nfs)) + +$(eval $(call KMOD_template,FS_VFAT,fs-vfat,\ + $(MODULES_DIR)/kernel/fs/fat/fat.ko \ + $(MODULES_DIR)/kernel/fs/vfat/vfat.ko \ +,CONFIG_VFAT_FS,kmod-nls-base,30,fat vfat)) + +$(eval $(call KMOD_template,FS_XFS,fs-xfs,\ + $(MODULES_DIR)/kernel/fs/xfs/xfs.ko \ +,CONFIG_XFS_FS,,30,xfs)) + + +# Multimedia + +$(eval $(call KMOD_template,PWC,pwc,\ + $(MODULES_DIR)/kernel/drivers/usb/media/pwc/pwc.ko \ +,CONFIG_USB_PWC,kmod-videodev,63,pwc)) + +$(eval $(call KMOD_template,SOUNDCORE,soundcore,\ + $(MODULES_DIR)/kernel/sound/soundcore.ko \ +,CONFIG_SOUND,,30,soundcore)) + +$(eval $(call KMOD_template,VIDEODEV,videodev,\ + $(MODULES_DIR)/kernel/drivers/media/video/v4l1-compat.ko \ + $(MODULES_DIR)/kernel/drivers/media/video/v4l2-common.ko \ + $(MODULES_DIR)/kernel/drivers/media/video/videodev.ko \ +,CONFIG_VIDEO_DEV,,62,videodev)) + + +# NLS + +$(eval $(call KMOD_template,NLS_BASE,nls-base,\ + $(MODULES_DIR)/kernel/fs/nls/nls_base.ko \ +,CONFIG_NLS,,20,nls_base)) + +$(eval $(call KMOD_template,NLS_CP437,nls-cp437,\ + $(MODULES_DIR)/kernel/fs/nls/nls_cp437.ko \ +,CONFIG_NLS_CODEPAGE_437,,20,nls_cp437)) + +$(eval $(call KMOD_template,NLS_CP850,nls-cp850,\ + $(MODULES_DIR)/kernel/fs/nls/nls_cp850.ko \ +,CONFIG_NLS_CODEPAGE_850,,20,nls_cp850)) + +$(eval $(call KMOD_template,NLS_ISO8859_1,nls-iso8859-1,\ + $(MODULES_DIR)/kernel/fs/nls/nls_iso8859-1.ko \ +,CONFIG_NLS_ISO8859_1,,20,nls_iso8859-1)) + +$(eval $(call KMOD_template,NLS_ISO8859_15,nls-iso8859-15,\ + $(MODULES_DIR)/kernel/fs/nls/nls_iso8859-15.ko \ +,CONFIG_NLS_ISO8859_15,,20,nls_iso8859-15)) + +$(eval $(call KMOD_template,NLS_UTF8,nls-utf8,\ + $(MODULES_DIR)/kernel/fs/nls/nls_utf8.ko \ +,CONFIG_NLS_UTF8,,20,nls_utf8)) + + +# Network devices + +$(eval $(call KMOD_template,NET_AIRO,net-airo,\ + $(MODULES_DIR)/kernel/drivers/net/wireless/airo.ko \ +,CONFIG_AIRO,,10,airo)) + +$(eval $(call KMOD_template,NET_HERMES,net-hermes,\ + $(MODULES_DIR)/kernel/drivers/net/wireless/hermes.ko \ + $(MODULES_DIR)/kernel/drivers/net/wireless/orinoco.ko \ +,CONFIG_HERMES,,10,hermes orinoco)) + +$(eval $(call KMOD_template,NET_HERMES_PCI,net-hermes-pci,\ + $(MODULES_DIR)/kernel/drivers/net/wireless/orinoco_pci.ko \ +,CONFIG_PCI_HERMES,kmod-net-hermes,11,orinoco_pci)) + +$(eval $(call KMOD_template,NET_HERMES_PCI,net-hermes-plx,\ + $(MODULES_DIR)/kernel/drivers/net/wireless/orinoco_plx.ko \ +,CONFIG_PLX_HERMES,kmod-net-hermes,11,orinoco_plx)) + +$(eval $(call KMOD_template,NET_PRISM54,net-prism54,\ + $(MODULES_DIR)/kernel/drivers/net/wireless/prism54/prism54.ko \ +,CONFIG_PRISM54,,10,prism54)) + + +# PCMCIA/CardBus + +$(eval $(call KMOD_template,PCMCIA_CORE,pcmcia-core,\ + $(MODULES_DIR)/kernel/drivers/pcmcia/pcmcia.ko \ + $(MODULES_DIR)/kernel/drivers/pcmcia/pcmcia_core.ko \ + $(MODULES_DIR)/kernel/drivers/pcmcia/yenta_socket.ko \ + $(MODULES_DIR)/kernel/drivers/pcmcia/rsrc_nonstatic.ko \ +,CONFIG_PCMCIA,,50,pcmcia_core pcmcia yenta_socket rsrc_nonstatic)) + +$(eval $(call KMOD_template,PCMCIA_SERIAL,pcmcia-serial,\ + $(MODULES_DIR)/kernel/drivers/serial/serial_cs.ko \ +,CONFIG_SERIAL_8250_CS)) + + +# USB + +$(eval $(call KMOD_template,USB,usb-core,\ + $(MODULES_DIR)/kernel/drivers/usb/core/usbcore.ko \ +,CONFIG_USB,,50,usbcore)) + +$(eval $(call KMOD_template,USB_OHCI,usb-ohci,\ + $(MODULES_DIR)/kernel/drivers/usb/host/ohci-hcd.ko \ +,CONFIG_USB_OHCI_HCD,kmod-usb-core,60,ohci-hcd)) + +$(eval $(call KMOD_template,USB_UHCI,usb-uhci,\ + $(MODULES_DIR)/kernel/drivers/usb/host/uhci-hcd.ko \ +,CONFIG_USB_UHCI_HCD,kmod-usb-core,60,uhci-hcd)) + +$(eval $(call KMOD_template,USB2,usb2,\ + $(MODULES_DIR)/kernel/drivers/usb/host/ehci-hcd.ko \ +,CONFIG_USB_EHCI_HCD,kmod-usb-core,60,ehci-hcd)) + +$(eval $(call KMOD_template,USB_ACM,usb-acm,\ + $(MODULES_DIR)/kernel/drivers/usb/class/cdc-acm.ko \ +,CONFIG_USB_ACM)) + +$(eval $(call KMOD_template,USB_AUDIO,usb-audio,\ + $(MODULES_DIR)/kernel/drivers/usb/class/audio.ko \ +,CONFIG_USB_AUDIO,kmod-soundcore kmod-usb-core,61,audio)) + +$(eval $(call KMOD_template,USB_PRINTER,usb-printer,\ + $(MODULES_DIR)/kernel/drivers/usb/class/usblp.ko \ +,CONFIG_USB_PRINTER,kmod-usb-core,60,usblp)) + +$(eval $(call KMOD_template,USB_SERIAL,usb-serial,\ + $(MODULES_DIR)/kernel/drivers/usb/serial/usbserial.ko \ +,CONFIG_USB_SERIAL,kmod-usb-core,60,usbserial)) + +$(eval $(call KMOD_template,USB_SERIAL_BELKIN,usb-serial-belkin,\ + $(MODULES_DIR)/kernel/drivers/usb/serial/belkin_sa.ko \ +,CONFIG_USB_SERIAL_BELKIN,kmod-usb-serial,61,belkin_sa)) + +$(eval $(call KMOD_template,USB_SERIAL_FTDI,usb-serial-ftdi,\ + $(MODULES_DIR)/kernel/drivers/usb/serial/ftdi_sio.ko \ +,CONFIG_USB_SERIAL_FTDI_SIO,kmod-usb-serial,61,ftdi_sio)) + +$(eval $(call KMOD_template,USB_SERIAL_MCT_U232,usb-serial-mct-u232,\ + $(MODULES_DIR)/kernel/drivers/usb/serial/mct_u232.ko \ +,CONFIG_USB_SERIAL_MCT_U232,kmod-usb-serial,61,mct_u232)) + +$(eval $(call KMOD_template,USB_SERIAL_PL2303,usb-serial-pl2303,\ + $(MODULES_DIR)/kernel/drivers/usb/serial/pl2303.ko \ +,CONFIG_USB_SERIAL_PL2303,kmod-usb-serial,61,pl2303)) + +$(eval $(call KMOD_template,USB_SERIAL_VISOR,usb-serial-visor,\ + $(MODULES_DIR)/kernel/drivers/usb/serial/visor.ko \ +,CONFIG_USB_SERIAL_VISOR,kmod-usb-serial,61,visor)) + +$(eval $(call KMOD_template,USB_STORAGE,usb-storage,\ + $(MODULES_DIR)/kernel/drivers/scsi/scsi_mod.ko \ + $(MODULES_DIR)/kernel/drivers/scsi/sd_mod.ko \ + $(MODULES_DIR)/kernel/drivers/usb/storage/usb-storage.ko \ +,CONFIG_USB_STORAGE,kmod-usb-core,60,scsi_mod sd_mod usb-storage)) + +$(eval $(call KMOD_template,USB_ATM,usb-atm,\ + $(MODULES_DIR)/kernel/drivers/usb/atm/usbatm.ko \ + ,CONFIG_USB_ATM,kmod-usb-atm,50,usbatm)) + +$(eval $(call KMOD_template,USB_ATM_SPEEDTOUCH,usb-atm-speedtouch,\ + $(MODULES_DIR)/kernel/drivers/usb/atm/speedtch.ko \ + ,CONFIG_USB_SPEEDTOUCH,kmod-usb-atm-speedtouch,50,speedtch)) + +# Misc. devices + +$(eval $(call KMOD_template,AX25,ax25,\ + $(MODULES_DIR)/kernel/net/ax25/ax25.ko \ + $(MODULES_DIR)/kernel/drivers/net/hamradio/mkiss.ko \ +,CONFIG_AX25,,90,ax25 mkiss)) + +$(eval $(call KMOD_template,BLUETOOTH,bluetooth,\ + $(MODULES_DIR)/kernel/net/bluetooth/bluetooth.ko \ + $(MODULES_DIR)/kernel/net/bluetooth/l2cap.ko \ + $(MODULES_DIR)/kernel/net/bluetooth/sco.ko \ + $(MODULES_DIR)/kernel/net/bluetooth/rfcomm/rfcomm.ko \ + $(MODULES_DIR)/kernel/drivers/bluetooth/hci_uart.ko \ + $(MODULES_DIR)/kernel/drivers/bluetooth/hci_usb.ko \ +,CONFIG_BT)) + + diff --git a/include/netfilter.mk b/include/netfilter.mk new file mode 100644 index 0000000..ba1512e --- /dev/null +++ b/include/netfilter.mk @@ -0,0 +1,122 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id: netfilter.mk 2411 2005-11-11 03:41:43Z nico $ + +ifeq ($(NF_KMOD),1) +P_V4:=ipv4/netfilter/ +P_XT:=netfilter/ +endif + +IPT_CONNTRACK-m := +IPT_CONNTRACK-$(CONFIG_IP_NF_MATCH_CONNMARK) += $(P_V4)ipt_connmark +IPT_CONNTRACK-$(CONFIG_IP_NF_TARGET_CONNMARK) += $(P_V4)ipt_CONNMARK +IPT_CONNTRACK-$(CONFIG_IP_NF_MATCH_CONNTRACK) += $(P_V4)ipt_conntrack +IPT_CONNTRACK-$(CONFIG_IP_NF_MATCH_HELPER) += $(P_V4)ipt_helper +IPT_CONNTRACK-$(CONFIG_IP_NF_MATCH_STATE) += $(P_V4)ipt_state +IPT_CONNTRACK-$(CONFIG_NETFILTER_XT_MATCH_CONNTRACK) += $(P_XT)xt_conntrack +IPT_CONNTRACK-$(CONFIG_NETFILTER_XT_MATCH_HELPER) += $(P_XT)xt_helper +IPT_CONNTRACK-$(CONFIG_NETFILTER_XT_MATCH_STATE) += $(P_XT)xt_state + + +IPT_EXTRA-m := +IPT_EXTRA-$(CONFIG_IP_NF_MATCH_CONDITION) += $(P_V4)ipt_condition +IPT_EXTRA-$(CONFIG_IP_NF_MATCH_CONNBYTES) += $(P_V4)ipt_connbytes +IPT_EXTRA-$(CONFIG_NETFILTER_XT_MATCH_CONNBYTES) += $(P_XT)xt_connbytes +IPT_EXTRA-$(CONFIG_IP_NF_MATCH_LIMIT) += $(P_V4)ipt_limit +IPT_EXTRA-$(CONFIG_NETFILTER_XT_MATCH_LIMIT) += $(P_XT)xt_limit +IPT_EXTRA-$(CONFIG_IP_NF_TARGET_LOG) += $(P_V4)ipt_LOG +IPT_EXTRA-$(CONFIG_IP_NF_MATCH_MULTIPORT) += $(P_XT)xt_multiport +IPT_EXTRA-$(CONFIG_NETFILTER_XT_MATCH_MULTIPORT) += $(P_XT)xt_multiport +IPT_EXTRA-$(CONFIG_IP_NF_MATCH_OWNER) += $(P_V4)ipt_owner +IPT_EXTRA-$(CONFIG_IP_NF_MATCH_PHYSDEV) += $(P_V4)ipt_physdev +IPT_EXTRA-$(CONFIG_IP_NF_MATCH_PKTTYPE) += $(P_V4)ipt_pkttype +IPT_EXTRA-$(CONFIG_NETFILTER_XT_MATCH_PKTTYPE) += $(P_XT)xt_pkttype +IPT_EXTRA-$(CONFIG_IP_NF_MATCH_QUOTA) += $(P_V4)ipt_quota +IPT_EXTRA-$(CONFIG_IP_NF_MATCH_RECENT) += $(P_V4)ipt_recent +IPT_EXTRA-$(CONFIG_IP_NF_TARGET_REJECT) += $(P_V4)ipt_REJECT +IPT_EXTRA-$(CONFIG_IP_NF_MATCH_STRING) += $(P_V4)ipt_string +IPT_EXTRA-$(CONFIG_NETFILTER_XT_MATCH_STRING) += $(P_XT)xt_string + +IPT_FILTER-m := +IPT_FILTER-$(CONFIG_IP_NF_MATCH_IPP2P) += $(P_V4)ipt_ipp2p +IPT_FILTER-$(CONFIG_IP_NF_MATCH_LAYER7) += $(P_V4)ipt_layer7 + +IPT_IMQ-m := +IPT_IMQ-$(CONFIG_IP_NF_TARGET_IMQ) += $(P_V4)ipt_IMQ + +IPT_IPOPT-m := +IPT_IPOPT-$(CONFIG_IP_NF_MATCH_DSCP) += $(P_V4)ipt_dscp +IPT_IPOPT-$(CONFIG_IP_NF_TARGET_DSCP) += $(P_V4)ipt_DSCP +IPT_IPOPT-$(CONFIG_IP_NF_MATCH_ECN) += $(P_V4)ipt_ecn +IPT_IPOPT-$(CONFIG_IP_NF_TARGET_ECN) += $(P_V4)ipt_ECN +IPT_IPOPT-$(CONFIG_IP_NF_MATCH_LENGTH) += $(P_V4)ipt_length +IPT_IPOPT-$(CONFIG_NETFILTER_XT_MATCH_LENGTH) += $(P_XT)xt_length +IPT_IPOPT-$(CONFIG_IP_NF_MATCH_MAC) += $(P_V4)ipt_mac +IPT_IPOPT-$(CONFIG_NETFILTER_XT_MATCH_MAC) += $(P_XT)xt_mac +IPT_IPOPT-$(CONFIG_IP_NF_MATCH_MARK) += $(P_V4)ipt_mark +IPT_IPOPT-$(CONFIG_NETFILTER_XT_MATCH_MARK) += $(P_XT)xt_mark +IPT_IPOPT-$(CONFIG_IP_NF_TARGET_MARK) += $(P_V4)ipt_MARK +IPT_IPOPT-$(CONFIG_NETFILTER_XT_TARGET_MARK) += $(P_XT)xt_MARK +IPT_IPOPT-$(CONFIG_IP_NF_MATCH_TCPMSS) += $(P_V4)ipt_tcpmss +IPT_IPOPT-$(CONFIG_NETFILTER_XT_MATCH_TCPMSS) += $(P_XT)xt_tcpmss +IPT_IPOPT-$(CONFIG_IP_NF_TARGET_TCPMSS) += $(P_V4)ipt_TCPMSS +IPT_IPOPT-$(CONFIG_IP_NF_MATCH_TOS) += $(P_V4)ipt_tos +IPT_IPOPT-$(CONFIG_IP_NF_MATCH_TIME) += $(P_V4)ipt_time +IPT_IPOPT-$(CONFIG_IP_NF_TARGET_TOS) += $(P_V4)ipt_TOS +IPT_IPOPT-$(CONFIG_IP_NF_MATCH_TTL) += $(P_V4)ipt_ttl +IPT_IPOPT-$(CONFIG_IP_NF_TARGET_TTL) += $(P_V4)ipt_TTL +IPT_IPOPT-$(CONFIG_IP_NF_MATCH_UNCLEAN) += $(P_V4)ipt_unclean + +IPT_IPSEC-m := +IPT_IPSEC-$(CONFIG_IP_NF_MATCH_AH_ESP) += $(P_V4)ipt_ah $(P_V4)ipt_esp +IPT_IPSEC-$(CONFIG_IP_NF_MATCH_AH) += $(P_V4)ipt_ah +IPT_IPSEC-$(CONFIG_NETFILTER_XT_MATCH_ESP) += $(P_XT)xt_esp + +IPT_NAT-m := +ifneq ($(NF_KMOD),1) + IPT_NAT-$(CONFIG_IP_NF_NAT) += $(P_V4)ipt_SNAT $(P_V4)ipt_DNAT +endif +IPT_NAT-$(CONFIG_IP_NF_TARGET_MASQUERADE) += $(P_V4)ipt_MASQUERADE +IPT_NAT-$(CONFIG_IP_NF_TARGET_MIRROR) += $(P_V4)ipt_MIRROR +IPT_NAT-$(CONFIG_IP_NF_TARGET_REDIRECT) += $(P_V4)ipt_REDIRECT +IPT_NAT-$(CONFIG_IP_NF_TARGET_NETMAP) += $(P_V4)ipt_NETMAP + +IPT_NAT_EXTRA-m := +IPT_NAT_EXTRA-$(CONFIG_IP_NF_AMANDA) += $(P_V4)ip_conntrack_amanda +IPT_NAT_EXTRA-$(CONFIG_IP_NF_CT_PROTO_GRE) += $(P_V4)ip_conntrack_proto_gre +IPT_NAT_EXTRA-$(CONFIG_IP_NF_NAT_PROTO_GRE) += $(P_V4)ip_nat_proto_gre +IPT_NAT_EXTRA-$(CONFIG_IP_NF_H323) += $(P_V4)ip_conntrack_h323 +IPT_NAT_EXTRA-$(CONFIG_IP_NF_NAT_H323) += $(P_V4)ip_nat_h323 +IPT_NAT_EXTRA-$(CONFIG_IP_NF_MMS) += $(P_V4)ip_conntrack_mms +IPT_NAT_EXTRA-$(CONFIG_IP_NF_NAT_MMS) += $(P_V4)ip_nat_mms +IPT_NAT_EXTRA-$(CONFIG_IP_NF_RTSP) += $(P_V4)ip_conntrack_rtsp +IPT_NAT_EXTRA-$(CONFIG_IP_NF_NAT_RTSP) += $(P_V4)ip_nat_rtsp +IPT_NAT_EXTRA-$(CONFIG_IP_NF_PPTP) += $(P_V4)ip_conntrack_pptp +IPT_NAT_EXTRA-$(CONFIG_IP_NF_SIP) += $(P_V4)ip_conntrack_sip +IPT_NAT_EXTRA-$(CONFIG_IP_NF_NAT_PPTP) += $(P_V4)ip_nat_pptp +IPT_NAT_EXTRA-$(CONFIG_IP_NF_NAT_SIP) += $(P_V4)ip_nat_sip +IPT_NAT_EXTRA-$(CONFIG_IP_NF_NAT_SNMP_BASIC) += $(P_V4)ip_nat_snmp_basic +IPT_NAT_EXTRA-$(CONFIG_IP_NF_SIP) += $(P_V4)ip_conntrack_sip +IPT_NAT_EXTRA-$(CONFIG_IP_NF_NAT_SIP) += $(P_V4)ip_nat_sip +IPT_NAT_EXTRA-$(CONFIG_IP_NF_TFTP) += $(P_V4)ip_conntrack_tftp + +IPT_QUEUE-m := +IPT_QUEUE-$(CONFIG_IP_NF_QUEUE) += $(P_V4)ip_queue + +IPT_ULOG-m := +IPT_ULOG-$(CONFIG_IP_NF_TARGET_ULOG) += $(P_V4)ipt_ULOG + +IPT_BUILTIN := $(P_V4)ipt_standard +IPT_BUILTIN += $(P_V4)ipt_icmp $(P_V4)ipt_tcp $(P_V4)ipt_udp +IPT_BUILTIN += $(IPT_CONNTRACK-y) +IPT_BUILTIN += $(IPT_EXTRA-y) +IPT_BUILTIN += $(IPT_FILTER-y) +IPT_BUILTIN += $(IPT_IMQ-y) +IPT_BUILTIN += $(IPT_IPOPT-y) +IPT_BUILTIN += $(IPT_IPSEC-y) +IPT_BUILTIN += $(IPT_NAT-y) +IPT_BUILTIN += $(IPT_ULOG-y) diff --git a/include/package.mk b/include/package.mk new file mode 100644 index 0000000..5a9ba86 --- /dev/null +++ b/include/package.mk @@ -0,0 +1,372 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +ifneq ($(DUMP),) + all: dumpinfo +else + all: compile +endif + +include $(INCLUDE_DIR)/prereq.mk +include $(INCLUDE_DIR)/host.mk + +define shvar +V_$(subst .,_,$(subst -,_,$(subst /,_,$(1)))) +endef + +define shexport +$(call shvar,$(1))=$$(call $(1)) +export $(call shvar,$(1)) +endef + +define Build/DefaultTargets + ifeq ($(DUMP),) + ifeq ($(CONFIG_AUTOREBUILD),y) + _INFO:= + ifneq ($$(shell $(SCRIPT_DIR)/timestamp.pl -p $(PKG_BUILD_DIR) .),$(PKG_BUILD_DIR)) + _INFO+=$(subst $(TOPDIR)/,,$(PKG_BUILD_DIR)) + $(PKG_BUILD_DIR)/.prepared: package-clean + endif + endif + endif + + $(PKG_BUILD_DIR)/.prepared: + @-rm -rf $(PKG_BUILD_DIR) + @mkdir -p $(PKG_BUILD_DIR) + $(call Build/Prepare) + touch $$@ + + $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared + $(call Build/Configure) + touch $$@ + + $(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/.configured + $(call Build/Compile) + touch $$@ + + ifdef Build/InstallDev + ifneq ($$(shell $(SCRIPT_DIR)/timestamp.pl -p -x ipkg -x ipkg-install $(STAGING_DIR)/stampfiles/.$(PKG_NAME)-installed $(PKG_BUILD_DIR)),$(STAGING_DIR)/stampfiles/.$(PKG_NAME)-installed) + $(PKG_BUILD_DIR)/.built: package-rebuild + endif + + $(STAGING_DIR)/stampfiles/.$(PKG_NAME)-installed: $(PKG_BUILD_DIR)/.built + mkdir -p $(STAGING_DIR)/stampfiles + $(call Build/InstallDev) + touch $$@ + + compile-targets: $(STAGING_DIR)/stampfiles/.$(PKG_NAME)-installed + endif + + package-clean: FORCE + $(call Build/Clean) + $(call Build/UninstallDev) + -rm -f $(STAGING_DIR)/stampfiles/.$(PKG_NAME)-installed + + package-rebuild: FORCE + @-rm -f $(PKG_BUILD_DIR)/.built + + define Build/DefaultTargets + endef +endef + +define Package/Default + CONFIGFILE:= + SECTION:=opt + CATEGORY:=Extra packages + DEPENDS:= + EXTRA_DEPENDS:= + MAINTAINER:=OpenWrt Developers Team <openwrt-devel@openwrt.org> + SOURCE:=$(patsubst $(TOPDIR)/%,%,${shell pwd}) + ifneq ($(PKG_VERSION),) + ifneq ($(PKG_RELEASE),) + VERSION:=$(PKG_VERSION)-$(PKG_RELEASE) + else + VERSION:=$(PKG_VERSION) + endif + else + VERSION:=$(PKG_RELEASE) + endif + PKGARCH:=$(ARCH) + PRIORITY:=optional + DEFAULT:= + MENU:= + SUBMENU:= + SUBMENUDEP:= + TITLE:= + DESCRIPTION:= +endef + +define BuildDescription + ifneq ($(DESCRIPTION),) + DESCRIPTION:=$(TITLE)\\ $(DESCRIPTION) + else + DESCRIPTION:=$(TITLE) + endif +endef + +define BuildIPKGVariable + $(call shexport,Package/$(1)/$(2)) + $(1)_COMMANDS += var2file "$(call shvar,Package/$(1)/$(2))" $(2); +endef + +define BuildPackage + $(eval $(call Package/Default)) + $(eval $(call Package/$(1))) + $(eval $(call BuildDescription)) + + $(foreach FIELD, TITLE CATEGORY PRIORITY SECTION VERSION, + ifeq ($($(FIELD)),) + $$(error Package/$(1) is missing the $(FIELD) field) + endif + ) + + IPKG_$(1):=$(PACKAGE_DIR)/$(1)_$(VERSION)_$(PKGARCH).ipk + IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg/$(1) + INFO_$(1):=$(IPKG_STATE_DIR)/info/$(1).list + + ifdef Package/$(1)/install + ifeq ($(CONFIG_PACKAGE_$(1)),y) + install-targets: $$(INFO_$(1)) + endif + + ifneq ($(CONFIG_PACKAGE_$(1)),) + compile-targets: $$(IPKG_$(1)) + else + compile-targets: $(1)-disabled + $(1)-disabled: + @echo "WARNING: skipping $(1) -- package not selected" + endif + endif + + ifeq ($(FORCEREBUILD),y) + $$(IPKG_$(1)): FORCE + endif + + IDEPEND_$(1):=$$(strip $$(DEPENDS)) + + ifneq ($(DUMP),) + DUMPINFO += \ + echo "Package: $(1)"; + + ifneq ($(MENU),) + DUMPINFO += \ + echo "Menu: $(MENU)"; + endif + + ifneq ($(SUBMENU),) + DUMPINFO += \ + echo "Submenu: $(SUBMENU)"; + ifneq ($(SUBMENUDEP),) + DUMPINFO += \ + echo "Submenu-Depends: $(SUBMENUDEP)"; + endif + endif + + ifneq ($(DEFAULT),) + DUMPINFO += \ + echo "Default: $(DEFAULT)"; + endif + + $(call shexport,Package/$(1)/description) + + DUMPINFO += \ + if [ "$$$$PREREQ_CHECK" = 1 ]; then echo "Prereq-Check: 1"; fi; \ + echo "Version: $(VERSION)"; \ + echo "Depends: $$(IDEPEND_$(1))"; \ + echo "Build-Depends: $(PKG_BUILDDEP)"; \ + echo "Category: $(CATEGORY)"; \ + echo "Title: $(TITLE)"; \ + if isset $(call shvar,Package/$(1)/description); then \ + echo -n "Description: "; \ + getvar $(call shvar,Package/$(1)/description); \ + else \ + echo "Description: $(DESCRIPTION)" | sed -e 's,\\,\n,g'; \ + fi; + + ifneq ($(URL),) + DUMPINFO += \ + echo; \ + echo "$(URL)"; + endif + + DUMPINFO += \ + echo "@@"; + + $(call shexport,Package/$(1)/config) + DUMPINFO += \ + if isset $(call shvar,Package/$(1)/config); then echo "Config: "; getvar $(call shvar,Package/$(1)/config); fi; \ + echo "@@"; + + endif + + $(eval $(call BuildIPKGVariable,$(1),conffiles)) + $(eval $(call BuildIPKGVariable,$(1),preinst)) + $(eval $(call BuildIPKGVariable,$(1),postinst)) + $(eval $(call BuildIPKGVariable,$(1),prerm)) + $(eval $(call BuildIPKGVariable,$(1),postrm)) + $$(IDIR_$(1))/CONTROL/control: $(PKG_BUILD_DIR)/.version-$(1)_$(VERSION)_$(PKGARCH) + mkdir -p $$(IDIR_$(1))/CONTROL + echo "Package: $(1)" > $$(IDIR_$(1))/CONTROL/control + echo "Version: $(VERSION)" >> $$(IDIR_$(1))/CONTROL/control + ( \ + DEPENDS=; \ + for depend in $$(filter-out @%,$$(IDEPEND_$(1))); do \ + DEPENDS=$$$${DEPENDS:+$$$$DEPENDS, }$$$${depend##+}; \ + done; \ + echo "Depends: $(EXTRA_DEPENDS) $$$$DEPENDS" >> $$(IDIR_$(1))/CONTROL/control; \ + ) + echo "Source: $(SOURCE)" >> $$(IDIR_$(1))/CONTROL/control + echo "Section: $(SECTION)" >> $$(IDIR_$(1))/CONTROL/control + echo "Priority: $(PRIORITY)" >> $$(IDIR_$(1))/CONTROL/control + echo "Maintainer: $(MAINTAINER)" >> $$(IDIR_$(1))/CONTROL/control + echo "Architecture: $(PKGARCH)" >> $$(IDIR_$(1))/CONTROL/control + echo "Description: $(DESCRIPTION)" | sed -e 's,\\,\n,g' | sed -e 's,^[[:space:]]*$$$$, .,g' >> $$(IDIR_$(1))/CONTROL/control + chmod 644 $$(IDIR_$(1))/CONTROL/control + (cd $$(IDIR_$(1))/CONTROL; \ + $($(1)_COMMANDS) \ + ) + + $$(IPKG_$(1)): $(PKG_BUILD_DIR)/.built $$(IDIR_$(1))/CONTROL/control + $(call Package/$(1)/install,$$(IDIR_$(1))) + mkdir -p $(PACKAGE_DIR) + -find $$(IDIR_$(1)) -name CVS | xargs rm -rf + -find $$(IDIR_$(1)) -name .svn | xargs rm -rf + -find $$(IDIR_$(1)) -name '.#*' | xargs rm -f + $(RSTRIP) $$(IDIR_$(1)) + $(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR) + @[ -f $$(IPKG_$(1)) ] || false + + $$(INFO_$(1)): $$(IPKG_$(1)) + $(IPKG) install $$(IPKG_$(1)) + + $(1)-clean: + rm -f $(PACKAGE_DIR)/$(1)_* + + clean: $(1)-clean + + $(PKG_BUILD_DIR)/.version-$(1)_$(VERSION)_$(PKGARCH): $(PKG_BUILD_DIR)/.prepared + -@rm $(PKG_BUILD_DIR)/.version-$(1)_* 2>/dev/null + @touch $$@ + + $$(eval $$(call Build/DefaultTargets,$(1))) + + ifneq ($$(CONFIG_PACKAGE_$(1)),) + ifneq ($(MAKECMDGOALS),prereq) + ifneq ($(DUMP),1) + ifneq ($$(shell $(SCRIPT_DIR)/timestamp.pl -p -x ipkg -x ipkg-install '$$(IPKG_$(1))' '$(PKG_BUILD_DIR)'),$$(IPKG_$(1))) + _INFO+=$(subst $(TOPDIR)/,,$$(IPKG_$(1))) + $(PKG_BUILD_DIR)/.built: package-rebuild + endif + + ifneq ($$(_INFO),) + $$(info Rebuilding $$(_INFO)) + endif + endif + endif + endif +endef + +ifneq ($(strip $(PKG_CAT)),) + ifeq ($(PKG_CAT),unzip) + UNPACK=unzip -d $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_SOURCE) + else + UNPACK=$(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(PKG_BUILD_DIR)/.. $(TAR_OPTIONS) - + endif + define Build/Prepare/Default + $(UNPACK) + @if [ -d ./patches ]; then \ + $(PATCH) $(PKG_BUILD_DIR) ./patches; \ + fi + endef +endif + +define Build/Prepare + $(call Build/Prepare/Default,) +endef + +define Build/Configure/Default + (cd $(PKG_BUILD_DIR)/$(3); \ + if [ -x configure ]; then \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + CXXFLAGS="$(TARGET_CFLAGS)" \ + CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \ + LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \ + PKG_CONFIG_PATH="$(STAGING_DIR)/usr/lib/pkgconfig" \ + $(2) \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --program-prefix="" \ + --program-suffix="" \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + $(1); \ + fi; \ + ) +endef + +define Build/Configure + $(call Build/Configure/Default,) +endef + +define Build/Compile/Default + $(MAKE) -C $(PKG_BUILD_DIR) \ + $(TARGET_CONFIGURE_OPTS) \ + CROSS="$(TARGET_CROSS)" \ + EXTRA_CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include " \ + EXTRA_LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib " \ + ARCH="$(ARCH)" \ + $(1); +endef + +define Build/Compile + $(call Build/Compile/Default,) +endef + +ifneq ($(DUMP),) + dumpinfo: FORCE + @$(DUMPINFO) +else + $(PACKAGE_DIR): + mkdir -p $@ + + ifneq ($(strip $(PKG_SOURCE)),) + download: $(DL_DIR)/$(PKG_SOURCE) + + $(DL_DIR)/$(PKG_SOURCE): + mkdir -p $(DL_DIR) + $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL) + + $(PKG_BUILD_DIR)/.prepared: $(DL_DIR)/$(PKG_SOURCE) + endif + + download: + prepare: $(PKG_BUILD_DIR)/.prepared + configure: $(PKG_BUILD_DIR)/.configured + + compile-targets: + compile: compile-targets + + install-targets: + install: install-targets + + clean-targets: + clean: FORCE + @$(MAKE) clean-targets + $(call Build/Clean) + rm -rf $(PKG_BUILD_DIR) +endif diff --git a/include/prereq-build.mk b/include/prereq-build.mk new file mode 100644 index 0000000..d6396af --- /dev/null +++ b/include/prereq-build.mk @@ -0,0 +1,105 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk +TMP_DIR:=$(TOPDIR)/tmp +include $(INCLUDE_DIR)/prereq.mk +include $(INCLUDE_DIR)/host.mk + +define Require/non-root + [ "$$(shell whoami)" != "root" ] +endef +$(eval $(call Require,non-root, \ + Please do not compile as root. \ +)) + +# Required for the toolchain +define Require/working-make + echo 'all: test' > $(TMP_DIR)/check.mk + echo 'e0 = $$$$(foreach s,foobar,$$$$(eval $$$$s:))' >> $(TMP_DIR)/check.mk + echo 'e1 = $$$$(foreach s,foobar, $$$$(eval $$$$s:))' >> $(TMP_DIR)/check.mk + echo 'test: $$$$(strip $$$$(e0)) $$$$(strip $$$$(e1))' >> $(TMP_DIR)/check.mk + $(NO_TRACE_MAKE) -f $(TMP_DIR)/check.mk +endef + +$(eval $(call Require,working-make, \ + Please install GNU make v3.81 or later. (This version has bugs) \ +)) + +define Require/working-gcc + echo 'int main(int argc, char **argv) { return 0; }' | \ + gcc -x c -o $(TMP_DIR)/a.out - +endef + +$(eval $(call Require,working-gcc, \ + Please install the GNU C Compiler (gcc). \ +)) + +define Require/working-g++ + echo 'int main(int argc, char **argv) { return 0; }' | \ + g++ -x c++ -o $(TMP_DIR)/a.out -lstdc++ - +endef + +$(eval $(call Require,working-g++, \ + Please install the GNU C++ Compiler (g++). \ +)) + +define Require/ncurses + echo 'int main(int argc, char **argv) { initscr(); return 0; }' | \ + gcc -include ncurses.h -x c -o $(TMP_DIR)/a.out -lncurses - +endef + +$(eval $(call Require,ncurses, \ + Please install ncurses. (Missing libncurses.so or ncurses.h) \ +)) + + +define Require/zlib + echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \ + gcc -include zlib.h -x c -o $(TMP_DIR)/a.out -lz - +endef + +$(eval $(call Require,zlib, \ + Please install zlib. (Missing libz.so or zlib.h) \ +)) + + +$(eval $(call RequireCommand,bison, \ + Please install GNU bison. \ +)) + +$(eval $(call RequireCommand,flex, \ + Please install flex. \ +)) + +$(eval $(call RequireCommand,python, \ + Please install python. \ +)) + +$(eval $(call RequireCommand,unzip, \ + Please install unzip. \ +)) + +$(eval $(call RequireCommand,bzip2, \ + Please install bzip2. \ +)) + +$(eval $(call RequireCommand,patch, \ + Please install patch. \ +)) + +$(eval $(call RequireCommand,perl, \ + Please install perl. \ +)) + +define Require/gnutar + $(TAR) --version 2>&1 | grep GNU > /dev/null +endef + +$(eval $(call Require,gnutar, \ + Please install GNU tar. \ +)) diff --git a/include/prereq.mk b/include/prereq.mk new file mode 100644 index 0000000..eda7ca3 --- /dev/null +++ b/include/prereq.mk @@ -0,0 +1,54 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +$(TMP_DIR): + mkdir -p $@ + +prereq: + if [ -f $(TMP_DIR)/.prereq-error ]; then \ + echo; \ + cat $(TMP_DIR)/.prereq-error; \ + echo; \ + rm -rf $(TMP_DIR); \ + false; \ + fi + rm -rf $(TMP_DIR) + mkdir -p $(TMP_DIR) + +.SILENT: $(TMP_DIR) prereq + +define Require + export PREREQ_CHECK=1 + ifeq ($$(CHECK_$(1)),) + prereq: prereq-$(1) + + prereq-$(1): $(TMP_DIR) FORCE + echo -n "Checking '$(1)'... " + if $(NO_TRACE_MAKE) -f $(firstword $(MAKEFILE_LIST)) check-$(1) >/dev/null 2>/dev/null; then \ + echo 'ok.'; \ + else \ + echo 'failed.'; \ + echo -e "$(strip $(2))" >> $(TMP_DIR)/.prereq-error; \ + fi + + check-$(1): FORCE + $(call Require/$(1)) + CHECK_$(1):=1 + + .SILENT: prereq-$(1) check-$(1) + endif +endef + + +define RequireCommand + define Require/$(1) + which $(1) + endef + + $$(eval $$(call Require,$(1),$(2))) +endef + diff --git a/include/shell.sh b/include/shell.sh new file mode 100644 index 0000000..6ee0cf6 --- /dev/null +++ b/include/shell.sh @@ -0,0 +1,15 @@ +getvar() { + eval "echo \"\${$1}\"" +} + +var2file() { + local var + eval "var=\"\${$1}\"" + if [ -n "$var" ]; then echo "$var" > "$2"; fi +} + +isset() { + local var + eval "var=\"\${$1}\"" + [ -n "$var" ] +} diff --git a/include/target.mk b/include/target.mk new file mode 100644 index 0000000..6c21f51 --- /dev/null +++ b/include/target.mk @@ -0,0 +1,31 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +define kernel_template +ifeq ($(CONFIG_LINUX_$(3)),y) +KERNEL:=$(1) +BOARD:=$(2) +endif +endef + +$(eval $(call kernel_template,2.4,brcm,2_4_BRCM)) +$(eval $(call kernel_template,2.4,ar7,2_4_AR7)) +$(eval $(call kernel_template,2.6,brcm,2_6_BRCM)) +$(eval $(call kernel_template,2.6,brcm63xx,2_6_BRCM63XX)) +$(eval $(call kernel_template,2.6,rb532,2_6_RB532)) +$(eval $(call kernel_template,2.6,x86,2_6_X86)) +$(eval $(call kernel_template,2.6,uml,2_6_UML)) +$(eval $(call kernel_template,2.4,ar531x,2_4_AR531X)) +$(eval $(call kernel_template,2.6,aruba,2_6_ARUBA)) +$(eval $(call kernel_template,2.6,au1000,2_6_AU1000)) +$(eval $(call kernel_template,2.6,xscale,2_6_XSCALE)) +$(eval $(call kernel_template,2.6,magicbox,2_6_MAGICBOX)) +$(eval $(call kernel_template,2.6,sibyte,2_6_SIBYTE)) + +export BOARD +export KERNEL + + diff --git a/include/verbose.mk b/include/verbose.mk new file mode 100644 index 0000000..34568a3 --- /dev/null +++ b/include/verbose.mk @@ -0,0 +1,43 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id:$ + +ifeq ($(NO_TRACE_MAKE),) +NO_TRACE_MAKE := $(MAKE) V=99 +export NO_TRACE_MAKE +endif + +ifndef KBUILD_VERBOSE + KBUILD_VERBOSE:=0 +endif +ifeq ("$(origin V)", "command line") + KBUILD_VERBOSE:=$(V) +endif + +ifneq ($(shell tty -s <&3 || echo x),x) + _Y:="\\33[33m"# yellow + _N:="\\33[m"# normal +endif + +ifneq ($(KBUILD_VERBOSE),99) + ifeq ($(QUIET),1) + $(MAKECMDGOALS): trace + trace: FORCE + @[ -f "$(MAKECMDGOALS)" ] || { \ + [ -z "$${PWD##$$TOPDIR}" ] || DIR=" -C $${PWD##$$TOPDIR/}"; \ + echo -e "$(_Y)make[$$(($(MAKELEVEL)+1))]$$DIR $(MAKECMDGOALS)$(_N)" >&3; \ + } + else + export QUIET:=1 + ifeq ($(KBUILD_VERBOSE),0) + MAKE:=&>/dev/null $(MAKE) + endif + MAKE:=cmd() { $(MAKE) $$* || { echo "Build failed. Please re-run make with V=99 to see what's going on"; false; } } 3>&1 4>&2; cmd + endif + + .SILENT: $(MAKECMDGOALS) +endif |