Makefile: Rework CUSTOM_KERNEL_IMAGE

Use a conditional variable assignment instead of relying on setting an
intermediate CUSTOM_KERNEL_IMAGE variable to conditionally create a rule
for KERNEL_IMAGE: if a custom KERNEL_IMAGE is passed, it should exist
and if it doesn't, it is the responsibility of the user (not make) to
create it beforehand.

Introduce a DEFAULT_KERNEL_IMAGE location and make a (non-conditionally
existing) rule create it from LINUX_MAKE. Note that, if later on we need
to have a condition that would have checked CUSTOM_KERNEL_IMAGE, we will
be able to instead test ifeq($(KERNEL_IMAGE),$(DEFAULT_KERNEL_IMAGE)).

Define linux_image and KERNEL_IMAGE as targets of the same rule: this
results in make not calling the Linux build system if the image already
exists, stopping tests from pointlessly spending 10+ seconds in the
kernel build system every time they run. Of course, this also means that
new changes in the linux source will not be picked up by this top-level
make and that a user having changed the kernel source while an image of
the kernel exists will be expected to manually rebuild it (or simply
delete the existing image), which they could easily force through

    make linux_image

Bug: 195395681
Test: make KERNEL_IMAGE=<...> test
Change-Id: I3a8f512b35a2c6c85bb493a370c46e629232eea5
diff --git a/Makefile b/Makefile
index b131054..69358c3 100644
--- a/Makefile
+++ b/Makefile
@@ -49,15 +49,11 @@
 ## Common options
 ##
 VERBOSE ?= 0
-CUSTOM_KERNEL_IMAGE = 0
 ARCH = arm64
 
+DEFAULT_KERNEL_IMAGE := $(LINUX_OUT)/arch/arm64/boot/Image
 # KERNEL_IMAGE can be set to use own custom kernel image.
-ifdef KERNEL_IMAGE
-CUSTOM_KERNEL_IMAGE = 1
-else
-KERNEL_IMAGE := $(LINUX_OUT)/arch/arm64/boot/Image
-endif
+KERNEL_IMAGE ?= $(DEFAULT_KERNEL_IMAGE)
 
 ##
 ## Toolchain options and variables
@@ -252,15 +248,10 @@
 	$(call copy_to_dist, $(LINUX_DIST_FILES), $(LINUX_DIST))
 
 .PHONY: linux_image
-linux_image: $(LINUX_CONFIG)
+linux_image $(DEFAULT_KERNEL_IMAGE): $(LINUX_CONFIG)
 	+ $(LINUX_MAKE) Image.gz
 	$(call copy_to_dist, $(LINUX_DIST_FILES), $(LINUX_DIST))
 
-# If using own kernel image (KERNEL_IMAGE is set in the environment), then skip.
-ifeq ($(CUSTOM_KERNEL_IMAGE), 0)
-$(KERNEL_IMAGE): linux_image
-endif
-
 .PHONY: linux_clean
 linux_clean:
 	+ $(LINUX_MAKE) mrproper