mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2025-04-21 12:27:27 +03:00
build system cleanup/restructuring as described in http://lists.openwrt.org/pipermail/openwrt-devel/2007-August/001159.html
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@8362 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user