# Makefile for FunKey-OS # # Copyright (C) 2020 by Michel Stempin # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # BRMAKE = buildroot/utils/brmake -C buildroot BR = make -C buildroot # Strip quotes and then whitespaces qstrip = $(strip $(subst ",,$(1))) #")) # 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) .PHONY: fun source image defconfig clean distclean .IGNORE: _Makefile_ %/Makefile: @: all: buildroot/Makefile fun image @: buildroot/README: @$(call MESSAGE,"Getting buildroot") 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: @$(call MESSAGE,"Getting sources") @$(BR) BR2_EXTERNAL=../Recovery O=../Recovery/output source @$(BR) BR2_EXTERNAL=../FunKey O=../FunKey/output source image: @$(call MESSAGE,"Creating disk image") mkdir -p root tmp ./Recovery/output/host/bin/genimage --inputpath . 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: @$(call MESSAGE,"Clean everything") @$(BR) BR2_EXTERNAL=../Recovery O=../Recovery/output distclean @$(BR) BR2_EXTERNAL=../FunKey O=../FunKey/output distclean distclean: clean @$(call MESSAGE,"Really clean everything") rm -rf download images FunKey/output/.config: @$(call MESSAGE,"Configure FunKey") mkdir -p FunKey/board/funkey/patches @$(BR) BR2_EXTERNAL=../FunKey O=../FunKey/output funkey_defconfig Recovery/output/.config: @$(call MESSAGE,"Configure Recovery") mkdir -p Recovery/board/funkey/patches @$(BR) BR2_EXTERNAL=../Recovery O=../Recovery/output recovery_defconfig