-
Notifications
You must be signed in to change notification settings - Fork 72
/
defconfig.mk
59 lines (49 loc) · 2.08 KB
/
defconfig.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
DEFCONFIGSRC := $(KERNEL_DIR)/arch/$(KERNEL_TARGET_ARCH)/configs
LJAPDEFCONFIGSRC := ${DEFCONFIGSRC}/ext_config
KERNEL_DEFCONFIG := $(firstword $(KERNEL_DEFCONFIG))
DEFCONFIG_BASENAME := $(subst _defconfig,,$(KERNEL_DEFCONFIG))
ifneq ($(TARGET_BUILD_VARIANT), user)
DEFCONFIG_BASENAME := $(subst _debug,,$(DEFCONFIG_BASENAME))
endif
TARGET_DEFCONFIG := $(KERNEL_DIR)/kernel/configs/moto_extra.config
PRODUCT_SPECIFIC_DEFCONFIGS := $(LJAPDEFCONFIGSRC)/moto-$(DEFCONFIG_BASENAME).config
KERNEL_DEBUG_DEFCONFIG := $(LJAPDEFCONFIGSRC)/debug-$(DEFCONFIG_BASENAME).config
PRODUCT_KERNEL_DEBUG_DEFCONFIG := $(LJAPDEFCONFIGSRC)/$(PRODUCT_DEBUG_DEFCONFIG)
FACTORY_DEFCONFIG := $(LJAPDEFCONFIGSRC)/factory-$(DEFCONFIG_BASENAME).config
# add debug config file for non-user build
ifneq ($(TARGET_BUILD_VARIANT), user)
ifneq ($(wildcard $(KERNEL_DEBUG_DEFCONFIG)),)
PRODUCT_SPECIFIC_DEFCONFIGS += $(KERNEL_DEBUG_DEFCONFIG)
endif
# Add a product-specific debug defconfig, too
ifneq ($(PRODUCT_DEBUG_DEFCONFIG),)
PRODUCT_SPECIFIC_DEFCONFIGS += $(PRODUCT_KERNEL_DEBUG_DEFCONFIG)
endif
endif
ifeq ($(TARGET_FACTORY_DEFCONFIG), true)
PRODUCT_SPECIFIC_DEFCONFIGS += $(FACTORY_DEFCONFIG)
endif
# append all additional configs
ifneq ($(KERNEL_EXTRA_CONFIG),)
PRODUCT_SPECIFIC_DEFCONFIGS += $(KERNEL_EXTRA_CONFIG:%=$(LJAPDEFCONFIGSRC)/%.config)
endif
#some configs need adjust on df build,but not final builds.
#Actually df bulids include user/userdebug,so we use one specifci config files to
#adjust such configs.
ifneq ($(PRODUCT_IS_PRODUCTION),true)
PRODUCT_SPECIFIC_DEFCONFIGS += $(LJAPDEFCONFIGSRC)/moto-$(DEFCONFIG_BASENAME)-df.config
endif
define do-make-defconfig
$(hide) mkdir -p $(dir $(1))
$(hide) printf "# This file was automatically generated from:\n" > $(1);
$(hide) $(foreach f, $(2), printf "#\t" >> $(1); echo $(f) >> $(1);)
$(hide) printf "\n" >> $(1)
$(hide) cat $(2) >> $(1)
endef
#
# make combined defconfig file
#---------------------------------------
$(TARGET_DEFCONFIG): FORCE $(PRODUCT_SPECIFIC_DEFCONFIGS)
$(call do-make-defconfig,$@,$(PRODUCT_SPECIFIC_DEFCONFIGS))
.PHONY: FORCE
FORCE: