mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-18 21:28:02 +00:00
next round of build system cleanup - convert package/ to new structure
SVN-Revision: 8236
This commit is contained in:
parent
2e072cfb4b
commit
49e628f765
35
Makefile
35
Makefile
@ -6,23 +6,26 @@
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
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
|
||||
|
||||
world:
|
||||
|
||||
include $(TOPDIR)/include/debug.mk
|
||||
include $(TOPDIR)/include/host.mk
|
||||
|
||||
ifneq ($(OPENWRT_BUILD),1)
|
||||
export OPENWRT_BUILD:=1
|
||||
override OPENWRT_BUILD=1
|
||||
export OPENWRT_BUILD
|
||||
include $(TOPDIR)/include/toplevel.mk
|
||||
else
|
||||
include $(TOPDIR)/include/host.mk
|
||||
|
||||
include rules.mk
|
||||
include $(INCLUDE_DIR)/depends.mk
|
||||
include $(INCLUDE_DIR)/subdir.mk
|
||||
include package/Makefile
|
||||
include tools/Makefile
|
||||
include toolchain/Makefile
|
||||
|
||||
@ -35,14 +38,32 @@ dirclean: clean
|
||||
distclean: dirclean config-clean symlinkclean docs/clean
|
||||
rm -rf dl
|
||||
|
||||
package/% target/%: FORCE
|
||||
target/%: FORCE
|
||||
$(MAKE) -C $(patsubst %/$*,%,$@) $*
|
||||
|
||||
world: .config $(tools/stamp) $(toolchain/stamp) FORCE
|
||||
# check prerequisites before starting to build
|
||||
prereq: tmp/.prereq-target $(package/stamp-prereq) ;
|
||||
|
||||
world: .config $(tools/stamp-install) $(toolchain/stamp-install) FORCE
|
||||
$(MAKE) target/compile
|
||||
$(MAKE) package/compile
|
||||
$(MAKE) package/install
|
||||
$(MAKE) target/install
|
||||
$(MAKE) package/index
|
||||
|
||||
package/symlinks:
|
||||
$(SCRIPT_DIR)/feeds.sh $(CONFIG_SOURCE_FEEDS) $(CONFIG_SOURCE_FEEDS_REV)
|
||||
|
||||
# FIXME: remove after converting target/ to new structure
|
||||
tmp/.prereq-target: tmp/.targetinfo .config
|
||||
tmp/.prereq-target: include/prereq.mk
|
||||
mkdir -p tmp
|
||||
rm -f tmp/.host.mk
|
||||
@+$(NO_TRACE_MAKE) -s -C target prereq 2>/dev/null || { \
|
||||
echo "Prerequisite check failed. Use FORCE=1 to override."; \
|
||||
false; \
|
||||
}
|
||||
touch $@
|
||||
.SILENT: tmp/.prereq-target
|
||||
|
||||
endif
|
||||
|
34
include/debug.mk
Normal file
34
include/debug.mk
Normal file
@ -0,0 +1,34 @@
|
||||
#
|
||||
# Copyright (C) 2007 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
# debug flags:
|
||||
#
|
||||
# d: show subdirectory tree
|
||||
# t: show added targets
|
||||
# l: show legacy targets
|
||||
# v: verbose (no .SILENCE for common targets)
|
||||
|
||||
ifeq ($(DEBUG),all)
|
||||
build_debug:=dltv
|
||||
else
|
||||
build_debug:=$(DEBUG)
|
||||
endif
|
||||
|
||||
define debug
|
||||
$$(findstring $(2),$$(if $$(DEBUG_DIR),$$(if $$(filter $$(DEBUG_DIR)%,$(1)),$(build_debug)),$(build_debug)))
|
||||
endef
|
||||
|
||||
define warn
|
||||
$$(if $(call debug,$(1),$(2)),$$(warning $(3)))
|
||||
endef
|
||||
|
||||
define warn_eval
|
||||
$(call warn,$(1),$(2),$(3) $(4))
|
||||
$(4)
|
||||
endef
|
||||
|
||||
|
@ -1,17 +1,18 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
TMP_DIR ?= $(TOPDIR)/tmp
|
||||
-include $(TMP_DIR)/.host.mk
|
||||
|
||||
export TAR
|
||||
TMP_DIR ?= $(TOPDIR)/tmp
|
||||
|
||||
ifneq ($(__host_inc),1)
|
||||
__host_inc:=1
|
||||
.PRECIOUS: $(TMP_DIR)/.host.mk
|
||||
$(TMP_DIR)/.host.mk: $(TOPDIR)/include/host.mk
|
||||
@mkdir -p $(TMP_DIR)
|
||||
@( \
|
||||
|
@ -10,6 +10,10 @@ ifeq ($(KERNEL_BUILD),1)
|
||||
endif
|
||||
PATCH_DIR?=./patches
|
||||
|
||||
ifeq ($(MAKECMDGOALS),refresh)
|
||||
override QUILT=1
|
||||
endif
|
||||
|
||||
define Quilt/Patch
|
||||
@for patch in $$$$( (cd $(1) && ls) 2>/dev/null ); do ( \
|
||||
cp "$(1)/$$$$patch" $(PKG_BUILD_DIR); \
|
||||
|
@ -1,32 +1,14 @@
|
||||
# debug flags:
|
||||
#
|
||||
# Copyright (C) 2007 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
# d: show subdirectory tree
|
||||
# t: show added targets
|
||||
# l: show legacy targets
|
||||
|
||||
ifeq ($(DEBUG),all)
|
||||
build_debug:=dlt
|
||||
else
|
||||
build_debug:=$(DEBUG)
|
||||
endif
|
||||
|
||||
define debug
|
||||
$$(findstring $(2),$$(if $$(DEBUG_DIR),$$(if $$(filter $$(DEBUG_DIR)%,$(1)),$(build_debug)),$(build_debug)))
|
||||
endef
|
||||
|
||||
define warn
|
||||
$$(if $(call debug,$(1),$(2)),$$(warning $(3)))
|
||||
endef
|
||||
|
||||
define warn_eval
|
||||
$(call warn,$(1),$(2),$(3) $(4))
|
||||
$(4)
|
||||
endef
|
||||
|
||||
SUBTARGETS:=clean download prepare compile install update refresh prereq
|
||||
|
||||
define subtarget
|
||||
$(call warn_eval,$(1),t,T,$(1)/$(2): $($(1)/) $(foreach bd,$(if $($(1)/builddirs-$(2)),$($(1)/builddirs-$(2)),$($(1)/builddirs)),$(1)/$(bd)/$(2)))
|
||||
$(call warn_eval,$(1),t,T,$(1)/$(2): $($(1)/) $(foreach bd,$(if $($(1)/builddirs-$(2)),$(filter-out .,$($(1)/builddirs-$(2))),$($(1)/builddirs)),$(1)/$(bd)/$(2)))
|
||||
|
||||
endef
|
||||
|
||||
@ -46,19 +28,19 @@ define subdir
|
||||
$(foreach target,$(SUBTARGETS),$(call subtarget,$(1),$(target)))
|
||||
endef
|
||||
|
||||
# Parameters: <subdir> <name>
|
||||
# Parameters: <subdir> <name> <target>
|
||||
define stampfile
|
||||
$(1)/stamp:=$(STAGING_DIR)/stampfiles/.$(2)_installed
|
||||
$(call rdep,$(1),$$($(1)/stamp))
|
||||
$(1)/stamp-$(3):=$(STAGING_DIR)/stampfiles/.$(2)_$(3)
|
||||
$(call rdep,$(1),$$($(1)/stamp-$(3)),)
|
||||
|
||||
$$($(1)/stamp):
|
||||
@+$(MAKE) $(1)/install
|
||||
@mkdir -p $$$$(dirname $$($(1)/stamp))
|
||||
@touch $$($(1)/stamp)
|
||||
.PRECIOUS: $$($(1)/stamp) # work around a make bug
|
||||
$$($(1)/stamp-$(3)):
|
||||
@+$(MAKE) $(1)/$(3)
|
||||
@mkdir -p $$$$(dirname $$($(1)/stamp-$(3)))
|
||||
@touch $$($(1)/stamp-$(3))
|
||||
.PRECIOUS: $$($(1)/stamp-$(3)) # work around a make bug
|
||||
|
||||
$(1)//clean:=$(1)/stamp/clean
|
||||
$(1)/stamp/clean: FORCE
|
||||
@rm -f $$($(1)/stamp)
|
||||
$(1)//clean:=$(1)/stamp-$(3)/clean
|
||||
$(1)/stamp-$(3)/clean: FORCE
|
||||
@rm -f $$($(1)/stamp-$(3))
|
||||
|
||||
endef
|
||||
|
@ -9,10 +9,9 @@
|
||||
RELEASE:=Kamikaze
|
||||
#VERSION:=2.0 # uncomment for final release
|
||||
|
||||
all: world
|
||||
|
||||
SHELL:=/usr/bin/env bash
|
||||
OPENWRTVERSION:=$(RELEASE)
|
||||
PREP_MK= OPENWRT_BUILD= QUIET=0
|
||||
include $(TOPDIR)/include/verbose.mk
|
||||
ifneq ($(VERSION),)
|
||||
OPENWRTVERSION:=$(VERSION) ($(OPENWRTVERSION))
|
||||
@ -26,27 +25,26 @@ export OPENWRTVERSION
|
||||
|
||||
ifeq ($(FORCE),)
|
||||
.config scripts/config/conf scripts/config/mconf: tmp/.prereq-build
|
||||
world: prereq
|
||||
endif
|
||||
|
||||
SCAN_COOKIE?=$(shell echo $$$$)
|
||||
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=""
|
||||
@for type in package target; do \
|
||||
tmp/.packageinfo tmp/.targetinfo prepare-tmpinfo: FORCE
|
||||
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=""
|
||||
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
|
||||
./scripts/metadata.pl package_mk < tmp/.packageinfo > tmp/.packagedeps || { rm -f tmp/.packagedeps; false; }
|
||||
|
||||
.config: ./scripts/config/conf prepare-tmpinfo
|
||||
@+if [ \! -f .config ]; then \
|
||||
[ -e $(HOME)/.openwrt/defconfig ] && cp $(HOME)/.openwrt/defconfig .config; \
|
||||
$(NO_TRACE_MAKE) menuconfig QUIET=0 OPENWRT_BUILD=; \
|
||||
$(NO_TRACE_MAKE) menuconfig $(PREP_MK); \
|
||||
fi
|
||||
$< -D .config Config.in &> /dev/null
|
||||
|
||||
scripts/config/mconf:
|
||||
@+$(MAKE) -C scripts/config all
|
||||
@ -88,20 +86,6 @@ tmp/.prereq-build: include/prereq-build.mk
|
||||
}
|
||||
touch $@
|
||||
|
||||
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 || { \
|
||||
echo "Prerequisite check failed. Use FORCE=1 to override."; \
|
||||
false; \
|
||||
}
|
||||
touch $@
|
||||
|
||||
prereq: tmp/.prereq-build tmp/.prereq-package tmp/.prereq-target .config FORCE
|
||||
@true
|
||||
|
||||
download: .config FORCE
|
||||
$(MAKE) -j1 tools/download
|
||||
$(MAKE) -j1 toolchain/download
|
||||
@ -111,8 +95,12 @@ download: .config FORCE
|
||||
clean dirclean distclean:
|
||||
@$(MAKE) $@
|
||||
|
||||
prereq:: .config
|
||||
@+$(SUBMAKE) -s tmp/.prereq-build $(PREP_MK)
|
||||
@$(NO_TRACE_MAKE) -s $@
|
||||
|
||||
%::
|
||||
@$(SUBMAKE) -s prereq QUIET=0 OPENWRT_BUILD=
|
||||
@+$(PREP_MK) $(NO_TRACE_MAKE) -s prereq
|
||||
@+$(MAKE) $@
|
||||
|
||||
help:
|
||||
@ -128,7 +116,9 @@ symlinkclean:
|
||||
-find package -type l | xargs rm -f
|
||||
rm -rf tmp
|
||||
|
||||
.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
|
||||
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 tmp/.packageinfo tmp/.targetinfo prepare-tmpinfo
|
||||
endif
|
||||
.PHONY: help FORCE
|
||||
.NOTPARALLEL:
|
||||
|
||||
|
@ -44,7 +44,7 @@ ifneq ($(KBUILD_VERBOSE),99)
|
||||
MAKE:=&>/dev/null $(MAKE)
|
||||
endif
|
||||
export QUIET:=1
|
||||
MAKE:=cmd() { $(MAKE) $$* || { echo "make $$*: build failed. Please re-run make with V=99 to see what's going on"; false; } } 3>&1 4>&2; cmd
|
||||
MAKE:=cmd() { $(MAKE) -s $$* || { echo "make $$*: build failed. Please re-run make with V=99 to see what's going on"; false; } } 3>&1 4>&2; cmd
|
||||
endif
|
||||
|
||||
.SILENT: $(MAKECMDGOALS)
|
||||
|
@ -6,53 +6,18 @@
|
||||
#
|
||||
# $Id$
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(TOPDIR)/.config
|
||||
include $(INCLUDE_DIR)/host.mk
|
||||
curdir:=package
|
||||
|
||||
all: compile
|
||||
include .config
|
||||
-include $(TMP_DIR)/.packagedeps
|
||||
$(curdir)/builddirs:=$(sort $(package-) $(package-y) $(package-m))
|
||||
$(curdir)/builddirs-compile:=$(sort $(package-y) $(package-m))
|
||||
$(curdir)/builddirs-install:=. $(sort $(package-y))
|
||||
$(curdir)/builddirs-prereq:=. $(sort $(prereq-y) $(prereq-m))
|
||||
|
||||
include $(TMP_DIR)/.packagedeps
|
||||
|
||||
PREREQ_PACKAGES:=$(patsubst %,%-prereq,$(prereq-y) $(prereq-m))
|
||||
DOWNLOAD_PACKAGES:=$(patsubst %,%-download,$(package-y) $(package-m))
|
||||
COMPILE_PACKAGES:=$(patsubst %,%-compile,$(package-y) $(package-m))
|
||||
INSTALL_PACKAGES:=$(patsubst %,%-install,$(package-y))
|
||||
|
||||
$(STAMP_DIR) $(TARGET_DIR):
|
||||
mkdir -p $@
|
||||
|
||||
ifeq ($(QUIET),1)
|
||||
%-compile %-install: FORCE
|
||||
$(MAKE) -j1 -C $* $(patsubst $*-%,%,$@) || { $(call MESSAGE, "*** $* $(patsubst $*-%,%,$@) failed"); false; }
|
||||
|
||||
%-prepare %-prereq %-download %-clean: FORCE
|
||||
else
|
||||
%-prepare %-prereq %-download %-clean %-compile %-install: FORCE
|
||||
endif
|
||||
$(MAKE) -j1 -C $* $(patsubst $*-%,%,$@)
|
||||
|
||||
%-refresh %-update:
|
||||
-$(MAKE) -C $* $(patsubst $*-%,%,$@)
|
||||
|
||||
%-autorefresh:
|
||||
-$(MAKE) -C $* clean refresh QUILT=1
|
||||
|
||||
|
||||
# .IGNORE: $(COMPILE_PACKAGES)
|
||||
|
||||
$(TMP_DIR)/.packagedeps: $(TMP_DIR)/.packageinfo
|
||||
@$(TOPDIR)/scripts/metadata.pl package_mk < $< > $@ || rm -f $@
|
||||
|
||||
preconfig:
|
||||
clean: $(patsubst %,%-clean,$(package-) $(package-y) $(package-m))
|
||||
prereq: $(PREREQ_PACKAGES)
|
||||
download: $(DOWNLOAD_PACKAGES)
|
||||
compile: $(COMPILE_PACKAGES)
|
||||
refresh: $(patsubst %,%-autorefresh,$(package-y) $(package-m) $(package-))
|
||||
|
||||
install-targets: $(INSTALL_PACKAGES)
|
||||
install:
|
||||
$(curdir)//compile:=.config prereq
|
||||
$(curdir)/install:=$(curdir)/install-cleanup
|
||||
$(curdir)/install-cleanup:
|
||||
rm -rf $(BUILD_DIR)/root
|
||||
$(MAKE) install-targets
|
||||
$(MAKE) preconfig
|
||||
@ -71,16 +36,8 @@ install:
|
||||
@-find $(BUILD_DIR)/root -name .svn | $(XARGS) rm -rf
|
||||
@-find $(BUILD_DIR)/root -name '.#*' | $(XARGS) rm -f
|
||||
|
||||
index: $(PACKAGE_DIR)/Packages
|
||||
|
||||
$(PACKAGE_DIR)/Packages: $(PACKAGE_DIR)/*.ipk
|
||||
$(curdir)/index: FORCE
|
||||
(cd $(PACKAGE_DIR); $(SCRIPT_DIR)/ipkg-make-index.sh . > Packages)
|
||||
|
||||
symlinks:
|
||||
../scripts/feeds.sh $(CONFIG_SOURCE_FEEDS) $(CONFIG_SOURCE_FEEDS_REV)
|
||||
|
||||
ifeq ($(MAKECMDGOALS),compile)
|
||||
MAKEFLAGS:=$(MAKEFLAGS) -j$(CONFIG_JLEVEL)
|
||||
else
|
||||
.NOTPARALLEL:
|
||||
endif
|
||||
$(eval $(call stampfile,$(curdir),package,prereq))
|
||||
$(eval $(call subdir,$(curdir)))
|
||||
|
@ -576,12 +576,12 @@ sub gen_package_mk() {
|
||||
undef $idx if $idx =~ /^(kernel)|(base-files)$/;
|
||||
if ($idx) {
|
||||
next if $dep{$pkg->{src}."->".$idx};
|
||||
$depline .= " $idx\-compile";
|
||||
$depline .= " \$(curdir)/$idx/compile";
|
||||
$dep{$pkg->{src}."->".$idx} = 1;
|
||||
}
|
||||
}
|
||||
if ($depline) {
|
||||
$line .= $pkg->{subdir}."$pkg->{src}-compile: $depline\n";
|
||||
$line .= "\$(curdir)/".$pkg->{subdir}."$pkg->{src}/compile := $depline\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -604,7 +604,7 @@ $cmds \\
|
||||
) > \$@
|
||||
|
||||
ifneq (\$(UCI_PRECONFIG)\$(CONFIG_UCI_PRECONFIG),)
|
||||
preconfig: \$(TARGET_DIR)/etc/uci-defaults/$preconfig
|
||||
package/preconfig: \$(TARGET_DIR)/etc/uci-defaults/$preconfig
|
||||
endif
|
||||
EOF
|
||||
}
|
||||
|
@ -21,11 +21,11 @@ endif
|
||||
$(curdir)/gcc/install:=$(curdir)/uClibc/install
|
||||
|
||||
# prerequisites for the individual targets
|
||||
$(curdir)/ := .config $(tools/stamp)
|
||||
$(curdir)/ := .config $(tools/stamp-install) prereq
|
||||
$(curdir)//prepare = $(STAGING_DIR)/include-host/.done
|
||||
$(curdir)//compile = $(1)/prepare
|
||||
$(curdir)//install = $(1)/compile
|
||||
|
||||
$(eval $(call stampfile,$(curdir),toolchain))
|
||||
$(eval $(call stampfile,$(curdir),toolchain,install))
|
||||
$(eval $(call subdir,$(curdir)))
|
||||
|
||||
|
@ -25,9 +25,9 @@ endef
|
||||
$(eval $(call copy_include,$(curdir)))
|
||||
|
||||
# prerequisites for the individual targets
|
||||
$(curdir)/ := .config
|
||||
$(curdir)/ := .config prereq
|
||||
$(curdir)//compile = $(1)/prepare
|
||||
$(curdir)//install = $(1)/compile
|
||||
|
||||
$(eval $(call stampfile,$(curdir),tools))
|
||||
$(eval $(call stampfile,$(curdir),tools,install))
|
||||
$(eval $(call subdir,$(curdir)))
|
||||
|
Loading…
Reference in New Issue
Block a user