summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2007-08-07 00:04:25 +0000
committerFelix Fietkau <nbd@openwrt.org>2007-08-07 00:04:25 +0000
commitc6bc77ea365704f3f5c79d64aed069792a4e95b1 (patch)
tree28c9265495e6ad751fcae0d27a040b222ff2a215 /tools
parent9882253827b16579bbd317f6e8c0deb75b0ca0f3 (diff)
downloadmtk-20170518-c6bc77ea365704f3f5c79d64aed069792a4e95b1.zip
mtk-20170518-c6bc77ea365704f3f5c79d64aed069792a4e95b1.tar.gz
mtk-20170518-c6bc77ea365704f3f5c79d64aed069792a4e95b1.tar.bz2
build system cleanup/restructuring as described in http://lists.openwrt.org/pipermail/openwrt-devel/2007-August/001159.html
SVN-Revision: 8362
Diffstat (limited to 'tools')
-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
12 files changed, 61 insertions, 104 deletions
diff --git a/tools/Makefile b/tools/Makefile
index 492c027..d1ca650 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 e8e85b4..471922c 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 f10adbb..69700ed 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 24cf88e..f458693 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 06bb2ad..9c03308 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 f00863e..fb5929c 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 22e8b48..f2bb08d 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 bc15f0a..cc4ae9a 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 75ea7b5..cc6b9d3 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 94c59c8..0f2b3db 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 8e37a15..d009836 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 f978eae..38362a5 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))