2 CONFIGS_REPO_URL ?
= https
://github.com
/betaflight
/config
4 BASE_CONFIGS
= $(sort $(notdir $(patsubst %/,%,$(dir $(wildcard $(CONFIG_DIR
)/configs
/*/config.h
)))))
6 ifneq ($(filter-out %_install
test% %_clean
clean% %-print %.hex
%.h hex checks help configs
$(BASE_TARGETS
) $(BASE_CONFIGS
),$(MAKECMDGOALS
)),)
7 ifeq ($(wildcard $(CONFIG_DIR
)/configs
/),)
8 $(error
`$(CONFIG_DIR)` not found. Have you hydrated configuration using
: 'make configs'?
)
15 $(error TARGET or CONFIG should be specified. Not both.
)
18 CONFIG_FILE
= $(CONFIG_DIR
)/configs
/$(CONFIG
)/config.h
19 INCLUDE_DIRS
+= $(CONFIG_DIR
)/configs
/$(CONFIG
)
21 ifneq ($(wildcard $(CONFIG_FILE
)),)
23 CONFIG_REVISION
:= norevision
24 ifeq ($(shell git
-C
$(CONFIG_DIR
) diff
--shortstat
),)
25 CONFIG_REVISION
:= $(shell git
-C
$(CONFIG_DIR
) log
-1 --format
="%h")
26 CONFIG_REVISION_DEFINE
:= -D
'__CONFIG_REVISION__="$(CONFIG_REVISION)"'
29 TARGET
:= $(shell grep
" FC_TARGET_MCU" $(CONFIG_FILE
) | awk
'{print $$3}' )
30 HSE_VALUE_MHZ
:= $(shell grep
" SYSTEM_HSE_MHZ" $(CONFIG_FILE
) | awk
'{print $$3}' )
31 ifneq ($(HSE_VALUE_MHZ
),)
32 HSE_VALUE
:= $(shell echo
$$(( $(HSE_VALUE_MHZ
) * 1000000 )) )
35 GYRO_DEFINE
:= $(shell grep
" USE_GYRO_" $(CONFIG_FILE
) | awk
'{print $$2}' )
38 $(error No TARGET identified. Is the
$(CONFIG_FILE
) valid for
$(CONFIG
)?
)
41 EXST_ADJUST_VMA
:= $(shell grep
" FC_VMA_ADDRESS" $(CONFIG_FILE
) | awk
'{print $$3}' )
42 ifneq ($(EXST_ADJUST_VMA
),)
47 $(error
`$(CONFIG_FILE)` not found. Have you hydrated configuration using
: 'make configs'?
)
48 endif #config_file exists
53 ifeq ($(wildcard $(CONFIG_DIR
)),)
54 @echo
"Hydrating clone for configs: $(CONFIG_DIR)"
55 $(V0
) git clone
$(CONFIGS_REPO_URL
) $(CONFIG_DIR
)
57 $(V0
) git
-C
$(CONFIG_DIR
) pull
origin
61 @echo
"Building target config $@"
62 $(V0
) $(MAKE
) -j hex CONFIG
=$@
63 @echo
"Building target config $@ succeeded."
65 ## <CONFIG>_rev : build configured target and add revision to filename
66 $(addsuffix _rev
,$(BASE_CONFIGS
)):
67 $(V0
) $(MAKE
) -j hex CONFIG
=$(subst _rev
,,$@
) REV
=yes