From e143bed1f19b55c5eac38d78a5c98f478fca88fc Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 28 Jul 2007 13:29:03 +0000 Subject: [PATCH] build system fixes, more cleanup SVN-Revision: 8207 --- Makefile | 13 ++++----- include/toplevel.mk | 24 +++++++++-------- toolchain/Makefile | 65 +++++++++++---------------------------------- tools/Makefile | 20 +++++++------- 4 files changed, 44 insertions(+), 78 deletions(-) diff --git a/Makefile b/Makefile index 92b84bb2a7..6703d90d61 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,6 @@ # Makefile for OpenWrt # -# Copyright (C) 2006 OpenWrt.org -# Copyright (C) 2006 by Felix Fietkau +# Copyright (C) 2007 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -9,22 +8,21 @@ all: world - TOPDIR:=${CURDIR} LC_ALL:=C LANG:=C IS_TTY:=${shell tty -s && echo 1 || echo 0} export TOPDIR LC_ALL LANG IS_TTY -include rules.mk - ifneq ($(OPENWRT_BUILD),1) export OPENWRT_BUILD:=1 - include $(INCLUDE_DIR)/toplevel.mk + include $(TOPDIR)/include/toplevel.mk else + include rules.mk include $(INCLUDE_DIR)/depends.mk include $(INCLUDE_DIR)/subdir.mk include tools/Makefile + include toolchain/Makefile clean: FORCE rm -rf build_* bin tmp @@ -38,8 +36,7 @@ distclean: dirclean config-clean symlinkclean docs/clean toolchain/% package/% target/%: FORCE $(MAKE) -C $(patsubst %/$*,%,$@) $* -world: .config $(tools/stamp) FORCE - $(MAKE) toolchain/install +world: .config $(tools/stamp) $(toolchain/stamp) FORCE $(MAKE) target/compile $(MAKE) package/compile $(MAKE) package/install diff --git a/include/toplevel.mk b/include/toplevel.mk index d9c16a5ece..05839832d2 100644 --- a/include/toplevel.mk +++ b/include/toplevel.mk @@ -13,6 +13,7 @@ all: world SHELL:=/usr/bin/env bash OPENWRTVERSION:=$(RELEASE) +include $(TOPDIR)/include/verbose.mk ifneq ($(VERSION),) OPENWRTVERSION:=$(VERSION) ($(OPENWRTVERSION)) else @@ -33,25 +34,25 @@ export SCAN_COOKIE tmp/.packageinfo tmp/.targetinfo prepare-tmpinfo: @mkdir -p tmp/info - @$(NO_TRACE_MAKE) -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPS="$(TOPDIR)/include/package*.mk" SCAN_DEPTH=4 SCAN_EXTRA="" - @$(NO_TRACE_MAKE) -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPS="profiles/*.mk $(TOPDIR)/include/kernel*.mk" SCAN_DEPTH=2 SCAN_EXTRA="" + @+$(NO_TRACE_MAKE) -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPS="$(TOPDIR)/include/package*.mk" SCAN_DEPTH=4 SCAN_EXTRA="" + @+$(NO_TRACE_MAKE) -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPS="profiles/*.mk $(TOPDIR)/include/kernel*.mk" SCAN_DEPTH=2 SCAN_EXTRA="" @for type in package target; do \ f=tmp/.$${type}info; t=tmp/.config-$${type}.in; \ [ "$$t" -nt "$$f" ] || ./scripts/metadata.pl $${type}_config < "$$f" > "$$t" || { rm -f "$$t"; echo "Failed to build $$t"; false; break; }; \ done .config: ./scripts/config/conf prepare-tmpinfo - if [ \! -f .config ]; then \ + @+if [ \! -f .config ]; then \ [ -e $(HOME)/.openwrt/defconfig ] && cp $(HOME)/.openwrt/defconfig .config; \ - $(NO_TRACE_MAKE) menuconfig; \ + $(NO_TRACE_MAKE) menuconfig QUIET=0 OPENWRT_BUILD=; \ fi $< -D .config Config.in &> /dev/null scripts/config/mconf: - $(MAKE) -C scripts/config all + @+$(MAKE) -C scripts/config all scripts/config/conf: - $(MAKE) -C scripts/config conf + @+$(MAKE) -C scripts/config conf config: scripts/config/conf prepare-tmpinfo FORCE $< Config.in @@ -81,24 +82,25 @@ kernel_menuconfig: .config FORCE tmp/.prereq-build: include/prereq-build.mk mkdir -p tmp rm -f tmp/.host.mk - $(NO_TRACE_MAKE) -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \ + @+$(NO_TRACE_MAKE) -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \ echo "Prerequisite check failed. Use FORCE=1 to override."; \ false; \ } touch $@ -tmp/.prereq-package: tmp/.packageinfo +tmp/.prereq-package: tmp/.packageinfo .config tmp/.prereq-target: tmp/.targetinfo .config tmp/.prereq-package tmp/.prereq-target: include/prereq.mk mkdir -p tmp rm -f tmp/.host.mk - $(NO_TRACE_MAKE) -s -C $(patsubst tmp/.prereq-%,%,$@) prereq 2>/dev/null || { \ + @+$(NO_TRACE_MAKE) -s -C $(patsubst tmp/.prereq-%,%,$@) prereq 2>/dev/null || { \ echo "Prerequisite check failed. Use FORCE=1 to override."; \ false; \ } touch $@ -prereq: tmp/.prereq-build tmp/.prereq-package tmp/.prereq-target .config FORCE ; +prereq: tmp/.prereq-build tmp/.prereq-package tmp/.prereq-target .config FORCE + @true download: .config FORCE $(MAKE) -j1 tools/download @@ -111,7 +113,7 @@ clean dirclean distclean: %:: @$(SUBMAKE) -s prereq QUIET=0 OPENWRT_BUILD= - @$(MAKE) $@ + @+$(MAKE) $@ help: cat README diff --git a/toolchain/Makefile b/toolchain/Makefile index 48637c11bf..21d2b6876e 100644 --- a/toolchain/Makefile +++ b/toolchain/Makefile @@ -1,63 +1,30 @@ # -# Copyright (C) 2006 OpenWrt.org +# Copyright (C) 2007 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. # # Main makefile for the toolchain # -include $(TOPDIR)/rules.mk -TARGETS-y:=kernel-headers -TARGETS-$(CONFIG_GDB) += gdb -ifeq ($(CONFIG_NATIVE_TOOLCHAIN),) - TARGETS-y+=binutils gcc uClibc -endif - -TARGETS_DOWNLOAD:=$(patsubst %,%-download,$(TARGETS-y)) -TARGETS_PREPARE:=$(patsubst %,%-prepare,$(TARGETS-y)) -TARGETS_COMPILE:=$(patsubst %,%-compile,$(TARGETS-y)) -TARGETS_INSTALL:=$(patsubst %,%-install,$(TARGETS-y)) -TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS-y)) -STAMP:=$(STAGING_DIR)/stampfiles/.toolchain_installed +# subdirectories to descend into +toolchain/builddirs := kernel-headers $(if $(CONFIG_GDB),gdb) $(if $(CONFIG_NATIVE_TOOLCHAIN),,binutils gcc uClibc) -all: install -download: $(TARGETS_DOWNLOAD) -compile: $(TARGETS_COMPILE) -install: $(STAMP) -clean: $(TARGETS_CLEAN) - -ifneq ($(shell $(SCRIPT_DIR)/timestamp.pl -p . $(STAMP)),$(STAMP)) - $(STAMP): $(TARGETS_INSTALL) -endif - -uClibc-prepare: kernel-headers-prepare +# builddir dependencies +toolchain/uClibc/prepare:=toolchain/kernel-headers/prepare ifeq ($(CONFIG_NATIVE_TOOLCHAIN),) - binutils-prepare: uClibc-prepare - gcc-prepare: binutils-install - uClibc-compile: gcc-compile + toolchain/binutils/prepare:=toolchain/uClibc/prepare + toolchain/gcc/prepare:=toolchain/binutils/install + toolchain/uClibc/compile:=toolchain/gcc/compile endif -gcc-install: uClibc-install - -$(STAMP): - mkdir -p $(shell dirname $@) - touch $@ - -$(STAGING_DIR)/$(REAL_GNU_TARGET_NAME): - @mkdir -p $@ - @ln -sf ../lib $@/lib - -$(TOOLCHAIN_BUILD_DIR): - @mkdir -p $@ +toolchain/gcc/install:=toolchain/uClibc/install -%-prereq %-download %-clean %-refresh %-update: FORCE - $(MAKE) -C $* $(patsubst $*-%,%,$@) +# prerequisites for the individual targets +toolchain/ := .config $(tools/stamp) +toolchain//prepare = $(STAGING_DIR)/include-host/.done +toolchain//compile = $(1)/prepare +toolchain//install = $(1)/compile -%-prepare: $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME) $(TOOLCHAIN_BUILD_DIR) - $(MAKE) -C $* $(patsubst $*-%,%,$@) +$(eval $(call stampfile,toolchain,toolchain)) +$(eval $(call subdir,toolchain)) -%-compile: %-prepare FORCE - $(MAKE) -C $* $(patsubst $*-%,%,$@) - -%-install: %-compile FORCE - $(MAKE) -C $* $(patsubst $*-%,%,$@) diff --git a/tools/Makefile b/tools/Makefile index 49b30be44b..ed2eae89d9 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -7,25 +7,25 @@ # Main makefile for the host tools # -curdir:=$(patsubst %/Makefile,%,$(lastword $(MAKEFILE_LIST))) +curdir:=tools # subdirectories to descend into -$(curdir)/builddirs := sed sstrip ipkg-utils ext2fs squashfs mtd-utils lzma mkimage firmware-utils patch-cmdline $(if $(CONFIG_CCACHE),ccache) +tools/builddirs := sed sstrip ipkg-utils ext2fs squashfs mtd-utils lzma mkimage firmware-utils patch-cmdline $(if $(CONFIG_CCACHE),ccache) # builddir dependencies -$(curdir)/squashfs/compile := $(curdir)/lzma/install +tools/squashfs/compile := tools/lzma/install # preparatory work $(STAGING_DIR)/include-host/.done: @mkdir -p $$(dirname $@) - @cp $(curdir)/include/*.h $$(dirname $@)/ + @cp tools/include/*.h $$(dirname $@)/ @touch $@ # prerequisites for the individual targets -$(curdir)/ := .config -$(curdir)//prepare = $(STAGING_DIR)/include-host/.done -$(curdir)//compile = $(1)/prepare -$(curdir)//install = $(1)/compile +tools/ := .config +tools//prepare = $(STAGING_DIR)/include-host/.done +tools//compile = $(1)/prepare +tools//install = $(1)/compile -$(eval $(call stampfile,$(curdir),tools)) -$(eval $(call subdir,$(curdir))) +$(eval $(call stampfile,tools,tools)) +$(eval $(call subdir,tools)) -- 2.30.2