improved meta-meta Makefile

Signed-off-by: Michel-FK <michel.stempin@funkey-project.com>
This commit is contained in:
Michel-FK 2020-10-21 23:20:17 +02:00
parent 4219e3db9e
commit 41fdbd1ccc

View File

@ -20,56 +20,82 @@
BRMAKE = buildroot/utils/brmake -C buildroot BRMAKE = buildroot/utils/brmake -C buildroot
BR = make -C buildroot BR = make -C buildroot
.PHONY: fun source image clean distclean # Strip quotes and then whitespaces
qstrip = $(strip $(subst ",,$(1)))
#"))
.IGNORE: Makefile # MESSAGE Macro -- display a message in bold type
MESSAGE = echo "$(shell date +%Y-%m-%dT%H:%M:%S) $(TERM_BOLD)\#\#\# $(call qstrip,$(1))$(TERM_RESET)"
TERM_BOLD := $(shell tput smso 2>/dev/null)
TERM_RESET := $(shell tput rmso 2>/dev/null)
all: fun image .PHONY: fun source image defconfig clean distclean
fun: download Recovery/output/.config FunKey/output/.config .IGNORE: _Makefile_
@echo "*** Making fun"
$(BRMAKE) BR2_EXTERNAL=../Recovery O=../Recovery/output
$(BRMAKE) BR2_EXTERNAL=../FunKey O=../FunKey/output
FunKey/%: download FunKey/output/.config %/Makefile:
@echo "*** Making $(notdir $@) in $(subst /,,$(dir $@))" @:
$(BR) BR2_EXTERNAL=../FunKey O=../FunKey/output $(notdir $@)
Recovery/%: download Recovery/output/.config all: buildroot/Makefile fun image
@echo "*** Making $(notdir $@) in $(subst /,,$(dir $@))" @:
$(BR) BR2_EXTERNAL=../Recovery O=../Recovery/output $(notdir $@)
%: download FunKey/output/.config buildroot/README:
@echo "*** Making $* in FunKey" @$(call MESSAGE,"Getting buildroot")
$(BR) BR2_EXTERNAL=../FunKey O=../FunKey/output $* git submodule init
git submodule update
fun: Recovery/output/.config FunKey/output/.config
@$(call MESSAGE,"Making fun")
@$(call MESSAGE,"Making fun in Recovery")
@$(BRMAKE) BR2_EXTERNAL=../Recovery O=../Recovery/output
@$(call MESSAGE,"Making fun in FunKey")
@$(BRMAKE) BR2_EXTERNAL=../FunKey O=../FunKey/output
FunKey/%: FunKey/output/.config
@$(call MESSAGE,"Making $(notdir $@) in $(subst /,,$(dir $@))")
@$(BR) BR2_EXTERNAL=../FunKey O=../FunKey/output $(notdir $@)
Recovery/%: Recovery/output/.config
@$(call MESSAGE,"Making $(notdir $@) in $(subst /,,$(dir $@))")
@$(BR) BR2_EXTERNAL=../Recovery O=../Recovery/output $(notdir $@)
%: FunKey/output/.config
@$(call MESSAGE,"Making $@ in FunKey")
@$(BR) BR2_EXTERNAL=../FunKey O=../FunKey/output $@
source: source:
@echo "*** Getting sources" @$(call MESSAGE,"Getting sources")
$(BR) BR2_EXTERNAL=../Recovery O=../Recovery/output source @$(BR) BR2_EXTERNAL=../Recovery O=../Recovery/output source
$(BR) BR2_EXTERNAL=../FunKey O=../FunKey/output source @$(BR) BR2_EXTERNAL=../FunKey O=../FunKey/output source
image: image:
@$(call MESSAGE,"Creating disk image")
mkdir -p root tmp mkdir -p root tmp
./Recovery/output/host/bin/genimage --inputpath . ./Recovery/output/host/bin/genimage --inputpath .
rm -rf root tmp rm -rf root tmp
defconfig:
@$(call MESSAGE,"Updating default configs")
@$(call MESSAGE,"Updating default configs in Recovery")
@$(BR) BR2_EXTERNAL=../Recovery O=../Recovery/output savedefconfig linux-update-defconfig uboot-update-defconfig busybox-update-config
@$(call MESSAGE,"Updating default configs in FunKey")
@$(BR) BR2_EXTERNAL=../FunKey O=../FunKey/output savedefconfig linux-update-defconfig uboot-update-defconfig busybox-update-config
clean: clean:
@echo "*** Clean everything" @$(call MESSAGE,"Clean everything")
$(BR) BR2_EXTERNAL=../Recovery O=../Recovery/output distclean @$(BR) BR2_EXTERNAL=../Recovery O=../Recovery/output distclean
$(BR) BR2_EXTERNAL=../FunKey O=../FunKey/output distclean @$(BR) BR2_EXTERNAL=../FunKey O=../FunKey/output distclean
distclean: clean distclean: clean
@echo "*** Really clean everything" @$(call MESSAGE,"Really clean everything")
rm -rf download images rm -rf download images
download:
@echo "*** Making download directory"
mkdir -rf download
FunKey/output/.config: FunKey/output/.config:
@echo "*** Configure FunKey" @$(call MESSAGE,"Configure FunKey")
$(BR) BR2_EXTERNAL=../FunKey O=../FunKey/output funkey_defconfig mkdir -p FunKey/board/funkey/patches
@$(BR) BR2_EXTERNAL=../FunKey O=../FunKey/output funkey_defconfig
Recovery/output/.config: Recovery/output/.config:
@echo "*** Configure Recovery" @$(call MESSAGE,"Configure Recovery")
$(BR) BR2_EXTERNAL=../Recovery O=../Recovery/output recovery_defconfig mkdir -p Recovery/board/funkey/patches
@$(BR) BR2_EXTERNAL=../Recovery O=../Recovery/output recovery_defconfig