build system fixes, more cleanup
SVN-Revision: 8207
This commit is contained in:
parent
9c88ba80b9
commit
e143bed1f1
4 changed files with 45 additions and 79 deletions
13
Makefile
13
Makefile
|
@ -1,7 +1,6 @@
|
|||
# Makefile for OpenWrt
|
||||
#
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
# Copyright (C) 2006 by Felix Fietkau <openwrt@nbd.name>
|
||||
# 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
# subdirectories to descend into
|
||||
toolchain/builddirs := kernel-headers $(if $(CONFIG_GDB),gdb) $(if $(CONFIG_NATIVE_TOOLCHAIN),,binutils gcc uClibc)
|
||||
|
||||
# builddir dependencies
|
||||
toolchain/uClibc/prepare:=toolchain/kernel-headers/prepare
|
||||
ifeq ($(CONFIG_NATIVE_TOOLCHAIN),)
|
||||
TARGETS-y+=binutils gcc uClibc
|
||||
toolchain/binutils/prepare:=toolchain/uClibc/prepare
|
||||
toolchain/gcc/prepare:=toolchain/binutils/install
|
||||
toolchain/uClibc/compile:=toolchain/gcc/compile
|
||||
endif
|
||||
toolchain/gcc/install:=toolchain/uClibc/install
|
||||
|
||||
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
|
||||
# prerequisites for the individual targets
|
||||
toolchain/ := .config $(tools/stamp)
|
||||
toolchain//prepare = $(STAGING_DIR)/include-host/.done
|
||||
toolchain//compile = $(1)/prepare
|
||||
toolchain//install = $(1)/compile
|
||||
|
||||
all: install
|
||||
download: $(TARGETS_DOWNLOAD)
|
||||
compile: $(TARGETS_COMPILE)
|
||||
install: $(STAMP)
|
||||
clean: $(TARGETS_CLEAN)
|
||||
$(eval $(call stampfile,toolchain,toolchain))
|
||||
$(eval $(call subdir,toolchain))
|
||||
|
||||
ifneq ($(shell $(SCRIPT_DIR)/timestamp.pl -p . $(STAMP)),$(STAMP))
|
||||
$(STAMP): $(TARGETS_INSTALL)
|
||||
endif
|
||||
|
||||
uClibc-prepare: kernel-headers-prepare
|
||||
ifeq ($(CONFIG_NATIVE_TOOLCHAIN),)
|
||||
binutils-prepare: uClibc-prepare
|
||||
gcc-prepare: binutils-install
|
||||
uClibc-compile: 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 $@
|
||||
|
||||
%-prereq %-download %-clean %-refresh %-update: FORCE
|
||||
$(MAKE) -C $* $(patsubst $*-%,%,$@)
|
||||
|
||||
%-prepare: $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME) $(TOOLCHAIN_BUILD_DIR)
|
||||
$(MAKE) -C $* $(patsubst $*-%,%,$@)
|
||||
|
||||
%-compile: %-prepare FORCE
|
||||
$(MAKE) -C $* $(patsubst $*-%,%,$@)
|
||||
|
||||
%-install: %-compile FORCE
|
||||
$(MAKE) -C $* $(patsubst $*-%,%,$@)
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue