aboutsummaryrefslogtreecommitdiffstats
path: root/include
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
commitd10a56dc58f6c601a9abaddbe1e9cfe4db97d57b (patch)
tree9cda5ecf22a01d8a2ac22cd1a6510d51dfd5f3c3 /include
parenta46bd6cee4e494a5879393349c2a6990996c5904 (diff)
downloadupstream-d10a56dc58f6c601a9abaddbe1e9cfe4db97d57b.tar.gz
upstream-d10a56dc58f6c601a9abaddbe1e9cfe4db97d57b.tar.bz2
upstream-d10a56dc58f6c601a9abaddbe1e9cfe4db97d57b.zip
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
Diffstat (limited to 'include')
-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
8 files changed, 43 insertions, 37 deletions
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