#
# GNUmakefile - Setting Env and Call kernel Makefile
#
# Copyright (c) 2020 Panasonic Corporation
# 2020-07-16 Modified
#
# This file may be used subject to the terms and conditions of the
# GNU General Public License Version 2, or any later version
# at your option, as published by the Free Software Foundation.
# 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.
#

ifneq ($(PVCPF_MTYPE),pvc04v)
	$(error invalid PVCPF_MTYPE.)
endif

DEFCONFIG=pvc04v_$(PVCPF_SUBMODEL)$(PVCPF_HW_VERSION)_defconfig

GNUmakefile: ;

.config:
	LOCALVERSION= $(MAKE) -f Makefile $(DEFCONFIG)
	LOCALVERSION= $(MAKE) -f Makefile clean

Image: .config
# -j% :parallel processing
# number of logical CPU cores
#	LOCALVERSION= $(MAKE) -f Makefile Image modules dtbs -j`grep processor /proc/cpuinfo | wc -l`
# number of physical CPU cores
	LOCALVERSION= $(MAKE) -f Makefile Image modules dtbs -j`grep cpu.cores /proc/cpuinfo | sort -u | sed 's/[^0-9]//g'`

install: Image
	LOCALVERSION= $(MAKE) -f Makefile modules_install $(INSTALL_MOD_PATH)

%: FORCE
	LOCALVERSION= $(MAKE) -f Makefile $@

FORCE: ;
