Blob Blame History Raw
# Make rules for configuration files.
#
# $Id$

OUTPUT := $(abspath ../../)
ifeq ("$(origin O)", "command line")
  _EXTRA_ARGS := O=$(O)
  OUTPUT := $(O)
endif

CFG		= kernel-$(VERSION)
CFG_DIR		= $(OUTPUT)/configs

CONFIGFILES	= \
	$(CFG)-aarch64.config  $(CFG)-aarch64-debug.config

PLATFORMS	= arm64
TEMPFILES	= $(addprefix temp-, $(addsuffix -generic, $(PLATFORMS)))

configs: clean-configs $(CONFIGFILES)
	@rm -f kernel-*-config
	@rm -f $(TEMPFILES)
	@rm -f temp-generic temp-*-generic temp-*-generic-tmp

# Clean up our cruft so old merge files aren't used
clean-configs:
	@rm -fv $(CONFIGFILES) $(TEMPFILES) temp-arm64* kernel-*config config-*-merged

# Augment the clean target to clean up our own cruft
clean ::
	@rm -fv $(CONFIGFILES) $(TEMPFILES) temp-arm64* kernel-*config config-*-merged

configs-prep: clean configs
	@rm -fr $(CFG_DIR)
	@mkdir -p $(CFG_DIR)
	@cp $(CFG)*.config $(CFG_DIR)
	@cd ../../ && \
	for i in $(CFG_DIR)/*.config; do \
		mv $$i $(OUTPUT)/.config; \
		ARCH=$$(head -1 $(OUTPUT)/.config | cut -b 3-); \
		echo "Configuring $$i"; \
		make ARCH=$$ARCH listnewconfig $(_EXTRA_ARGS) >/dev/null || exit 1; \
		make ARCH=$$ARCH oldnoconfig $(_EXTRA_ARGS) >/dev/null || exit 1; \
		echo "# $$ARCH" > $$i; \
		cat $(OUTPUT)/.config >> $$i; \
		rm $(OUTPUT)/.config; \
	done

config-%-merged:
	@if [ -f $$(basename $@ -merged)-redhat ]; then \
		perl merge.pl $$(basename $@ -merged)-redhat $$(basename $@ -merged) >$@; \
	else \
		cp $$(basename $@ -merged) $@; \
	fi

temp-generic: config-nodebug-merged config-generic-merged
	cat $^ > temp-generic

temp-debug-generic: config-debug-merged config-generic-merged
	cat $^ > temp-debug-generic

temp-arm-generic: config-arm-generic-merged temp-generic
	perl merge.pl $^ > $@

temp-arm-debug-generic: config-arm-generic-merged temp-debug-generic
	perl merge.pl $^ > $@

temp-arm64: config-arm64-merged temp-arm-generic
	perl merge.pl $^ > $@

temp-arm64-debug: config-arm64-merged temp-arm-debug-generic
	perl merge.pl $^ > $@

$(CFG)-aarch64.config: /dev/null temp-arm64
	perl merge.pl $^ arm64 > $@

$(CFG)-aarch64-debug.config: /dev/null temp-arm64-debug
	perl merge.pl $^ arm64 > $@