Use nice OpenWRT make output

This commit is contained in:
Matthias Schiffer 2013-02-17 16:30:59 +01:00
parent 102c0bd1f8
commit 593e90d1f5
3 changed files with 111 additions and 47 deletions

129
Makefile
View File

@ -1,25 +1,74 @@
GLUONDIR:=${CURDIR}
LN_S:=ln -sf
all: all:
$(MAKE) prepare
$(MAKE) images LC_ALL:=C
LANG:=C
export LC_ALL LANG
GLUONMAKE = $(SUBMAKE) -C $(GLUON_OPENWRTDIR) -f $(GLUONDIR)/Makefile
ifneq ($(OPENWRT_BUILD),1)
GLUONDIR:=${CURDIR}
include $(GLUONDIR)/builder/gluon.mk include $(GLUONDIR)/builder/gluon.mk
BOARD := ar71xx TOPDIR:=$(GLUON_OPENWRTDIR)
PROFILES := export TOPDIR
PROFILE_PACKAGES :=
include $(TOPDIR)/include/host.mk
empty:=
space:= $(empty) $(empty)
_SINGLE=export MAKEFLAGS=$(space);
override OPENWRT_BUILD=1
GREP_OPTIONS=
export OPENWRT_BUILD GREP_OPTIONS
include $(TOPDIR)/include/debug.mk
include $(TOPDIR)/include/depends.mk
include $(TOPDIR)/include/toplevel.mk
all: FORCE
+@$(GLUONMAKE) prepare
+@$(GLUONMAKE) images
prepare: FORCE
+@$(GLUONMAKE) prepare
images: FORCE
+@$(GLUONMAKE) images
clean: clean-gluon
clean-gluon:
rm -rf $(GLUON_BUILDDIR)
else
include $(GLUONDIR)/builder/gluon.mk
include $(TOPDIR)/include/host.mk
include rules.mk
include $(INCLUDE_DIR)/depends.mk
include $(INCLUDE_DIR)/subdir.mk
include target/Makefile
include package/Makefile
include tools/Makefile
include toolchain/Makefile
null := null :=
space := ${null} ${null} space := ${null} ${null}
${space} := ${space} ${space} := ${space}
prepared_stamp := $(GLUON_BUILDDIR)/$(BOARD)/prepared BOARD := ar71xx
PROFILES :=
PROFILE_PACKAGES :=
gluon_prepared_stamp := $(GLUON_BUILDDIR)/$(BOARD)/prepared
define GluonProfile define GluonProfile
image/$(1): $(prepared_stamp) image/$(1): $(gluon_prepared_stamp)
$(MAKE) -C $(GLUON_BUILDERDIR) image \ $(MAKE) -C $(GLUON_BUILDERDIR) image \
PROFILE="$(1)" \ PROFILE="$(1)" \
$(if $(2),PACKAGES="$(2)") $(if $(2),PACKAGES="$(2)")
@ -28,32 +77,56 @@ PROFILES += $(1)
PROFILE_PACKAGES += $(filter-out -%,$(2)) PROFILE_PACKAGES += $(filter-out -%,$(2))
endef endef
include profiles.mk include $(GLUONDIR)/profiles.mk
prepare: $(BUILD_DIR)/.prepared: Makefile
@mkdir -p $$(dirname $@)
@touch $@
$(toolchain/stamp-install): $(tools/stamp-install)
$(target/stamp-compile): $(toolchain/stamp-install) $(tools/stamp-install) $(BUILD_DIR)/.prepared
$(package/stamp-cleanup): $(target/stamp-compile)
$(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup)
$(package/stamp-install): $(package/stamp-compile)
$(package/stamp-rootfs-prepare): $(package/stamp-install)
$(target/stamp-install): $(package/stamp-compile) $(package/stamp-install) $(package/stamp-rootfs-prepare)
feeds: FORCE
ln -sf $(GLUON_BUILDERDIR)/feeds.conf feeds.conf
scripts/feeds uninstall -a
scripts/feeds update -a
scripts/feeds install -a
rm -f $(TMP_DIR)/info/.files-packageinfo-$(SCAN_COOKIE)
$(SUBMAKE) prepare-tmpinfo OPENWRT_BUILD=0
config: FORCE
echo -e 'CONFIG_TARGET_$(BOARD)=y\nCONFIG_TARGET_ROOTFS_JFFS2=n\n$(subst ${ },\n,$(patsubst %,CONFIG_PACKAGE_%=m,$(GLUON_PACKAGES) $(PROFILE_PACKAGES)))' > .config
$(SUBMAKE) defconfig OPENWRT_BUILD=0
toolchain: $(toolchain/stamp-install) $(tools/stamp-install)
target: $(target/stamp-compile)
packages: $(package/stamp-compile)
prepare: FORCE
mkdir -p $(GLUON_IMAGEDIR) $(GLUON_BUILDDIR)/$(BOARD) mkdir -p $(GLUON_IMAGEDIR) $(GLUON_BUILDDIR)/$(BOARD)
echo 'src packages file:../openwrt/bin/$(BOARD)/packages' > $(GLUON_BUILDDIR)/$(BOARD)/opkg.conf echo 'src packages file:../openwrt/bin/$(BOARD)/packages' > $(GLUON_BUILDDIR)/$(BOARD)/opkg.conf
$(LN_S) $(GLUON_BUILDERDIR)/feeds.conf $(GLUON_OPENWRTDIR)/feeds.conf $(GLUONMAKE) feeds
$(GLUON_OPENWRTDIR)/scripts/feeds uninstall -a $(GLUONMAKE) config
$(GLUON_OPENWRTDIR)/scripts/feeds update -a $(GLUONMAKE) toolchain
$(GLUON_OPENWRTDIR)/scripts/feeds install -a $(GLUONMAKE) target
$(GLUONMAKE) packages
$(SUBMAKE) -C $(GLUON_BUILDERDIR) prepare
echo -e "CONFIG_TARGET_$(BOARD)=y\nCONFIG_TARGET_ROOTFS_JFFS2=n\n$(subst ${ },\n,$(patsubst %,CONFIG_PACKAGE_%=m,$(GLUON_PACKAGES) $(PROFILE_PACKAGES)))" > $(GLUON_OPENWRTDIR)/.config touch $(gluon_prepared_stamp)
$(MAKE) -C $(GLUON_OPENWRTDIR) defconfig prepare package/compile
$(MAKE) -C $(GLUON_BUILDERDIR) prepare
touch $(prepared_stamp)
$(prepared_stamp): $(prepared_stamp):
$(MAKE) prepare $(MAKE) prepare
images: $(patsubst %,image/%,$(PROFILES)) images: $(patsubst %,image/%,$(PROFILES))
clean:
rm -rf $(GLUON_BUILDDIR)
cleanall: clean
$(MAKE) -C $(GLUON_OPENWRTDIR) clean
.PHONY: all images prepare clean cleanall .PHONY: all images prepare clean cleanall
endif

View File

@ -7,24 +7,11 @@
# See /LICENSE for more information. # See /LICENSE for more information.
# #
GLUONDIR:=${CURDIR}/.. all: image
include ${CURDIR}/gluon.mk include ${CURDIR}/gluon.mk
TOPDIR:=$(GLUON_OPENWRTDIR)
LC_ALL:=C
LANG:=C
export TOPDIR LC_ALL LANG
export OPENWRT_VERBOSE=s
all: image
include $(TOPDIR)/include/host.mk include $(TOPDIR)/include/host.mk
ifneq ($(OPENWRT_BUILD),1)
override OPENWRT_BUILD=1
export OPENWRT_BUILD
endif
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PACKAGE_DIR := $(GLUON_OPENWRTDIR)/bin/$(BOARD)/packages PACKAGE_DIR := $(GLUON_OPENWRTDIR)/bin/$(BOARD)/packages
@ -93,7 +80,10 @@ prepare: FORCE
$(MAKE) -C $(TOPDIR)/target/linux/$(BOARD)/image -f $(GLUON_BUILDERDIR)/Makefile.image prepare KDIR="$(BOARD_KDIR)" $(MAKE) -C $(TOPDIR)/target/linux/$(BOARD)/image -f $(GLUON_BUILDERDIR)/Makefile.image prepare KDIR="$(BOARD_KDIR)"
$(MAKE) package_index $(MAKE) package_index
_call_image: image/%:: FORCE
$(MAKE) assemble_image PROFILE="$(patsubst image/%,%,$@)"
assemble_image:
echo 'Building images for $(BOARD)$(if $($(PROFILE)_NAME), - $($(PROFILE)_NAME))' echo 'Building images for $(BOARD)$(if $($(PROFILE)_NAME), - $($(PROFILE)_NAME))'
echo 'Packages: $(BUILD_PACKAGES)' echo 'Packages: $(BUILD_PACKAGES)'
echo echo
@ -165,10 +155,9 @@ build_image: FORCE
image: image:
(unset PROFILE FILES PACKAGES MAKEFLAGS; \ (unset PROFILE FILES PACKAGES MAKEFLAGS; \
$(MAKE) _call_image \ $(MAKE) image/$(PROFILE) OPENWRT_VERBOSE="$(OPENWRT_VERBOSE)" \
$(if $(PROFILE),PROFILE="$(PROFILE)") \ $(if $(FILES),USER_FILES="$(FILES)") \
$(if $(FILES),USER_FILES="$(FILES)") \ $(if $(PACKAGES),USER_PACKAGES="$(PACKAGES)") \
$(if $(PACKAGES),USER_PACKAGES="$(PACKAGES)") \
) )
.SILENT: prepare image .SILENT: prepare image

View File

@ -7,6 +7,8 @@ GLUON_OPENWRTDIR := $(GLUONDIR)/openwrt
GLUON_BUILDERDIR := $(GLUONDIR)/builder GLUON_BUILDERDIR := $(GLUONDIR)/builder
GLUON_BUILDDIR := $(GLUONDIR)/build GLUON_BUILDDIR := $(GLUONDIR)/build
export GLUONDIR GLUON_SITEDIR GLUON_IMAGEDIR GLUON_OPENWRTDIR GLUON_BUILDERDIR GLUON_BUILDDIR
$(GLUON_SITEDIR)/site.mk: $(GLUON_SITEDIR)/site.mk:
$(error There was no site configuration found. Please check out a site configuration to $(GLUON_SITEDIR)) $(error There was no site configuration found. Please check out a site configuration to $(GLUON_SITEDIR))