|
| 1 | +HV_CONFIG := .config |
| 2 | +HV_DEFCONFIG := defconfig |
| 3 | +HV_CONFIG_H := include/config.h |
| 4 | +HV_CONFIG_MK := include/config.mk |
| 5 | + |
| 6 | +KCONFIG_DIR := $(BASEDIR)/../scripts/kconfig |
| 7 | + |
| 8 | +$(eval $(call check_dep_exec,python)) |
| 9 | +$(eval $(call check_dep_exec,pip)) |
| 10 | +$(eval $(call check_dep_pylib,kconfiglib)) |
| 11 | + |
| 12 | +# This target invoke silentoldconfig to generate a .config only if a .config |
| 13 | +# does not exist. Useful as a dependency for source compilation. |
| 14 | +$(HV_OBJDIR)/$(HV_CONFIG): |
| 15 | + @mkdir -p $(HV_OBJDIR) |
| 16 | + @python $(KCONFIG_DIR)/silentoldconfig.py Kconfig $(HV_OBJDIR)/$(HV_CONFIG) PLATFORM_$(shell echo $(PLATFORM) | tr a-z A-Z)=y |
| 17 | + |
| 18 | +$(HV_OBJDIR)/$(HV_CONFIG_MK): $(HV_OBJDIR)/$(HV_CONFIG) |
| 19 | + @mkdir -p $(dir $@) |
| 20 | + @cp $< $@ |
| 21 | + |
| 22 | +$(HV_OBJDIR)/$(HV_CONFIG_H): $(HV_OBJDIR)/$(HV_CONFIG) |
| 23 | + @mkdir -p $(dir $@) |
| 24 | + @python $(KCONFIG_DIR)/generate_header.py Kconfig $< $@ |
| 25 | + |
| 26 | +# This target forcefully generate a .config based on a given default |
| 27 | +# one. Overwrite the current .config if it exists. |
| 28 | +.PHONY: defconfig |
| 29 | +defconfig: |
| 30 | + @mkdir -p $(HV_OBJDIR) |
| 31 | + @python $(KCONFIG_DIR)/defconfig.py Kconfig arch/x86/configs/$(PLATFORM).config $(HV_OBJDIR)/$(HV_CONFIG) |
| 32 | + |
| 33 | +# Use silentoldconfig to forcefully update the current .config, or generate a |
| 34 | +# new one if no previous .config exists. This target can be used as a |
| 35 | +# prerequisite of all the others to make sure that the .config is consistent |
| 36 | +# even it has been modified manually before. |
| 37 | +.PHONY: oldconfig |
| 38 | +oldconfig: |
| 39 | + @mkdir -p $(HV_OBJDIR) |
| 40 | + @python $(KCONFIG_DIR)/silentoldconfig.py Kconfig $(HV_OBJDIR)/$(HV_CONFIG) PLATFORM_$(shell echo $(PLATFORM) | tr a-z A-Z)=y |
| 41 | + |
| 42 | +# Minimize the current .config. This target can be used to generate a defconfig |
| 43 | +# for future use. |
| 44 | +.PHONY: minimalconfig |
| 45 | +minimalconfig: $(HV_OBJDIR)/$(HV_CONFIG) |
| 46 | + @python $(KCONFIG_DIR)/minimalconfig.py Kconfig $(HV_OBJDIR)/$(HV_CONFIG) $(HV_OBJDIR)/$(HV_DEFCONFIG) |
| 47 | + |
| 48 | +-include $(HV_OBJDIR)/$(HV_CONFIG_MK) |
0 commit comments