aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile16
-rw-r--r--include/host-build.mk36
-rw-r--r--include/image.mk24
-rw-r--r--include/kernel-build.mk2
-rw-r--r--include/kernel-defaults.mk4
-rw-r--r--include/kernel.mk6
-rw-r--r--include/package.mk1
-rw-r--r--include/subdir.mk2
-rw-r--r--include/toplevel.mk5
-rw-r--r--package/Makefile16
-rw-r--r--package/base-files/Makefile24
-rw-r--r--package/bridge/Makefile1
-rw-r--r--rules.mk64
-rw-r--r--target/linux/adm5120-2.6/image/Makefile12
-rw-r--r--target/linux/adm5120eb-2.6/image/Makefile6
-rw-r--r--target/linux/amazon-2.6/image/Makefile2
-rw-r--r--target/linux/ar7-2.6/image/Makefile6
-rw-r--r--target/linux/at91-2.6/image/Makefile2
-rw-r--r--target/linux/atheros-2.6/image/Makefile2
-rw-r--r--target/linux/au1000-2.6/image/Makefile2
-rw-r--r--target/linux/brcm-2.4/image/Makefile10
-rw-r--r--target/linux/brcm63xx-2.6/image/Makefile4
-rw-r--r--target/linux/rb532-2.6/image/Makefile8
-rw-r--r--target/linux/rdc-2.6/image/Makefile2
-rw-r--r--target/linux/x86-2.6/image/Makefile9
-rw-r--r--target/linux/x86-2.6/image/grub/Makefile3
-rw-r--r--toolchain/Makefile15
-rw-r--r--toolchain/binutils/Makefile14
-rw-r--r--toolchain/gcc/Makefile67
-rw-r--r--toolchain/gdb/Makefile15
-rw-r--r--toolchain/info.mk4
-rw-r--r--toolchain/kernel-headers/Makefile39
-rw-r--r--toolchain/uClibc/Makefile73
-rw-r--r--tools/Makefile22
-rw-r--r--tools/ccache/Makefile4
-rw-r--r--tools/ext2fs/Makefile9
-rw-r--r--tools/firmware-utils/Makefile7
-rw-r--r--tools/ipkg-utils/Makefile15
-rw-r--r--tools/lzma/Makefile18
-rw-r--r--tools/mkimage/Makefile12
-rw-r--r--tools/mtd-utils/Makefile11
-rw-r--r--tools/patch-cmdline/Makefile15
-rw-r--r--tools/sed/Makefile27
-rw-r--r--tools/squashfs/Makefile11
-rw-r--r--tools/sstrip/Makefile14
45 files changed, 316 insertions, 345 deletions
diff --git a/Makefile b/Makefile
index e035faac25..840c28ff61 100644
--- a/Makefile
+++ b/Makefile
@@ -25,25 +25,27 @@ else
include rules.mk
include $(INCLUDE_DIR)/depends.mk
include $(INCLUDE_DIR)/subdir.mk
- include $(INCLUDE_DIR)/target.mk
include target/Makefile
include package/Makefile
include tools/Makefile
include toolchain/Makefile
$(toolchain/stamp-compile): $(tools/stamp-compile)
-$(target/stamp-compile): $(toolchain/stamp-install) $(tools/stamp-install)
+$(target/stamp-compile): $(toolchain/stamp-install) $(tools/stamp-install) $(BUILD_DIR)/.prepared
$(package/stamp-compile): $(target/stamp-compile)
$(target/stamp-install): $(package/stamp-compile) $(package/stamp-install)
+$(BUILD_DIR)/.prepared: Makefile
+ @mkdir -p $$(dirname $@)
+ @touch $@
+
clean: FORCE
- rm -rf build_* bin tmp
+ rm -rf $(BUILD_DIR) $(BIN_DIR)
+ $(MAKE) target/linux/clean
+ rm -rf $(TMP_DIR)
dirclean: clean
- rm -rf staging_dir_* toolchain_build_* tool_build
-
-distclean: dirclean
- rm -rf dl .config*
+ rm -rf $(STAGING_DIR) $(STAGING_DIR_HOST) $(STAGING_DIR_TOOLCHAIN) $(BUILD_DIR_TOOLCHAIN) $(BUILD_DIR_HOST)
# check prerequisites before starting to build
prereq: $(package/stamp-prereq) $(target/stamp-prereq) ;
diff --git a/include/host-build.mk b/include/host-build.mk
index f4b6b449e1..47ec9b0d3a 100644
--- a/include/host-build.mk
+++ b/include/host-build.mk
@@ -5,6 +5,9 @@
# See /LICENSE for more information.
#
+PKG_BUILD_DIR ?= $(BUILD_DIR_HOST)/$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION))
+PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/host-install
+
include $(INCLUDE_DIR)/host.mk
include $(INCLUDE_DIR)/unpack.mk
include $(INCLUDE_DIR)/depends.mk
@@ -12,6 +15,8 @@ include $(INCLUDE_DIR)/depends.mk
STAMP_PREPARED:=$(PKG_BUILD_DIR)/.prepared_$(shell find ${CURDIR} $(PKG_FILE_DEPEND) $(DEP_FINDPARAMS) | md5s)
STAMP_CONFIGURED:=$(PKG_BUILD_DIR)/.configured
STAMP_BUILT:=$(PKG_BUILD_DIR)/.built
+STAMP_INSTALLED:=$(STAGING_DIR_HOST)/stamp/.$(PKG_NAME)_installed
+
override MAKEFLAGS=
include $(INCLUDE_DIR)/quilt.mk
@@ -33,24 +38,19 @@ define Build/Configure/Default
[ -x configure ] && \
$(CP) $(SCRIPT_DIR)/config.{guess,sub} $(PKG_BUILD_DIR)/$(3)/ && \
$(2) \
- CPPFLAGS="-I$(STAGING_DIR)/host/include" \
- LDFLAGS="-L$(STAGING_DIR)/host/lib" \
+ CPPFLAGS="$(HOST_CFLAGS)" \
+ LDFLAGS="$(HOST_LDFLAGS)" \
+ SHELL="$(BASH)" \
./configure \
- --target=$(GNU_TARGET_NAME) \
- --host=$(GNU_TARGET_NAME) \
+ --target=$(GNU_HOST_NAME) \
+ --host=$(GNU_HOST_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 \
+ --prefix=$(STAGING_DIR_HOST) \
+ --exec-prefix=$(STAGING_DIR_HOST) \
+ --sysconfdir=$(STAGING_DIR_HOST)/etc \
+ --localstatedir=$(STAGING_DIR_HOST)/var \
$(DISABLE_NLS) \
$(1); \
true; \
@@ -84,7 +84,7 @@ ifneq ($(if $(QUILT),,$(CONFIG_AUTOREBUILD)),)
define HostBuild/Autoclean
$(PKG_BUILD_DIR)/.dep_files: $(STAMP_PREPARED)
$(call rdep,${CURDIR} $(PKG_FILE_DEPEND),$(STAMP_PREPARED))
- $(if $(filter prepare,$(MAKECMDGOALS)),,$(call rdep,$(PKG_BUILD_DIR),$(STAMP_BUILT),$(PKG_BUILD_DIR)/.dep_files, -and -not -path "/.*" -and -not -path "*/ipkg*"))
+ $(if $(if $(Build/Compile),$(filter prepare,$(MAKECMDGOALS)),1),,$(call rdep,$(PKG_BUILD_DIR),$(STAMP_BUILT),$(PKG_BUILD_DIR)/.dep_files, -and -not -path "/.*" -and -not -path "*/ipkg*"))
endef
endif
@@ -107,19 +107,19 @@ define HostBuild
$(call Build/Compile)
touch $$@
- $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed: $(STAMP_BUILT)
+ $(STAMP_INSTALLED): $(STAMP_BUILT)
$(call Build/Install)
mkdir -p $$(shell dirname $$@)
touch $$@
ifdef Build/Install
- install: $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed
+ install: $(STAMP_INSTALLED)
endif
package-clean: FORCE
$(call Build/Clean)
$(call Build/Uninstall)
- rm -f $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed
+ rm -f $(STAMP_INSTALLED) $(STAMP_BUILT)
download:
prepare: $(STAMP_PREPARED)
diff --git a/include/image.mk b/include/image.mk
index b094428770..fa08372007 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/host.mk
override MAKEFLAGS=
override MAKE:=$(SUBMAKE)
-KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)
+KDIR=$(KERNEL_BUILD_DIR)
ifneq ($(CONFIG_BIG_ENDIAN),y)
JFFS2OPTS := --pad --little-endian --squash
@@ -40,27 +40,27 @@ ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
ifeq ($(CONFIG_TARGET_ROOTFS_JFFS2),y)
define Image/mkfs/jffs2/sub
# FIXME: removing this line will cause strange behaviour in the foreach loop below
- $(STAGING_DIR)/bin/mkfs.jffs2 $(JFFS2OPTS) -e $(patsubst %k,%KiB,$(1)) -o $(KDIR)/root.jffs2-$(1) -d $(BUILD_DIR)/root
+ $(STAGING_DIR_HOST)/bin/mkfs.jffs2 $(JFFS2OPTS) -e $(patsubst %k,%KiB,$(1)) -o $(KDIR)/root.jffs2-$(1) -d $(TARGET_DIR)
$(call add_jffs2_mark,$(KDIR)/root.jffs2-$(1))
$(call Image/Build,jffs2-$(1))
endef
define Image/mkfs/jffs2
- rm -rf $(BUILD_DIR)/root/jffs
+ rm -rf $(TARGET_DIR)/jffs
$(foreach SZ,$(JFFS2_BLOCKSIZE),$(call Image/mkfs/jffs2/sub,$(SZ)))
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)
+ @mkdir -p $(TARGET_DIR)/jffs
+ $(STAGING_DIR_HOST)/bin/mksquashfs-lzma $(TARGET_DIR) $(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/ .
+ $(TAR) -zcf $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-rootfs.tgz --owner=root --group=root -C $(TARGET_DIR)/ .
endef
endif
else
@@ -75,18 +75,18 @@ ifeq ($(CONFIG_TARGET_ROOTFS_EXT2FS),y)
E2SIZE=$(shell echo $$(($(CONFIG_TARGET_ROOTFS_FSPART)*1024)))
define Image/mkfs/ext2
- $(STAGING_DIR)/bin/genext2fs -U -b $(E2SIZE) -I $(CONFIG_TARGET_ROOTFS_MAXINODE) -d $(BUILD_DIR)/root/ $(KDIR)/root.ext2
+ $(STAGING_DIR_HOST)/bin/genext2fs -U -b $(E2SIZE) -I $(CONFIG_TARGET_ROOTFS_MAXINODE) -d $(TARGET_DIR)/ $(KDIR)/root.ext2
$(call Image/Build,ext2)
endef
endif
define Image/mkfs/prepare/default
- find $(BUILD_DIR)/root -type f -not -perm +0100 -not -name 'ssh_host*' | $(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
+ find $(TARGET_DIR) -type f -not -perm +0100 -not -name 'ssh_host*' | $(XARGS) chmod 0644
+ find $(TARGET_DIR) -type f -perm +0100 | $(XARGS) chmod 0755
+ find $(TARGET_DIR) -type d | $(XARGS) chmod 0755
+ $(INSTALL_DIR) $(TARGET_DIR)/tmp
+ chmod 0777 $(TARGET_DIR)/tmp
endef
define Image/mkfs/prepare
diff --git a/include/kernel-build.mk b/include/kernel-build.mk
index da1fe39bca..8750bb4fd5 100644
--- a/include/kernel-build.mk
+++ b/include/kernel-build.mk
@@ -167,6 +167,8 @@ $(eval $(call shexport,Target/Description))
download: $(DL_DIR)/$(LINUX_SOURCE)
prepare: $(STAMP_CONFIGURED)
compile: $(LINUX_DIR)/.modules
+ $(MAKE) -C image compile
+
oldconfig menuconfig: $(STAMP_PREPARED) FORCE
$(call Kernel/Configure)
$(SCRIPT_DIR)/config.pl '+' $(GENERIC_LINUX_CONFIG) $(LINUX_CONFIG) > $(LINUX_DIR)/.config
diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
index 5bbff3eeb6..3916483adf 100644
--- a/include/kernel-defaults.mk
+++ b/include/kernel-defaults.mk
@@ -67,7 +67,7 @@ ifeq ($(KERNEL),2.6)
define Kernel/SetInitramfs
mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old
grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config
- echo 'CONFIG_INITRAMFS_SOURCE="../../root"' >> $(LINUX_DIR)/.config
+ echo 'CONFIG_INITRAMFS_SOURCE="$(TARGET_DIR)"' >> $(LINUX_DIR)/.config
echo 'CONFIG_INITRAMFS_ROOT_UID=0' >> $(LINUX_DIR)/.config
echo 'CONFIG_INITRAMFS_ROOT_GID=0' >> $(LINUX_DIR)/.config
endef
@@ -75,7 +75,7 @@ ifeq ($(KERNEL),2.6)
define Kernel/SetInitramfs
mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old
grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config
- rm -f $(BUILD_DIR)/root/init
+ rm -f $(TARGET_DIR)/init
echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config
endef
endif
diff --git a/include/kernel.mk b/include/kernel.mk
index 3fa576efdc..df859a42b0 100644
--- a/include/kernel.mk
+++ b/include/kernel.mk
@@ -30,9 +30,9 @@ else
KERNEL_PATCHVER:=$(shell echo $(LINUX_VERSION) | cut -d. -f1,2,3 | cut -d- -f1)
PLATFORM_DIR := $(TOPDIR)/target/linux/$(BOARD)-$(KERNEL)
- PATCH_DIR := ./patches$(shell [ -d "./patches-$(KERNEL_PATCHVER)" ] && printf -- "-$(KERNEL_PATCHVER)" || true )
- KERNEL_BUILD_DIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)
- LINUX_DIR := $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)
+ PATCH_DIR ?= ./patches$(shell [ -d "./patches-$(KERNEL_PATCHVER)" ] && printf -- "-$(KERNEL_PATCHVER)" || true )
+ KERNEL_BUILD_DIR ?= $(BUILD_DIR_BASE)/linux-$(KERNEL)-$(BOARD)$(if $(BUILD_SUFFIX),_$(BUILD_SUFFIX))
+ LINUX_DIR ?= $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)
MODULES_SUBDIR:=lib/modules/$(LINUX_VERSION)
TARGET_MODULES_DIR := $(LINUX_TARGET_DIR)/$(MODULES_SUBDIR)
diff --git a/include/package.mk b/include/package.mk
index 153b138034..4ef3489294 100644
--- a/include/package.mk
+++ b/include/package.mk
@@ -9,6 +9,7 @@ all: $(if $(DUMP),dumpinfo,compile)
PKG_BUILD_DIR ?= $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install
+PKG_MD5SUM ?= unknown
include $(INCLUDE_DIR)/prereq.mk
include $(INCLUDE_DIR)/host.mk
diff --git a/include/subdir.mk b/include/subdir.mk
index e985c30ff0..28b01b6370 100644
--- a/include/subdir.mk
+++ b/include/subdir.mk
@@ -37,7 +37,7 @@ endef
# Parameters: <subdir> <name> <target>
define stampfile
$(1)/stamp-$(3):=$(STAGING_DIR)/stampfiles/.$(2)_$(3)
- $(if __rdep_$(1),,
+ $(if $(__rdep_$(1)),,
$(call rdep,$(1),$$($(1)/stamp-$(3)),)
__rdep_$(1):=1
)
diff --git a/include/toplevel.mk b/include/toplevel.mk
index af4b390e4e..e456264221 100644
--- a/include/toplevel.mk
+++ b/include/toplevel.mk
@@ -94,7 +94,7 @@ download: .config FORCE
$(MAKE) -j1 package/download
$(MAKE) -j1 target/download
-clean dirclean distclean:
+clean dirclean:
@$(MAKE) $@
prereq:: .config
@@ -118,6 +118,9 @@ symlinkclean:
-find package -type l | xargs rm -f
rm -rf tmp
+distclean:
+ rm -rf tmp build_dir staging_dir dl .config*
+
ifeq ($(findstring v,$(DEBUG)),)
.SILENT: symlinkclean clean dirclean distclean config-clean download help tmpinfo-clean .config scripts/config/mconf scripts/config/conf menuconfig tmp/.prereq-build tmp/.prereq-package tmp/.prereq-target prepare-tmpinfo
endif
diff --git a/package/Makefile b/package/Makefile
index 9b400ffeff..38b650c09a 100644
--- a/package/Makefile
+++ b/package/Makefile
@@ -17,23 +17,23 @@ $(curdir)/builddirs-install:=. $(sort $(package-y))
$(curdir)/install:=$(curdir)/install-cleanup
$(curdir)/cleanup: $(TMP_DIR)/.build
- rm -rf $(BUILD_DIR)/root
+ rm -rf $(TARGET_DIR)
$(curdir)/rootfs-prepare: $(TMP_DIR)/.build
@if [ -d $(TOPDIR)/files ]; then \
- $(CP) $(TOPDIR)/files/. $(BUILD_DIR)/root; \
+ $(CP) $(TOPDIR)/files/. $(TARGET_DIR); \
fi
- @mkdir -p $(BUILD_DIR)/root/etc/rc.d
+ @mkdir -p $(TARGET_DIR)/etc/rc.d
@( \
- cd $(BUILD_DIR)/root; \
+ cd $(TARGET_DIR); \
for script in ./etc/init.d/*; do \
grep '#!/bin/sh /etc/rc.common' $$script >/dev/null || continue; \
- IPKG_INSTROOT=$(BUILD_DIR)/root $(which bash) ./etc/rc.common $$script enable; \
+ IPKG_INSTROOT=$(TARGET_DIR) $(which bash) ./etc/rc.common $$script enable; \
done || true \
)
- @-find $(BUILD_DIR)/root -name CVS | $(XARGS) rm -rf
- @-find $(BUILD_DIR)/root -name .svn | $(XARGS) rm -rf
- @-find $(BUILD_DIR)/root -name '.#*' | $(XARGS) rm -f
+ @-find $(TARGET_DIR) -name CVS | $(XARGS) rm -rf
+ @-find $(TARGET_DIR) -name .svn | $(XARGS) rm -rf
+ @-find $(TARGET_DIR) -name '.#*' | $(XARGS) rm -f
$(curdir)/index: FORCE
@(cd $(PACKAGE_DIR); $(SCRIPT_DIR)/ipkg-make-index.sh . > Packages)
diff --git a/package/base-files/Makefile b/package/base-files/Makefile
index 1c6cc05782..c5dd05e404 100644
--- a/package/base-files/Makefile
+++ b/package/base-files/Makefile
@@ -23,9 +23,7 @@ include $(INCLUDE_DIR)/package.mk
ifneq ($(DUMP),1)
TARGET:=-$(BOARD)-$(KERNEL)
- UCLIBC_VERSION:=${shell cat $(STAGING_DIR)/uclibc_version 2>/dev/null}
- UCLIBC_EXTRA_VERSION:=${shell cat $(STAGING_DIR)/uclibc_extra_version 2>/dev/null}
- LIBGCC_VERSION:=${shell cat $(STAGING_DIR)/gcc_version 2>/dev/null}
+ LIBGCC_VERSION:=$(GCC_VERSION)
else
UCLIBC_VERSION:=<UCLIBC_VERSION>
LIBGCC_VERSION:=<LIBGCC_VERSION>
@@ -92,7 +90,7 @@ define Package/uclibc/Default
CATEGORY:=Base system
DEPENDS:=@!NATIVE_TOOLCHAIN
URL:=http://uclibc.org/
- VERSION:=$(UCLIBC_VERSION)-$(PKG_RELEASE)
+ VERSION:=$(UCLIBC_VERSION)$(UCLIBC_PATCHVER)-$(PKG_RELEASE)
endef
define Package/libpthread
@@ -158,43 +156,43 @@ endef
define Package/libgcc/install
$(INSTALL_DIR) $(1)/lib
- $(CP) $(STAGING_DIR)/lib/libgcc_s.so.* $(1)/lib/
+ $(CP) $(TOOLCHAIN_DIR)/lib/libgcc_s.so.* $(1)/lib/
endef
ifeq ($(word 1,$(subst ., ,$(LIBGCC_VERSION))),4)
define Package/libssp/install
$(INSTALL_DIR) $(1)/lib
- $(CP) $(STAGING_DIR)/lib/libssp.so.* $(1)/lib/
+ $(CP) $(TOOLCHAIN_DIR)/lib/libssp.so.* $(1)/lib/
endef
endif
define Package/libstdcpp/install
$(INSTALL_DIR) $(1)/lib
- $(CP) $(STAGING_DIR)/lib/libstdc++.so.* $(1)/lib/
+ $(CP) $(TOOLCHAIN_DIR)/lib/libstdc++.so.* $(1)/lib/
endef
define Package/libpthread/install
$(INSTALL_DIR) $(1)/lib
- $(CP) $(STAGING_DIR)/lib/libpthread.so.* $(1)/lib/
- $(CP) $(STAGING_DIR)/lib/libpthread-$(UCLIBC_VERSION).so $(1)/lib/
+ $(CP) $(TOOLCHAIN_DIR)/lib/libpthread.so.* $(1)/lib/
+ $(CP) $(TOOLCHAIN_DIR)/lib/libpthread-$(UCLIBC_VERSION).so $(1)/lib/
endef
define Package/uclibc/install
$(INSTALL_DIR) $(1)/lib
for file in ld-uClibc libc libcrypt libdl libm libnsl libresolv librt libuClibc libutil; do \
- $(CP) $(STAGING_DIR)/lib/$$$$file.so.* $(1)/lib/; \
- $(CP) $(STAGING_DIR)/lib/$$$$file-$(UCLIBC_VERSION).so $(1)/lib/; \
+ $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file.so.* $(1)/lib/; \
+ $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file-$(UCLIBC_VERSION).so $(1)/lib/; \
done
endef
define Package/ldd/install
$(INSTALL_DIR) $(1)/bin/
- $(CP) $(TOOLCHAIN_BUILD_DIR)/uClibc-$(UCLIBC_EXTRA_VERSION)/utils/ldd $(1)/bin/
+ $(CP) $(TOOLCHAIN_DIR)/utils/ldd $(1)/bin/
endef
define Package/ldconfig/install
$(INSTALL_DIR) $(1)/bin/
- $(CP) $(TOOLCHAIN_BUILD_DIR)/uClibc-$(UCLIBC_EXTRA_VERSION)/utils/ldconfig $(1)/bin/
+ $(CP) $(TOOLCHAIN_DIR)/utils/ldconfig $(1)/bin/
endef
ifneq ($(DUMP),1)
diff --git a/package/bridge/Makefile b/package/bridge/Makefile
index 04deb87a23..3ea92117e5 100644
--- a/package/bridge/Makefile
+++ b/package/bridge/Makefile
@@ -18,6 +18,7 @@ PKG_MD5SUM:=9b7dc52656f5cbec846a7ba3299f73bd
PKG_BUILD_DIR:=$(BUILD_DIR)/bridge-utils-$(PKG_VERSION)
+include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
define Package/bridge
diff --git a/rules.mk b/rules.mk
index 2437e93a1c..a27d3b1d42 100644
--- a/rules.mk
+++ b/rules.mk
@@ -10,55 +10,63 @@ ifeq ($(DUMP),)
endif
include $(TOPDIR)/include/verbose.mk
+TMP_DIR:=$(TOPDIR)/tmp
+
+include $(TOPDIR)/include/target.mk
+
export SHELL=/usr/bin/env bash -c '. $(TOPDIR)/include/shell.sh; eval "$$2"' --
-ARCH:=$(strip $(subst ",, $(CONFIG_ARCH)))
-TARGET_OPTIMIZATION:=$(strip $(subst ",, $(CONFIG_TARGET_OPTIMIZATION)))
-BUILD_DIR_SUFFIX:=$(strip $(subst ",, $(CONFIG_BUILD_SUFFIX)))
-WGET:=$(strip $(subst ",, $(CONFIG_WGET)))
-#"))"))")) # fix vim's broken syntax highlighting
+define qstrip
+$(strip $(subst ",,$(1)))
+endef
+#"))
-OPTIMIZE_FOR_CPU:=$(ARCH)
+ARCH:=$(call qstrip,$(CONFIG_ARCH))
+TARGET_OPTIMIZATION:=$(call qstrip,$(CONFIG_TARGET_OPTIMIZATION))
+BUILD_SUFFIX:=$(call qstrip,$(CONFIG_BUILD_SUFFIX))
+GCCV:=$(call qstrip,$(CONFIG_GCC_VERSION))
-# DIRECTORIES #
+OPTIMIZE_FOR_CPU:=$(ARCH)
DL_DIR:=$(TOPDIR)/dl
+BIN_DIR:=$(TOPDIR)/bin
INCLUDE_DIR:=$(TOPDIR)/include
SCRIPT_DIR:=$(TOPDIR)/scripts
-TOOL_BUILD_DIR:=$(TOPDIR)/tool_build
-TOOLCHAIN_BUILD_DIR:=$(TOPDIR)/toolchain_build_$(ARCH)
-STAGING_DIR:=$(TOPDIR)/staging_dir_$(ARCH)
-BIN_DIR:=$(TOPDIR)/bin
-PACKAGE_DIR:=$(BIN_DIR)/packages
-IPKG_TARGET_DIR:=$(PACKAGE_DIR)
-BUILD_DIR:=$(TOPDIR)/build_$(ARCH)$(BUILD_DIR_SUFFIX)
-TMP_DIR:=$(TOPDIR)/tmp
+BUILD_DIR_BASE:=$(TOPDIR)/build_dir
+BUILD_DIR:=$(BUILD_DIR_BASE)/$(ARCH)$(if $(BUILD_SUFFIX),_$(BUILD_SUFFIX))
+BUILD_DIR_HOST:=$(BUILD_DIR_BASE)/host
+BUILD_DIR_TOOLCHAIN:=$(BUILD_DIR_BASE)/toolchain-$(ARCH)
+STAGING_DIR:=$(TOPDIR)/staging_dir/$(ARCH)
+STAGING_DIR_HOST:=$(TOPDIR)/staging_dir/host
+TOOLCHAIN_DIR:=$(TOPDIR)/staging_dir/toolchain-$(ARCH)_gcc$(GCCV)
+PACKAGE_DIR:=$(BIN_DIR)/packages/$(TARGET)
STAMP_DIR:=$(BUILD_DIR)/stamp
-TARGET_DIR:=$(BUILD_DIR)/root
+STAMP_DIR_HOST=$(BUILD_DIR_HOST)/stamp
+TARGET_DIR:=$(BUILD_DIR)/root-$(BOARD)
IPKG_STATE_DIR:=$(TARGET_DIR)/usr/lib/ipkg
ifeq ($(CONFIG_NATIVE_TOOLCHAIN),)
+ -include $(TOOLCHAIN_DIR)/info.mk
REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux-uclibc
GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux
- TARGET_CROSS:=$(OPTIMIZE_FOR_CPU)-linux-uclibc-
+ TARGET_CROSS?=$(OPTIMIZE_FOR_CPU)-linux-uclibc-
endif
-IMAGE:=$(BUILD_DIR)/root_fs_$(ARCH)
-
-TARGET_PATH:=$(STAGING_DIR)/usr/sbin:$(STAGING_DIR)/usr/bin:$(STAGING_DIR)/bin:$(PATH)
+TARGET_PATH:=$(TOOLCHAIN_DIR)/bin:$(STAGING_DIR_HOST)/bin:$(PATH)
TARGET_CFLAGS:=$(TARGET_OPTIMIZATION) -fhonour-copts
export PATH:=$(TARGET_PATH)
-LINUX_DIR:=$(BUILD_DIR)/linux
-LINUX_HEADERS_DIR:=$(TOOLCHAIN_BUILD_DIR)/linux
+LINUX_HEADERS_DIR:=$(BUILD_DIR_TOOLCHAIN)/linux
-# APPLICATIONS #
HOSTCC:=gcc
+HOST_CFLAGS:=-O2 -I$(STAGING_DIR_HOST)/include
+HOST_LDFLAGS:=-L$(STAGING_DIR_HOST)/lib
+
TARGET_CC:=$(TARGET_CROSS)gcc
-STRIP:=$(STAGING_DIR)/bin/sstrip
+STRIP:=$(STAGING_DIR_HOST)/bin/sstrip
PATCH:=$(SCRIPT_DIR)/patch-kernel.sh
-SED:=$(STAGING_DIR)/bin/sed -i -e
+SED:=$(STAGING_DIR_HOST)/bin/sed -i -e
CP:=cp -fpR
INSTALL_BIN:=install -m0755
@@ -99,11 +107,11 @@ RSTRIP:= \
# where to build (and put) .ipk packages
IPKG:= \
- PATH="$(STAGING_DIR)/bin:$(PATH)" \
- IPKG_TMP=$(BUILD_DIR)/tmp \
+ PATH="$(STAGING_DIR_HOST)/bin:$(PATH)" \
+ IPKG_TMP=$(TMP_DIR)/ipkg \
IPKG_INSTROOT=$(TARGET_DIR) \
IPKG_CONF_DIR=$(STAGING_DIR)/etc \
- IPKG_OFFLINE_ROOT=$(BUILD_DIR)/root \
+ IPKG_OFFLINE_ROOT=$(TARGET_DIR) \
$(SCRIPT_DIR)/ipkg -force-defaults -force-depends
# invoke ipkg-build with some default options
diff --git a/target/linux/adm5120-2.6/image/Makefile b/target/linux/adm5120-2.6/image/Makefile
index 802fd956af..8e36d45df3 100644
--- a/target/linux/adm5120-2.6/image/Makefile
+++ b/target/linux/adm5120-2.6/image/Makefile
@@ -22,7 +22,7 @@ define Build/Clean
endef
define Image/Prepare
- cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
+ cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
endef
define trxalign/jffs2-128k
@@ -36,12 +36,12 @@ define trxalign/squashfs
endef
define Image/Build/TRX
- $(STAGING_DIR)/bin/trx -o $(1) -f $(3) -f $(KDIR)/vmlinux.lzma \
+ $(STAGING_DIR_HOST)/bin/trx -o $(1) -f $(3) -f $(KDIR)/vmlinux.lzma \
$(call trxalign/$(2)) -f $(KDIR)/root.$(2)
endef
define Image/Build/TRXNoloader
- $(STAGING_DIR)/bin/trx -o $(1) -f $(KDIR)/vmlinux.lzma \
+ $(STAGING_DIR_HOST)/bin/trx -o $(1) -f $(KDIR)/vmlinux.lzma \
$(call trxalign/$(2)) -f $(KDIR)/root.$(2)
endef
@@ -53,7 +53,7 @@ endef
define Image/Build/Edimax
$(call Image/Build/Loader,$(2),gz,0x80500000,0x6D8,y,$(2))
$(call Image/Build/TRXNoloader,$(IMGNAME)-$(3)-$(2).trx,$(1))
- $(STAGING_DIR)/bin/mkcsysimg -B $(4) -d -w \
+ $(STAGING_DIR_HOST)/bin/mkcsysimg -B $(4) -d -w \
-r $(KDIR)/loader-$(2).gz \
-x $(IMGNAME)-$(3)-$(2).trx \
$(IMGNAME)-$(3)-$(2).bin
@@ -69,7 +69,7 @@ endef
define Image/Build/MyLoader
$(call Image/Build/Loader,$(2),gz,0x80500000,0)
$(call Image/Build/TRXNoloader,$(IMGNAME)-$(3)-$(2).trx,$(1))
- $(STAGING_DIR)/bin/mkmylofw -B $(4) \
+ $(STAGING_DIR_HOST)/bin/mkmylofw -B $(4) \
-p0x20000:0x10000:ahp:0x80001000 \
-p0x30000:0 \
-b0x20000:0x10000:h:$(KDIR)/loader-$(2).gz \
@@ -83,7 +83,7 @@ endef
define Image/Build/RouterBoard
$(CP) $(KDIR)/vmlinux.elf $(IMGNAME)-rb1xx-vmlinux
- $(STAGING_DIR)/bin/patch-cmdline $(KDIR)/vmlinux.elf '$(strip $(call Image/cmdline/yaffs2)) '
+ $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux.elf '$(strip $(call Image/cmdline/yaffs2)) '
endef
define Image/Build/jffs2-64k
diff --git a/target/linux/adm5120eb-2.6/image/Makefile b/target/linux/adm5120eb-2.6/image/Makefile
index 7644a07ada..f47b3ab0b8 100644
--- a/target/linux/adm5120eb-2.6/image/Makefile
+++ b/target/linux/adm5120eb-2.6/image/Makefile
@@ -22,7 +22,7 @@ define Build/Clean
endef
define Image/Prepare
- cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
+ cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
endef
define trxalign/jffs2-128k
@@ -36,12 +36,12 @@ define trxalign/squashfs
endef
define Image/Build/TRX
- $(STAGING_DIR)/bin/trx -o $(1) -f $(3) -f $(KDIR)/vmlinux.lzma \
+ $(STAGING_DIR_HOST)/bin/trx -o $(1) -f $(3) -f $(KDIR)/vmlinux.lzma \
$(call trxalign/$(2)) -f $(KDIR)/root.$(2)
endef
define Image/Build/TRXNoloader
- $(STAGING_DIR)/bin/trx -o $(1) -f $(KDIR)/vmlinux.lzma \
+ $(STAGING_DIR_HOST)/bin/trx -o $(1) -f $(KDIR)/vmlinux.lzma \
$(call trxalign/$(2)) -f $(KDIR)/root.$(2)
endef
diff --git a/target/linux/amazon-2.6/image/Makefile b/target/linux/amazon-2.6/image/Makefile
index c749560db9..29935f9241 100644
--- a/target/linux/amazon-2.6/image/Makefile
+++ b/target/linux/amazon-2.6/image/Makefile
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk
define Image/BuildKernel
- $(STAGING_DIR)/bin/lzma e $(KDIR)/vmlinux $(KDIR)/vmlinux.lzma
+ $(STAGING_DIR_HOST)/bin/lzma e $(KDIR)/vmlinux $(KDIR)/vmlinux.lzma
mkimage -A mips -O linux -T kernel -C lzma -a 0x80002000 -e \
0x80002000 \
-n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
diff --git a/target/linux/ar7-2.6/image/Makefile b/target/linux/ar7-2.6/image/Makefile
index 148b1bc42a..33324cd365 100644
--- a/target/linux/ar7-2.6/image/Makefile
+++ b/target/linux/ar7-2.6/image/Makefile
@@ -33,7 +33,7 @@ define Build/Clean
endef
define Image/Prepare
- cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
+ cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
$(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader \
$(LOADER_MAKEOPTS) \
@@ -52,13 +52,13 @@ endef
define Image/Build/CyberTAN
(dd if=/dev/zero bs=16 count=1; cat $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).bin) | \
- $(STAGING_DIR)/bin/addpattern -p $(3) -o $(BIN_DIR)/openwrt-$(2)-$(KERNEL)-$(4).bin
+ $(STAGING_DIR_HOST)/bin/addpattern -p $(3) -o $(BIN_DIR)/openwrt-$(2)-$(KERNEL)-$(4).bin
endef
#define Image/Build/sErCoMm
# cat sercomm/adam2.bin "$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).bin" > "$(KDIR)/dgfw.tmp"
# dd if=sercomm/$(2) of="$(KDIR)/dgfw.tmp" bs=$$$$((0x3e0000 - 80)) seek=1 conv=notrunc
-# $(STAGING_DIR)/bin/dgfirmware -f -w "$(BIN_DIR)/openwrt-$(2)-$(KERNEL)-$(3).img" "$(KDIR)/dgfw.tmp"
+# $(STAGING_DIR_HOST)/bin/dgfirmware -f -w "$(BIN_DIR)/openwrt-$(2)-$(KERNEL)-$(3).img" "$(KDIR)/dgfw.tmp"
# rm -f "$(KDIR)/dgfw.tmp"
#endef
diff --git a/target/linux/at91-2.6/image/Makefile b/target/linux/at91-2.6/image/Makefile
index f0b9dc507d..7e855f06ef 100644
--- a/target/linux/at91-2.6/image/Makefile
+++ b/target/linux/at91-2.6/image/Makefile
@@ -37,7 +37,7 @@ define Image/Build
dd if=$(KDIR)/uImage of=$(KDIR)/uImage.block bs=8448 conv=sync
dd if=$(KDIR)/root.squashfs of=$(KDIR)/root.block bs=8448 conv=sync
cat $(KDIR)/uImage.block $(KDIR)/root.block > $(KDIR)/knlroot.bin
- $(STAGING_DIR)/bin/trx -o $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL).trx -f $(KDIR)/dfboot.bin -f$(KDIR)/u-boot.full -f$(KDIR)/knlroot.bin
+ $(STAGING_DIR_HOST)/bin/trx -o $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL).trx -f $(KDIR)/dfboot.bin -f$(KDIR)/u-boot.full -f$(KDIR)/knlroot.bin
cp $(KDIR)/dfbptest.bin $(BIN_DIR)
$(call Image/Build/$(1),$(1))
endef
diff --git a/target/linux/atheros-2.6/image/Makefile b/target/linux/atheros-2.6/image/Makefile
index 1d32a4bd46..5cfa774041 100644
--- a/target/linux/atheros-2.6/image/Makefile
+++ b/target/linux/atheros-2.6/image/Makefile
@@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/image.mk
define Image/BuildKernel
cp $(KDIR)/vmlinux.elf $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinux.elf
gzip -9 -c $(KDIR)/vmlinux > $(KDIR)/vmlinux.bin.gz
- $(STAGING_DIR)/bin/lzma e $(KDIR)/vmlinux $(KDIR)/vmlinux.bin.l7
+ $(STAGING_DIR_HOST)/bin/lzma e $(KDIR)/vmlinux $(KDIR)/vmlinux.bin.l7
dd if=$(KDIR)/vmlinux.bin.l7 of=$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinux.lzma bs=65536 conv=sync
dd if=$(KDIR)/vmlinux.bin.gz of=$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinux.gz bs=65536 conv=sync
endef
diff --git a/target/linux/au1000-2.6/image/Makefile b/target/linux/au1000-2.6/image/Makefile
index 5b8c3cc0f0..1d4aa47070 100644
--- a/target/linux/au1000-2.6/image/Makefile
+++ b/target/linux/au1000-2.6/image/Makefile
@@ -29,7 +29,7 @@ OBJCOPY_SREC := $(TARGET_CROSS)objcopy -S -O srec $(addprefix --remove-section=,
OBJCOPY_BIN := $(TARGET_CROSS)objcopy -S -O binary $(addprefix --remove-section=,$(DROP_SECTIONS))
define Image/Prepare
- cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
+ cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
# Build RAM image
$(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader \
diff --git a/target/linux/brcm-2.4/image/Makefile b/target/linux/brcm-2.4/image/Makefile
index e2282a54ef..960f5fa24c 100644
--- a/target/linux/brcm-2.4/image/Makefile
+++ b/target/linux/brcm-2.4/image/Makefile
@@ -12,7 +12,7 @@ define Build/Clean
endef
define Image/Prepare
- cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
+ cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
rm -f $(KDIR)/loader.gz
$(MAKE) -C lzma-loader \
BUILD_DIR="$(KDIR)" \
@@ -32,15 +32,15 @@ ifneq ($(KERNEL),2.4)
endif
define Image/Build/CyberTAN
- $(STAGING_DIR)/bin/addpattern -4 -p $(3) -v v$(4) -i $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx -o $(BIN_DIR)/openwrt-$(2)-$(KERNEL)-$(5).bin
+ $(STAGING_DIR_HOST)/bin/addpattern -4 -p $(3) -v v$(4) -i $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx -o $(BIN_DIR)/openwrt-$(2)-$(KERNEL)-$(5).bin
endef
define Image/Build/Motorola
- $(STAGING_DIR)/bin/motorola-bin -$(3) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx $(BIN_DIR)/openwrt-$(2)-$(4).bin
+ $(STAGING_DIR_HOST)/bin/motorola-bin -$(3) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx $(BIN_DIR)/openwrt-$(2)-$(4).bin
endef
define Image/Build/USR
- $(STAGING_DIR)/bin/trx2usr $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx $(BIN_DIR)/openwrt-$(2)-$(3).bin
+ $(STAGING_DIR_HOST)/bin/trx2usr $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx $(BIN_DIR)/openwrt-$(2)-$(3).bin
endef
define trxalign/jffs2-128k
@@ -78,7 +78,7 @@ define Image/Build/squashfs
endef
define Image/Build
- $(STAGING_DIR)/bin/trx -o $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx -f $(KDIR)/loader.gz -f $(KDIR)/vmlinux.lzma $(call trxalign/$(1),$(1))
+ $(STAGING_DIR_HOST)/bin/trx -o $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx -f $(KDIR)/loader.gz -f $(KDIR)/vmlinux.lzma $(call trxalign/$(1),$(1))
$(call Image/Build/$(1),$(1))
$(call Image/Build/Motorola,$(1),wr850g,1,$(1))
$(call Image/Build/USR,$(1),usr5461,$(1))
diff --git a/target/linux/brcm63xx-2.6/image/Makefile b/target/linux/brcm63xx-2.6/image/Makefile
index d930af8501..fa1ccf7659 100644
--- a/target/linux/brcm63xx-2.6/image/Makefile
+++ b/target/linux/brcm63xx-2.6/image/Makefile
@@ -32,7 +32,7 @@ define Build/Clean
endef
define Image/Prepare
- cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
+ cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
rm -f $(KDIR)/loader.gz
$(MAKE) -C lzma-loader \
BUILD_DIR="$(KDIR)" \
@@ -42,7 +42,7 @@ define Image/Prepare
endef
define Image/Build
- $(STAGING_DIR)/bin/trx -o $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx -f $(KDIR)/loader.gz -f $(KDIR)/vmlinux.lzma $(call trxalign/$(1)) -f $(KDIR)/root.$(1)
+ $(STAGING_DIR_HOST)/bin/trx -o $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx -f $(KDIR)/loader.gz -f $(KDIR)/vmlinux.lzma $(call trxalign/$(1)) -f $(KDIR)/root.$(1)
endef
$(eval $(call BuildImage))
diff --git a/target/linux/rb532-2.6/image/Makefile b/target/linux/rb532-2.6/image/Makefile
index 3cdba39432..92984d1b74 100644
--- a/target/linux/rb532-2.6/image/Makefile
+++ b/target/linux/rb532-2.6/image/Makefile
@@ -25,7 +25,7 @@ define Build/Clean
endef
define Image/Prepare
- cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
+ cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
$(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean compile
endef
@@ -54,14 +54,14 @@ root=/dev/mtdblock1 rootfstype=yaffs2 init=/etc/preinit
endef
define Image/Build
- $(STAGING_DIR)/bin/patch-cmdline $(KDIR)/vmlinux.elf '$(strip $(call Image/cmdline/$(1))) '
+ $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux.elf '$(strip $(call Image/cmdline/$(1))) '
./gen_image.sh $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).bin 4 $(KDIR)/vmlinux.elf $(CONFIG_TARGET_ROOTFS_FSPART) $(KDIR)/root.$(1)
endef
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
define Image/Prepare
- $(STAGING_DIR)/bin/patch-cmdline $(KDIR)/vmlinux '$(strip $(call Image/cmdline/yaffs2)) '
- cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
+ $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux '$(strip $(call Image/cmdline/yaffs2)) '
+ cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
$(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean compile
endef
define Image/BuildKernel
diff --git a/target/linux/rdc-2.6/image/Makefile b/target/linux/rdc-2.6/image/Makefile
index 7f28507e7f..0d53b26d0c 100644
--- a/target/linux/rdc-2.6/image/Makefile
+++ b/target/linux/rdc-2.6/image/Makefile
@@ -26,7 +26,7 @@ define Image/Build/ar525w
mv $(KDIR)/root.$(1) $(KDIR)/root.tmp
dd of=$(KDIR)/root.$(1) if=$(KDIR)/root.tmp $(call trxalign/$(1)) conv=sync
rm -f $(KDIR)/root.tmp
- $(STAGING_DIR)/bin/airlink -b 1 -j $(shell bash -c 'echo $$[$(3)]') $(KDIR)/bzImage $(KDIR)/root.$(1) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1)-$(2).img
+ $(STAGING_DIR_HOST)/bin/airlink -b 1 -j $(shell bash -c 'echo $$[$(3)]') $(KDIR)/bzImage $(KDIR)/root.$(1) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1)-$(2).img
endef
define Image/Build/wl153
diff --git a/target/linux/x86-2.6/image/Makefile b/target/linux/x86-2.6/image/Makefile
index 7c98ea8e4c..f19e6b3f38 100644
--- a/target/linux/x86-2.6/image/Makefile
+++ b/target/linux/x86-2.6/image/Makefile
@@ -49,7 +49,7 @@ ifeq ($(CONFIG_X86_GRUB_IMAGES),y)
-e 's#@CMDLINE@#$(strip $(call Image/cmdline/$(1))) $(BOOTOPTS)#g' \
-e 's#@BAUDRATE@#$(CONFIG_X86_GRUB_BAUDRATE)#g' \
./grub/menu.lst > $(KDIR)/root.grub/boot/grub/menu.lst
- PADDING="$(CONFIG_X86_GRUB_IMAGES_PAD)" PATH="$(STAGING_DIR)/usr/sbin:$(STAGING_DIR)/bin:$(PATH)" ./gen_image.sh $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).image $(CONFIG_X86_GRUB_KERNELPART) $(KDIR)/root.grub $(CONFIG_TARGET_ROOTFS_FSPART) $(KDIR)/root.$(1)
+ PADDING="$(CONFIG_X86_GRUB_IMAGES_PAD)" PATH="$(TARGET_PATH)" ./gen_image.sh $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).image $(CONFIG_X86_GRUB_KERNELPART) $(KDIR)/root.grub $(CONFIG_TARGET_ROOTFS_FSPART) $(KDIR)/root.$(1)
$(call Image/Build/grub/$(1))
endef
endif
@@ -58,11 +58,10 @@ ifeq ($(CONFIG_X86_GRUB_IMAGES),y)
define Image/Prepare/grub
# for the image builder
$(CP) \
- $(STAGING_DIR)/usr/lib/grub/i386-pc/stage1 \
- $(STAGING_DIR)/usr/lib/grub/i386-pc/stage2 \
- $(STAGING_DIR)/usr/lib/grub/i386-pc/e2fs_stage1_5 \
+ $(STAGING_DIR_HOST)/usr/lib/grub/i386-pc/stage1 \
+ $(STAGING_DIR_HOST)/usr/lib/grub/i386-pc/stage2 \
+ $(STAGING_DIR_HOST)/usr/lib/grub/i386-pc/e2fs_stage1_5 \
$(KDIR)/
- $(CP) $(STAGING_DIR)/usr/sbin/grub $(STAGING_DIR)/bin
endef
endif
diff --git a/target/linux/x86-2.6/image/grub/Makefile b/target/linux/x86-2.6/image/grub/Makefile
index d37803012c..dae74e9dc2 100644
--- a/target/linux/x86-2.6/image/grub/Makefile
+++ b/target/linux/x86-2.6/image/grub/Makefile
@@ -65,8 +65,9 @@ endef
define Build/InstallDev
$(MAKE) -C $(PKG_BUILD_DIR) \
- DESTDIR="$(STAGING_DIR)" \
+ DESTDIR="$(STAGING_DIR_HOST)" \
install
+ mv $(STAGING_DIR_HOST)/usr/sbin/grub $(STAGING_DIR_HOST)/bin
endef
$(eval $(call Build/DefaultTargets))
diff --git a/toolchain/Makefile b/toolchain/Makefile
index b11653190e..80bdf485df 100644
--- a/toolchain/Makefile
+++ b/toolchain/Makefile
@@ -19,12 +19,23 @@ ifeq ($(CONFIG_NATIVE_TOOLCHAIN),)
$(curdir)/binutils/prepare:=$(curdir)/uClibc/prepare
$(curdir)/gcc/prepare:=$(curdir)/binutils/install
$(curdir)/uClibc/compile:=$(curdir)/gcc/compile
+ $(curdir)/gcc/install:=$(curdir)/uClibc/compile
+ $(curdir)/uClibc/install:=$(curdir)/gcc/install
endif
-$(curdir)/gcc/install:=$(curdir)/uClibc/install
+
+$(TOOLCHAIN_DIR)/info.mk: .config
+ @for dir in $(TOOLCHAIN_DIR); do ( \
+ set -x; \
+ mkdir -p "$$dir"; \
+ cd "$$dir"; \
+ mkdir -p bin lib include stamp; \
+ ); done
+ @grep GCC_VERSION $@ >/dev/null 2>&1 || $(INSTALL_DATA) $(TOPDIR)/toolchain/info.mk $@
+ @touch $@
# prerequisites for the individual targets
$(curdir)/ := .config prereq
-$(curdir)//prepare = $(STAGING_DIR)/include-host/.done
+$(curdir)//prepare = $(STAGING_DIR)/.prepared $(TOOLCHAIN_DIR)/info.mk
$(curdir)//compile = $(1)/prepare
$(curdir)//install = $(1)/compile
diff --git a/toolchain/binutils/Makefile b/toolchain/binutils/Makefile
index 902dae85a3..b3a68893b5 100644
--- a/toolchain/binutils/Makefile
+++ b/toolchain/binutils/Makefile
@@ -7,7 +7,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=binutils
-PKG_VERSION:=$(strip $(subst ",, $(CONFIG_BINUTILS_VERSION)))#"))
+PKG_VERSION:=$(strip $(subst ",, $(CONFIG_BINUTILS_VERSION)))
+#"))
PKG_SOURCE_URL:=http://ftp.gnu.org/gnu/binutils/ \
ftp://gatekeeper.dec.com/pub/GNU/ \
@@ -17,17 +18,16 @@ PKG_SOURCE_URL:=http://ftp.gnu.org/gnu/binutils/ \
ftp://ftp.leo.org/pub/comp/os/unix/gnu/
PKG_SOURCE:=binutils-$(PKG_VERSION).tar.bz2
-PKG_MD5SUM:=unknown
-PKG_BUILD_DIR:=$(TOOLCHAIN_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
-PKG_CAT:=bzcat
PATCH_DIR:=./patches/$(PKG_VERSION)
+STAGING_DIR_HOST:=$(TOOLCHAIN_DIR)
+BUILD_DIR_HOST:=$(BUILD_DIR_TOOLCHAIN)
include $(INCLUDE_DIR)/host-build.mk
define Build/Configure
(cd $(PKG_BUILD_DIR); \
./configure \
- --prefix=$(STAGING_DIR) \
+ --prefix=$(STAGING_DIR_HOST) \
--build=$(GNU_HOST_NAME) \
--host=$(GNU_HOST_NAME) \
--target=$(REAL_GNU_TARGET_NAME) \
@@ -37,11 +37,11 @@ define Build/Configure
endef
define Build/Compile
- $(MAKE) -C $(PKG_BUILD_DIR) -j $(CONFIG_JLEVEL) all
+ $(MAKE) -C $(PKG_BUILD_DIR) all
endef
define Build/Install
- $(MAKE) -C $(PKG_BUILD_DIR) -j $(CONFIG_JLEVEL) install
+ $(MAKE) -C $(PKG_BUILD_DIR) install
endef
$(eval $(call HostBuild))
diff --git a/toolchain/gcc/Makefile b/toolchain/gcc/Makefile
index 795ff3ee72..cd18098e9f 100644
--- a/toolchain/gcc/Makefile
+++ b/toolchain/gcc/Makefile
@@ -27,39 +27,33 @@ PATCH_DIR=./patches/$(PKG_VERSION)
PKG_SOURCE_URL:=ftp://ftp.fu-berlin.de/unix/languages/gcc/releases/gcc-$(PKG_VERSION) \
http://mirrors.rcn.net/pub/sourceware/gcc/releases/gcc-$(PKG_VERSION) \
ftp://ftp.gnu.org/gnu/gcc/releases/gcc-$(PKG_VERSION)
-
PKG_SOURCE:=gcc-$(PKG_VERSION).tar.bz2
-PKG_MD5SUM:=unknown
-PKG_CAT:=bzcat
-
-PKG_BUILD_DIR:=$(TOOLCHAIN_BUILD_DIR)/gcc-$(PKG_VERSION)
-
-TARGET_LANGUAGES:=c
-ifeq ($(CONFIG_INSTALL_LIBSTDCPP),y)
-TARGET_LANGUAGES:=$(TARGET_LANGUAGES),c++
-endif
-ifeq ($(CONFIG_INSTALL_LIBGCJ),y)
-TARGET_LANGUAGES:=$(TARGET_LANGUAGES),java
-endif
+STAGING_DIR_HOST:=$(TOOLCHAIN_DIR)
+BUILD_DIR_HOST:=$(BUILD_DIR_TOOLCHAIN)
include $(INCLUDE_DIR)/host-build.mk
-STAMP_BUILT:=$(STAGING_DIR)/stampfiles/.host_gcc-initial_installed
-BUILD_DIR1:=$(TOOLCHAIN_BUILD_DIR)/gcc-$(PKG_VERSION)-initial
-BUILD_DIR2:=$(TOOLCHAIN_BUILD_DIR)/gcc-$(PKG_VERSION)-final
+STAMP_BUILT:=$(TOOLCHAIN_DIR)/stamp/.gcc-initial_installed
+BUILD_DIR1:=$(BUILD_DIR_HOST)/gcc-$(PKG_VERSION)-initial
+BUILD_DIR2:=$(BUILD_DIR_HOST)/gcc-$(PKG_VERSION)-final
+
+SEP:=,
+TARGET_LANGUAGES:="c$(if $(CONFIG_INSTALL_LIBSTDCPP),$(SEP)c++)$(if $(CONFIG_INSTALL_LIBGCJ),$(SEP)java)"
define Stage1/Configure
+ $(SED) 's,TARGET_CROSS=.*,TARGET_CROSS=$(REAL_GNU_TARGET_NAME)-,' $(TOOLCHAIN_DIR)/info.mk
+ $(SED) 's,GCC_VERSION=.*,GCC_VERSION=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
mkdir -p $(BUILD_DIR1)
(cd $(BUILD_DIR1); rm -f config.cache; \
SHELL="$(BASH)" \
$(PKG_BUILD_DIR)/configure \
- --prefix=$(STAGING_DIR) \
+ --prefix=$(TOOLCHAIN_DIR) \
--build=$(GNU_HOST_NAME) \
--host=$(GNU_HOST_NAME) \
--target=$(REAL_GNU_TARGET_NAME) \
--enable-languages=c \
--disable-shared \
- --with-sysroot=$(TOOLCHAIN_BUILD_DIR)/uClibc_dev/ \
+ --with-sysroot=$(BUILD_DIR_HOST)/uClibc_dev/ \
--disable-__cxa_atexit \
--enable-target-optspace \
--with-gnu-ld \
@@ -77,14 +71,14 @@ endef
define Stage2/Configure
mkdir -p $(BUILD_DIR2)
# Important! Required for limits.h to be fixed.
- rm -rf $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include
- ln -sf ../include $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include
- rm -rf $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib
- ln -sf ../lib $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib
+ rm -rf $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include
+ ln -sf ../include $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include
+ rm -rf $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/lib
+ ln -sf ../lib $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/lib
(cd $(BUILD_DIR2); rm -f config.cache; \
SHELL="$(BASH)" \
$(PKG_BUILD_DIR)/configure \
- --prefix=$(STAGING_DIR) \
+ --prefix=$(TOOLCHAIN_DIR) \
--build=$(GNU_HOST_NAME) \
--host=$(GNU_HOST_NAME) \
--target=$(REAL_GNU_TARGET_NAME) \
@@ -97,15 +91,20 @@ define Stage2/Configure
--disable-libmudflap \
);
endef
+
define Stage2/Compile
- export SHELL="$(BASH)"; $(MAKE) -C $(BUILD_DIR2) all
+ $(MAKE) -C $(BUILD_DIR2) \
+ SHELL="$(BASH)" \
+ all
endef
+
define Stage2/Install
- export SHELL="$(BASH)"; $(MAKE) -C $(BUILD_DIR2) install
- echo $(PKG_VERSION) > $(STAGING_DIR)/gcc_version
+ $(MAKE) -C $(BUILD_DIR2) \
+ SHELL="$(BASH)" \
+ install
# Set up the symlinks to enable lying about target name.
set -e; \
- (cd $(STAGING_DIR); \
+ (cd $(TOOLCHAIN_DIR); \
ln -sf $(REAL_GNU_TARGET_NAME) $(GNU_TARGET_NAME); \
cd bin; \
for app in $(REAL_GNU_TARGET_NAME)-* ; do \
@@ -129,7 +128,7 @@ endef
define Build/Compile
$(call Stage1/Compile)
- $(call Stage1/Install)
+ $(if $(wildcard $(TOOLCHAIN_DIR)/bin/$(GNU_TARGET_NAME)-gcc),,$(call Stage1/Install))
endef
define Build/Install
@@ -139,11 +138,13 @@ define Build/Install
endef
define Build/Clean
- rm -rf $(PKG_BUILD_DIR)
- rm -rf $(BUILD_DIR1)
- rm -rf $(BUILD_DIR2)
- rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gc*
- rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-c*
+ rm -rf \
+ $(PKG_BUILD_DIR) \
+ $(BUILD_DIR1) \
+ $(BUILD_DIR2) \
+ $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME) \
+ $(TOOLCHAIN_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gc* \
+ $(TOOLCHAIN_DIR)/bin/$(REAL_GNU_TARGET_NAME)-c*
endef
$(eval $(call HostBuild))
diff --git a/toolchain/gdb/Makefile b/toolchain/gdb/Makefile
index 34dca715a7..40fc2789b6 100644
--- a/toolchain/gdb/Makefile
+++ b/toolchain/gdb/Makefile
@@ -14,7 +14,8 @@ PKG_MD5SUM:=05b928f41fa5b482e49ca2c24762a0ae
PKG_SOURCE_URL:=http://ftp.gnu.org/gnu/gdb
PKG_CAT:=bzcat
-PKG_BUILD_DIR:=$(TOOLCHAIN_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+STAGING_DIR_HOST:=$(TOOLCHAIN_DIR)
+BUILD_DIR_HOST:=$(BUILD_DIR_TOOLCHAIN)
include $(INCLUDE_DIR)/host-build.mk
@@ -22,7 +23,7 @@ define Build/Configure
(cd $(PKG_BUILD_DIR); \
gdb_cv_func_sigsetjmp=yes \
$(PKG_BUILD_DIR)/configure \
- --prefix=$(STAGING_DIR) \
+ --prefix=$(TOOLCHAIN_DIR) \
--build=$(GNU_HOST_NAME) \
--host=$(GNU_HOST_NAME) \
--target=$(REAL_GNU_TARGET_NAME) \
@@ -40,16 +41,14 @@ define Build/Compile
endef
define Build/Install
- (cd $(STAGING_DIR)/bin; \
- install -c $(PKG_BUILD_DIR)/gdb/gdb $(TARGET_CROSS)gdb; \
- ln -fs $(TARGET_CROSS)gdb $(GNU_TARGET_NAME)-gdb; \
- );
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/gdb/gdb $(TARGET_CROSS)gdb
+ ln -fs $(TARGET_CROSS)gdb $(TOOLCHAIN_DIR)/$(GNU_TARGET_NAME)-gdb; \
endef
define Build/Clean
rm -rf $(PKG_BUILD_DIR)
- rm -f $(STAGING_DIR)/bin/$(TARGET_CROSS)gdb
- rm -f $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-gdb
+ rm -f $(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)gdb
+ rm -f $(TOOLCHAIN_DIR)/bin/$(GNU_TARGET_NAME)-gdb
endef
$(eval $(call HostBuild))
diff --git a/toolchain/info.mk b/toolchain/info.mk
new file mode 100644
index 0000000000..0675493f77
--- /dev/null
+++ b/toolchain/info.mk
@@ -0,0 +1,4 @@
+TARGET_CROSS=
+GCC_VERSION=unknown
+UCLIBC_VERSION=unknown
+UCLIBC_PATCHVER=
diff --git a/toolchain/kernel-headers/Makefile b/toolchain/kernel-headers/Makefile
index d51f91d3a8..68fa1bc4e8 100644
--- a/toolchain/kernel-headers/Makefile
+++ b/toolchain/kernel-headers/Makefile
@@ -5,33 +5,32 @@
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-PKG_NAME=kernel-headers
-PKG_VERSION=$(LINUX_VERSION)
-PKG_SOURCE=$(LINUX_SOURCE)
-PKG_SOURCE_URL=$(LINUX_SITE)
+PKG_NAME:=linux
+PKG_VERSION:=$(LINUX_VERSION)
+PKG_SOURCE:=$(LINUX_SOURCE)
+PKG_SOURCE_URL:=$(LINUX_SITE)
-PKG_BUILD_DIR:=$(TOOLCHAIN_BUILD_DIR)/linux-$(PKG_VERSION)
+KERNEL_BUILD_DIR := $(BUILD_DIR_TOOLCHAIN)
+PKG_BUILD_DIR := $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)
+LINUX_DIR := $(PKG_BUILD_DIR)
+BUILD_DIR := $(KERNEL_BUILD_DIR)
-LINUX_DIR:=$(PKG_BUILD_DIR)
-KERNEL_BUILD_DIR:=$(TOOLCHAIN_BUILD_DIR)
+STAGING_DIR_HOST:=$(TOOLCHAIN_DIR)
+BUILD_DIR_HOST:=$(BUILD_DIR_TOOLCHAIN)
override QUILT:=
+include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/kernel-defaults.mk
-
define Build/Prepare/cris
- mkdir -p $(TOOLCHAIN_BUILD_DIR)
+ mkdir -p $(BUILD_DIR_TOOLCHAIN)
bzcat $(DL_DIR)/$(PKG_SOURCE) | $(HOST_TAR) -C $(TOOLCHAIN_BUILD_DIR) $(TAR_OPTIONS)
$(PATCH) $(PKG_BUILD_DIR) $(TOPDIR)/target/linux/etrax-2.6/patches/generic_2.6
$(PATCH) $(PKG_BUILD_DIR) $(TOPDIR)/target/linux/etrax-2.6/patches/cris
- ln -sf $(PKG_BUILD_DIR)/include/asm-cris/arch-v10 $(PKG_BUILD_DIR)/include/asm-cris/arch
- ln -sf $(PKG_BUILD_DIR)/arch/cris/arch-v10 $(PKG_BUILD_DIR)/arch/cris/arch
- $(SED) 's/@expr length/@-expr length/' $(PKG_BUILD_DIR)/Makefile
- ln -sf $(PKG_BUILD_DIR) $(LINUX_HEADERS_DIR)
+ ln -sf arch-v10 $(PKG_BUILD_DIR)/include/asm-cris/arch
+ ln -sf arch-v10 $(PKG_BUILD_DIR)/arch/cris/arch
endef
define Build/Configure/powerpc
@@ -48,14 +47,10 @@ KMAKE := $(MAKE) -C $(PKG_BUILD_DIR) \
ARCH=$(LINUX_KARCH) \
CONFIG_SHELL=$(BASH)
-define Build/Prepare/Default
- $(call Kernel/Prepare/Default)
- $(SED) 's/@expr length/@-expr length/' $(PKG_BUILD_DIR)/Makefile
- ln -sf $(PKG_BUILD_DIR) $(LINUX_HEADERS_DIR)
-endef
-
define Build/Prepare
- $(if $(Build/Prepare/$(ARCH)),$(Build/Prepare/$(ARCH)),$(Build/Prepare/Default))
+ $(if $(Build/Prepare/$(ARCH)),$(Build/Prepare/$(ARCH)),$(call Kernel/Prepare/Default))
+ $(SED) 's/@expr length/@-expr length/' $(PKG_BUILD_DIR)/Makefile
+ ln -sf linux-$(LINUX_VERSION) $(LINUX_HEADERS_DIR)
yes '' | $(KMAKE) oldconfig
$(KMAKE) include/linux/version.h include/asm
$(call Build/Configure/$(ARCH))
diff --git a/toolchain/uClibc/Makefile b/toolchain/uClibc/Makefile
index 576fa6e0de..d117cbd890 100644
--- a/toolchain/uClibc/Makefile
+++ b/toolchain/uClibc/Makefile
@@ -16,10 +16,15 @@ PKG_SOURCE_URL:=http://www.uclibc.org/downloads
PKG_MD5SUM:=959f25286e317f0d9e2103445c5a14c2
PKG_CAT:=bzcat
-PKG_BUILD_DIR:=$(TOOLCHAIN_BUILD_DIR)/uClibc-$(PKG_VERSION)$(PKG_EXTRAVERSION)
+STAGING_DIR_HOST:=$(TOOLCHAIN_DIR)
+BUILD_DIR_HOST:=$(BUILD_DIR_TOOLCHAIN)
+PKG_BUILD_DIR:=$(BUILD_DIR_HOST)/uClibc-$(PKG_VERSION)$(PKG_EXTRAVERSION)
include $(INCLUDE_DIR)/host-build.mk
+STAMP_BUILT:=$(TOOLCHAIN_DIR)/stamp/.uclibc_installed
+STAMP_INSTALLED:=$(TOOLCHAIN_DIR)/stamp/.uclibc-utils_installed
+
UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \
-e 's/i.86/i386/' \
-e 's/sparc.*/sparc/' \
@@ -37,32 +42,19 @@ UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \
define Build/Prepare
$(call Build/Prepare/Default)
- if [ -e config/$(ARCH).$(BOARD) ]; then \
- $(CP) config/$(ARCH).$(BOARD) $(PKG_BUILD_DIR)/.config; \
- else \
- $(CP) config/$(ARCH) $(PKG_BUILD_DIR)/.config; \
- fi
+ $(CP) config/$(ARCH)$(if $(wildcard config/$(ARCH).$(BOARD)),$(BOARD)) $(PKG_BUILD_DIR)/.config
$(SED) 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(LINUX_HEADERS_DIR)\",g' \
+ -e 's,.*HAS_FPU.*,HAS_FPU=$(if $(CONFIG_SOFT_FLOAT),n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,y),g' \
+ -e 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=$(if $(CONFIG_LARGEFILE),y,n),g' \
+ -e 's,.*DO_C99_MATH.*,DO_C99_MATH=$(if $(CONFIG_C99_MATH),y,n),g' \
$(PKG_BUILD_DIR)/.config
-ifeq ($(CONFIG_LARGEFILE),y)
- $(SED) 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=y,g' $(PKG_BUILD_DIR)/.config
-else
- $(SED) 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=n,g' $(PKG_BUILD_DIR)/.config
-endif
- $(SED) 's,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g' $(PKG_BUILD_DIR)/.config
-ifeq ($(CONFIG_SOFT_FLOAT),y)
- $(SED) 's,.*HAS_FPU.*,HAS_FPU=n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,g' $(PKG_BUILD_DIR)/.config
-endif
-ifeq ($(CONFIG_C99_MATH),y)
- $(SED) 's,.*DO_C99_MATH.*,DO_C99_MATH=y,g' $(PKG_BUILD_DIR)/.config
-endif
- mkdir -p $(TOOLCHAIN_BUILD_DIR)/uClibc_dev/usr/include
- mkdir -p $(TOOLCHAIN_BUILD_DIR)/uClibc_dev/usr/lib
- mkdir -p $(TOOLCHAIN_BUILD_DIR)/uClibc_dev/lib
+ mkdir -p $(BUILD_DIR_HOST)/uClibc_dev/usr/include
+ mkdir -p $(BUILD_DIR_HOST)/uClibc_dev/usr/lib
+ mkdir -p $(BUILD_DIR_HOST)/uClibc_dev/lib
PATH=$(TARGET_PATH) $(MAKE) -C $(PKG_BUILD_DIR) \
- PREFIX=$(TOOLCHAIN_BUILD_DIR)/uClibc_dev/ \
+ PREFIX=$(BUILD_DIR_HOST)/uClibc_dev/ \
DEVEL_PREFIX=/usr/ \
- RUNTIME_PREFIX=$(TOOLCHAIN_BUILD_DIR)/uClibc_dev/ \
+ RUNTIME_PREFIX=$(BUILD_DIR_HOST)/uClibc_dev/ \
HOSTCC="$(HOSTCC)" \
CPU_CFLAGS="$(TARGET_CFLAGS)" \
pregen install_dev;
@@ -71,34 +63,31 @@ endef
define Build/Configure
endef
-define Build/Compile
- $(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(PKG_BUILD_DIR)/Rules.mak
- PATH=$(TARGET_PATH) $(MAKE) -C $(PKG_BUILD_DIR) \
- PREFIX= \
+UCLIBC_MAKE := PATH=$(TARGET_PATH) $(MAKE) -C $(PKG_BUILD_DIR) \
DEVEL_PREFIX=/ \
RUNTIME_PREFIX=/ \
HOSTCC="$(HOSTCC)" \
- CPU_CFLAGS="$(TARGET_CFLAGS)" \
- all
+ CPU_CFLAGS="$(TARGET_CFLAGS)"
+
+define Build/Compile
+ $(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(PKG_BUILD_DIR)/Rules.mak
+ $(UCLIBC_MAKE) PREFIX= all
+ $(UCLIBC_MAKE) PREFIX=$(STAGING_DIR_HOST)/ install_runtime install_dev
+ $(SED) 's,UCLIBC_VERSION=.*,UCLIBC_VERSION=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
+ $(SED) 's,UCLIBC_PATCHVER=.*,UCLIBC_PATCHVER=$(PKG_EXTRAVERSION),' $(TOOLCHAIN_DIR)/info.mk
endef
define Build/Install
- $(MAKE) -C $(PKG_BUILD_DIR) \
- PREFIX=$(STAGING_DIR)/ \
- DEVEL_PREFIX=/ \
- RUNTIME_PREFIX=/ \
- install_runtime
- $(MAKE) -C $(PKG_BUILD_DIR) \
- PREFIX=$(STAGING_DIR)/ \
- DEVEL_PREFIX=/ \
- RUNTIME_PREFIX=/ \
- install_dev
- echo $(PKG_VERSION) > $(STAGING_DIR)/uclibc_version
- echo $(PKG_VERSION)$(PKG_EXTRAVERSION) > $(STAGING_DIR)/uclibc_extra_version
+ $(UCLIBC_MAKE) PREFIX= utils
+ $(INSTALL_DIR) $(TOOLCHAIN_DIR)/target-utils
+ $(INSTALL_BIN) \
+ $(PKG_BUILD_DIR)/utils/ldd \
+ $(PKG_BUILD_DIR)/utils/ldconfig \
+ $(TOOLCHAIN_DIR)/target-utils/
endef
define Build/Clean
- rm -rf $(PKG_BUILD_DIR) $(TOOLCHAIN_BUILD_DIR)/uClibc_dev
+ rm -rf $(PKG_BUILD_DIR) $(BUILD_DIR_HOST)/uClibc_dev
endef
$(eval $(call HostBuild))
diff --git a/tools/Makefile b/tools/Makefile
index 492c027099..d1ca6508f0 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -15,15 +15,19 @@ $(curdir)/builddirs := sed sstrip ipkg-utils ext2fs squashfs mtd-utils lzma mkim
$(curdir)/squashfs/compile := $(curdir)/lzma/install
# preparatory work
-define copy_include
-$(STAGING_DIR)/include-host/.done:
- @mkdir -p $$$$(dirname $$@)
- @cp $(1)/include/*.h $$$$(dirname $$@)/
- @touch $$@
-$(curdir)//prepare = $(STAGING_DIR)/include-host/.done
-$(curdir)//compile = $(STAGING_DIR)/include-host/.done
-endef
-$(eval $(call copy_include,$(curdir)))
+$(STAGING_DIR)/.prepared: $(TMP_DIR)/.build
+ @for dir in $(STAGING_DIR) $(STAGING_DIR_HOST); do ( \
+ set -x; \
+ mkdir -p "$$dir"; \
+ cd "$$dir"; \
+ mkdir -p bin lib include stamp; \
+ ); done
+ mkdir -p $(BUILD_DIR_HOST)/stamp $(BUILD_DIR)/stamp
+ $(INSTALL_DATA) $(TOPDIR)/tools/include/*.h $(STAGING_DIR_HOST)/include/
+ touch $@
+
+$(curdir)//prepare = $(STAGING_DIR)/.prepared
+$(curdir)//compile = $(STAGING_DIR)/.prepared
# prerequisites for the individual targets
$(curdir)/ := .config prereq
diff --git a/tools/ccache/Makefile b/tools/ccache/Makefile
index e8e85b442a..471922c88f 100644
--- a/tools/ccache/Makefile
+++ b/tools/ccache/Makefile
@@ -15,8 +15,6 @@ PKG_SOURCE_URL:=http://samba.org/ftp/ccache/
PKG_MD5SUM:=73c1ed1e767c1752dd0f548ec1e66ce7
PKG_CAT:=zcat
-PKG_BUILD_DIR:=$(TOOLCHAIN_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
-
include $(INCLUDE_DIR)/host-build.mk
ifneq ($(strip $(shell which ccache >/dev/null && echo found)),found)
@@ -26,7 +24,7 @@ ifneq ($(strip $(shell which ccache >/dev/null && echo found)),found)
define Build/Install
$(MAKE) -C $(PKG_BUILD_DIR) \
- DESTDIR="$(STAGING_DIR)" \
+ DESTDIR="$(STAGING_DIR_HOST)" \
install
endef
diff --git a/tools/ext2fs/Makefile b/tools/ext2fs/Makefile
index f10adbb6c3..69700ed54b 100644
--- a/tools/ext2fs/Makefile
+++ b/tools/ext2fs/Makefile
@@ -16,8 +16,6 @@ PKG_SOURCE_URL:=@SF/$(PKG_NAME)
PKG_MD5SUM:=664431bf6737df1c265500e1f0b5d40c
PKG_CAT:=zcat
-PKG_BUILD_DIR:=$(TOOL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
-
include $(INCLUDE_DIR)/host-build.mk
define Build/Configure
@@ -43,17 +41,16 @@ endef
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
- CFLAGS="-O2 -I $(STAGING_DIR)/include-host -include getline.h" \
+ CFLAGS="$(HOST_CFLAGS) -include getline.h" \
all
endef
define Build/Install
- mkdir -p $(STAGING_DIR)/bin
- install -m0755 $(PKG_BUILD_DIR)/genext2fs $(STAGING_DIR)/bin/
+ install -m0755 $(PKG_BUILD_DIR)/genext2fs $(STAGING_DIR_HOST)/bin/
endef
define Build/Clean
- rm -f $(STAGING_DIR)/bin/genext2fs
+ rm -f $(STAGING_DIR_HOST)/bin/genext2fs
endef
$(eval $(call HostBuild))
diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile
index 24cf88eecd..f458693564 100644
--- a/tools/firmware-utils/Makefile
+++ b/tools/firmware-utils/Makefile
@@ -7,14 +7,11 @@
include $(TOPDIR)/rules.mk
PKG_NAME := firmware-utils
-PKG_BUILD_DIR:=$(TOOL_BUILD_DIR)/firmware-utils
include $(INCLUDE_DIR)/host-build.mk
-CFLAGS := -O2 -I $(STAGING_DIR)/include-host -include endian.h
-
define cc
- $(CC) $(CFLAGS) -o $(PKG_BUILD_DIR)/bin/$(1) src/$(1).c
+ $(CC) $(HOST_CFLAGS) -include endian.h -o $(PKG_BUILD_DIR)/bin/$(1) src/$(1).c
endef
define Build/Compile
@@ -33,7 +30,7 @@ define Build/Compile
endef
define Build/Install
- $(CP) $(PKG_BUILD_DIR)/bin/* $(STAGING_DIR)/bin
+ $(CP) $(PKG_BUILD_DIR)/bin/* $(STAGING_DIR_HOST)/bin/
endef
$(eval $(call HostBuild))
diff --git a/tools/ipkg-utils/Makefile b/tools/ipkg-utils/Makefile
index 06bb2adc0b..9c0330859b 100644
--- a/tools/ipkg-utils/Makefile
+++ b/tools/ipkg-utils/Makefile
@@ -14,24 +14,23 @@ PKG_SOURCE_URL:=http://handhelds.org/packages/ipkg-utils/
PKG_MD5SUM:=da3e3ef772973d7370a6ac95f0fef9b8
PKG_CAT:=zcat
-PKG_BUILD_DIR:=$(TOOL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
-
include $(INCLUDE_DIR)/host-build.mk
define Build/Install
mkdir -p $(STAGING_DIR)/etc
echo "dest root /" > $(STAGING_DIR)/etc/ipkg.conf
echo "option offline_root $(TARGET_DIR)" >> $(STAGING_DIR)/etc/ipkg.conf
- mkdir -p $(STAGING_DIR)/usr/bin
- install -m0755 $(PKG_BUILD_DIR)/ipkg-build $(STAGING_DIR)/usr/bin/
- install -m0755 $(PKG_BUILD_DIR)/ipkg-buildpackage $(STAGING_DIR)/usr/bin/
- install -m0755 $(PKG_BUILD_DIR)/ipkg-make-index $(STAGING_DIR)/usr/bin/
- install -m0755 $(PKG_BUILD_DIR)/ipkg.py $(STAGING_DIR)/usr/bin/
+ $(INSTALL_BIN) \
+ $(PKG_BUILD_DIR)/ipkg-build \
+ $(PKG_BUILD_DIR)/ipkg-buildpackage \
+ $(PKG_BUILD_DIR)/ipkg-make-index \
+ $(PKG_BUILD_DIR)/ipkg.py \
+ $(STAGING_DIR_HOST)/bin/
endef
define Build/Clean
rm -f $(STAGING_DIR)/etc/ipkg.conf
- rm -f $(STAGING_DIR)/usr/bin/ipkg*
+ rm -f $(STAGING_DIR_HOST)/bin/ipkg*
endef
$(eval $(call HostBuild))
diff --git a/tools/lzma/Makefile b/tools/lzma/Makefile
index f00863efa4..fb5929ce31 100644
--- a/tools/lzma/Makefile
+++ b/tools/lzma/Makefile
@@ -13,32 +13,28 @@ PKG_SOURCE:=$(PKG_NAME)$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=@SF/sevenzip
PKG_MD5SUM:=155c1ebce5bc6710ae7ecc926226d9d7
-PKG_BUILD_DIR:=$(TOOL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/lzma
+PKG_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)/lzma
+PKG_UNPACK:=bzcat $(DL_DIR)/$(PKG_SOURCE) | $(TAR) -C $(PKG_BUILD_DIR)/ $(TAR_OPTIONS)
include $(INCLUDE_DIR)/host-build.mk
LIB_DIR=$(PKG_BUILD_DIR)/C/7zip/Compress/LZMA_Lib
ALONE_DIR=$(PKG_BUILD_DIR)/C/7zip/Compress/LZMA_Alone
-define Build/Prepare
- bzcat $(DL_DIR)/$(PKG_SOURCE) | $(TAR) -C $(PKG_BUILD_DIR)/ $(TAR_OPTIONS)
- $(PATCH) $(PKG_BUILD_DIR) ./patches
-endef
-
define Build/Compile
$(MAKE) -C $(LIB_DIR)
$(MAKE) -f makefile.gcc -C $(ALONE_DIR)
endef
define Build/Install
- mkdir -p $(STAGING_DIR)/host/lib
- $(CP) $(LIB_DIR)/liblzma.a $(STAGING_DIR)/host/lib/
- mkdir -p $(STAGING_DIR)/bin
- $(CP) $(ALONE_DIR)/lzma $(STAGING_DIR)/bin/
+ $(INSTALL_DATA) $(LIB_DIR)/liblzma.a $(STAGING_DIR_HOST)/lib/
+ $(INSTALL_BIN) $(ALONE_DIR)/lzma $(STAGING_DIR_HOST)/bin/
endef
define Build/Clean
- rm -f $(STAGING_DIR)/host/lib/liblzma.a $(STAGING_DIR)/bin/lzma
+ rm -f \
+ $(STAGING_DIR_HOST)/lib/liblzma.a \
+ $(STAGING_DIR_HOST)/bin/lzma
endef
$(eval $(call HostBuild))
diff --git a/tools/mkimage/Makefile b/tools/mkimage/Makefile
index 22e8b484d7..f2bb08dd39 100644
--- a/tools/mkimage/Makefile
+++ b/tools/mkimage/Makefile
@@ -7,23 +7,21 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=mkimage
-PKG_BUILD_DIR:=$(TOOL_BUILD_DIR)/mkimage
include $(INCLUDE_DIR)/host-build.mk
define Build/Compile
- $(CC) -O -c src/crc32.c -o $(PKG_BUILD_DIR)/crc32.o
- $(CC) -O -c src/mkimage.c -o $(PKG_BUILD_DIR)/mkimage.o
- $(CC) -O -o $(PKG_BUILD_DIR)/mkimage $(PKG_BUILD_DIR)/mkimage.o $(PKG_BUILD_DIR)/crc32.o
+ $(HOSTCC) $(HOST_CFLAGS) -O -c src/crc32.c -o $(PKG_BUILD_DIR)/crc32.o
+ $(HOSTCC) $(HOST_CFLAGS) -O -c src/mkimage.c -o $(PKG_BUILD_DIR)/mkimage.o
+ $(HOSTCC) $(HOST_CFLAGS) -O -o $(PKG_BUILD_DIR)/mkimage $(PKG_BUILD_DIR)/mkimage.o $(PKG_BUILD_DIR)/crc32.o
endef
define Build/Install
- mkdir -p $(STAGING_DIR)/bin
- $(CP) $(PKG_BUILD_DIR)/mkimage $(STAGING_DIR)/bin/
+ $(CP) $(PKG_BUILD_DIR)/mkimage $(STAGING_DIR_HOST)/bin/
endef
define Build/Clean
- rm -f $(STAGING_DIR)/bin/mkimage
+ rm -f $(STAGING_DIR_HOST)/bin/mkimage
endef
$(eval $(call HostBuild))
diff --git a/tools/mtd-utils/Makefile b/tools/mtd-utils/Makefile
index bc15f0a671..cc4ae9a5e2 100644
--- a/tools/mtd-utils/Makefile
+++ b/tools/mtd-utils/Makefile
@@ -14,13 +14,13 @@ PKG_SOURCE_URL=http://ftp.debian.org/debian/pool/main/m/mtd
PKG_MD5SUM:=1f42c2cae08eb9e7b52d0c188f8d6338
PKG_CAT:=zcat
-PKG_BUILD_DIR:=$(TOOL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION).orig
+PKG_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION).orig
include $(INCLUDE_DIR)/host-build.mk
-CFLAGS := $(HOSTCFLAGS) -O2 -I../include
+CFLAGS := $(HOST_CFLAGS) -I../include
ifneq ($(HOST_OS),Linux)
-CFLAGS += -Dloff_t=off_t -D__BYTE_ORDER=BYTE_ORDER -I$(STAGING_DIR)/include-host -include getline.h -include endian.h
+CFLAGS += -Dloff_t=off_t -D__BYTE_ORDER=BYTE_ORDER -include getline.h -include endian.h
endif
define Build/Compile
@@ -28,12 +28,11 @@ define Build/Compile
endef
define Build/Install
- mkdir -p $(STAGING_DIR)/bin
- $(CP) $(PKG_BUILD_DIR)/util/mkfs.jffs2 $(STAGING_DIR)/bin/
+ $(CP) $(PKG_BUILD_DIR)/util/mkfs.jffs2 $(STAGING_DIR_HOST)/bin/
endef
define Build/Clean
- rm -f $(STAGING_DIR)/bin/mkfs.jffs2
+ rm -f $(STAGING_DIR_HOST)/bin/mkfs.jffs2
endef
$(eval $(call HostBuild))
diff --git a/tools/patch-cmdline/Makefile b/tools/patch-cmdline/Makefile
index 75ea7b52d4..cc6b9d3819 100644
--- a/tools/patch-cmdline/Makefile
+++ b/tools/patch-cmdline/Makefile
@@ -8,27 +8,18 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=patch-cmdline
-PKG_BUILD_DIR:=$(TOOL_BUILD_DIR)/$(PKG_NAME)
-
include $(INCLUDE_DIR)/host-build.mk
-OS:=$(shell uname)
-ifeq ($(HOST_OS),Darwin)
- CFLAGS += -I./include
-endif
-CFLAGS += -I $(TOPDIR)/tools/include -include endian.h
-
define Build/Compile
- $(CC) $(CFLAGS) -o $(PKG_BUILD_DIR)/$(PKG_NAME) src/$(PKG_NAME).c
+ $(HOSTCC) $(HOST_CFLAGS) -include endian.h -o $(PKG_BUILD_DIR)/$(PKG_NAME) src/$(PKG_NAME).c
endef
define Build/Install
- mkdir -p $(STAGING_DIR)/bin
- $(CP) $(PKG_BUILD_DIR)/patch-cmdline $(STAGING_DIR)/bin/
+ $(CP) $(PKG_BUILD_DIR)/patch-cmdline $(STAGING_DIR_HOST)/bin/
endef
define Build/Clean
- -rm -f $(STAGING_DIR)/bin/patch-cmdline
+ rm -f $(STAGING_DIR_HOST)/bin/patch-cmdline
endef
$(eval $(call HostBuild))
diff --git a/tools/sed/Makefile b/tools/sed/Makefile
index 94c59c8246..0f2b3dbf22 100644
--- a/tools/sed/Makefile
+++ b/tools/sed/Makefile
@@ -13,35 +13,20 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=ftp://ftp.gnu.org/gnu/$(PKG_NAME)
PKG_MD5SUM:=928f0e06422f414091917401f1a834d0
PKG_CAT:=zcat
-
-PKG_BUILD_DIR:=$(TOOL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+export SED:=
include $(INCLUDE_DIR)/host-build.mk
-define Build/Configure
- (cd $(PKG_BUILD_DIR); rm -rf config.cache; \
- SHELL="$(BASH)" \
- ./configure \
- --prefix=$(STAGING_DIR) \
- --prefix=/usr \
- );
-endef
-
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) SHELL="$(BASH)"
endef
define Build/Install
- @if [ -L $(STAGING_DIR)/bin/sed ] ; then \
- rm -f $(STAGING_DIR)/bin/sed; fi;
- @if [ ! -f $(STAGING_DIR)/bin/sed -o $(STAGING_DIR)/bin/sed -ot $(PKG_BUILD_DIR)/sed/sed ]; then \
- set -x; \
- mkdir -p $(STAGING_DIR)/bin; \
- $(MAKE) DESTDIR=$(STAGING_DIR) -C $(PKG_BUILD_DIR) install; \
- mv $(STAGING_DIR)/usr/bin/sed $(STAGING_DIR)/bin/; \
- rm -rf $(STAGING_DIR)/share/locale $(STAGING_DIR)/usr/info \
- $(STAGING_DIR)/usr/man $(STAGING_DIR)/usr/share/doc; \
- fi
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/sed/sed $(STAGING_DIR_HOST)/bin/
+endef
+
+define Build/Clean
+ rm -f $(STAGING_DIR_HOST)/bin/sed
endef
$(eval $(call HostBuild))
diff --git a/tools/squashfs/Makefile b/tools/squashfs/Makefile
index 8e37a15215..d0098361f9 100644
--- a/tools/squashfs/Makefile
+++ b/tools/squashfs/Makefile
@@ -14,21 +14,22 @@ PKG_SOURCE_URL:=@SF/squashfs
PKG_MD5SUM:=9fd05d0bfbb712f5fb95edafea5bc733
PKG_CAT:=zcat
-PKG_BUILD_DIR:=$(TOOL_BUILD_DIR)/$(PKG_NAME)$(PKG_VERSION)
+PKG_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)$(PKG_VERSION)
include $(INCLUDE_DIR)/host-build.mk
define Build/Compile
- $(MAKE) -C $(PKG_BUILD_DIR)/squashfs-tools mksquashfs-lzma LZMAPATH=$(STAGING_DIR)/host/lib
+ $(MAKE) -C $(PKG_BUILD_DIR)/squashfs-tools \
+ LZMAPATH=$(STAGING_DIR_HOST)/lib \
+ mksquashfs-lzma
endef
define Build/Install
- mkdir -p $(STAGING_DIR)/bin
- $(CP) $(PKG_BUILD_DIR)/squashfs-tools/mksquashfs-lzma $(STAGING_DIR)/bin/
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/squashfs-tools/mksquashfs-lzma $(STAGING_DIR_HOST)/bin/
endef
define Build/Clean
- rm -f $(STAGING_DIR)/bin/mksquashfs-lzma
+ rm -f $(STAGING_DIR_HOST)/bin/mksquashfs-lzma
endef
$(eval $(call HostBuild))
diff --git a/tools/sstrip/Makefile b/tools/sstrip/Makefile
index f978eae264..38362a5f7c 100644
--- a/tools/sstrip/Makefile
+++ b/tools/sstrip/Makefile
@@ -7,27 +7,19 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=sstrip
-PKG_BUILD_DIR:=$(TOOL_BUILD_DIR)/sstrip
include $(INCLUDE_DIR)/host-build.mk
-OS:=$(shell uname)
-ifeq ($(HOST_OS),Darwin)
- CFLAGS += -I./include
-endif
-CFLAGS += -I $(TOPDIR)/tools/include -include endian.h
-
define Build/Compile
- $(CC) $(CFLAGS) -o $(PKG_BUILD_DIR)/sstrip src/sstrip.c
+ $(CC) $(HOST_CFLAGS) -include endian.h -o $(PKG_BUILD_DIR)/sstrip src/sstrip.c
endef
define Build/Install
- mkdir -p $(STAGING_DIR)/bin
- $(CP) $(PKG_BUILD_DIR)/sstrip $(STAGING_DIR)/bin/
+ $(CP) $(PKG_BUILD_DIR)/sstrip $(STAGING_DIR_HOST)/bin/
endef
define Build/Clean
- rm -f $(STAGING_DIR)/bin/sstrip
+ rm -f $(STAGING_DIR_HOST)/bin/sstrip
endef
$(eval $(call HostBuild))