Rework component makefiles to have a default <component>_ROOT
This fixes a long-standing bug where build directories sometimes expanded many levels deeper than they should have. Component names can now no longer contains slashes (ie the component name for 'extras/i2c' is now just 'i2c')
This commit is contained in:
parent
ed2c1ad713
commit
7e73693898
8 changed files with 24 additions and 23 deletions
|
@ -1,8 +1,7 @@
|
|||
|
||||
INC_DIRS += $(freertos_MAIN)/include $(freertos_MAIN)/portable/esp8266
|
||||
INC_DIRS += $(freertos_MAIN)include $(freertos_MAIN)portable/esp8266
|
||||
|
||||
# args for passing into compile rule generation
|
||||
freertos_ROOT = $(ROOT)FreeRTOS/
|
||||
freertos_MAIN = $(freertos_ROOT)Source/
|
||||
freertos_INC_DIR = $(freertos_MAIN)include $(freertos_MAIN)portable/esp8266
|
||||
freertos_SRC_DIR = $(freertos_MAIN) $(freertos_MAIN)portable/esp8266
|
||||
|
|
|
@ -6,13 +6,12 @@
|
|||
|
||||
# We supply our own hand tweaked config.h in the external 'include' dir.
|
||||
|
||||
AXTLS_DIR = $(ROOT)axtls/axtls/
|
||||
INC_DIRS += $(ROOT)axtls/include $(AXTLS_DIR)ssl $(AXTLS_DIR)crypto
|
||||
AXTLS_DIR = $(axtls_ROOT)axtls/
|
||||
INC_DIRS += $(axtls_ROOT)include $(AXTLS_DIR)ssl $(AXTLS_DIR)crypto
|
||||
|
||||
# args for passing into compile rule generation
|
||||
axtls_ROOT = $(ROOT)axtls
|
||||
axtls_INC_DIR = $(AXTLS_DIR)include $(AXTLS_DIR)
|
||||
axtls_SRC_DIR = $(AXTLS_DIR)crypto $(AXTLS_DIR)ssl $(ROOT)axtls
|
||||
axtls_SRC_DIR = $(AXTLS_DIR)crypto $(AXTLS_DIR)ssl $(axtls_ROOT)
|
||||
|
||||
#axtls_CFLAGS = $(CFLAGS) -Wno-address
|
||||
|
||||
|
|
|
@ -200,6 +200,7 @@ all: $(PROGRAM_OUT) $(FW_FILE_1) $(FW_FILE_2) $(FW_FILE)
|
|||
# Expects that the following component-specific variables are defined:
|
||||
#
|
||||
# $(1)_ROOT = Top-level dir containing component. Can be in-tree or out-of-tree.
|
||||
# (if this variable isn't defined, directory containing component.mk is used)
|
||||
# $(1)_SRC_DIR = List of source directories for the component. All must be under $(1)_ROOT
|
||||
# $(1)_INC_DIR = List of include directories specific for the component
|
||||
#
|
||||
|
@ -214,6 +215,8 @@ all: $(PROGRAM_OUT) $(FW_FILE_1) $(FW_FILE_2) $(FW_FILE)
|
|||
# Each call appends to COMPONENT_ARS which is a list of archive files for compiled components
|
||||
COMPONENT_ARS =
|
||||
define component_compile_rules
|
||||
$(1)_DEFAULT_ROOT := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
$(1)_ROOT ?= $$($(1)_DEFAULT_ROOT)
|
||||
$(1)_OBJ_DIR = $(call lc,$(BUILD_DIR)$(1)/)
|
||||
### determine source files and object files ###
|
||||
$(1)_SRC_FILES ?= $$(foreach sdir,$$($(1)_SRC_DIR), \
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
INC_DIRS += $(core_ROOT)include
|
||||
|
||||
# args for passing into compile rule generation
|
||||
core_ROOT = $(ROOT)core/
|
||||
core_SRC_DIR = $(core_ROOT)
|
||||
|
||||
$(eval $(call component_compile_rules,core))
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# Component makefile for extras/bmp180
|
||||
|
||||
INC_DIRS += $(ROOT)extras
|
||||
# expected anyone using bmp driver includes it as 'bmp180/bmp180.h'
|
||||
INC_DIRS += $(bmp180_ROOT)..
|
||||
|
||||
# args for passing into compile rule generation
|
||||
extras/bmp180_INC_DIR = $(ROOT)extras
|
||||
extras/bmp180_SRC_DIR = $(ROOT)extras/bmp180
|
||||
bmp180_SRC_DIR = $(bmp180_ROOT)
|
||||
|
||||
$(eval $(call component_compile_rules,extras/bmp180))
|
||||
$(eval $(call component_compile_rules,bmp180))
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
# Component makefile for extras/i2c
|
||||
|
||||
INC_DIRS += $(ROOT)extras
|
||||
# expected anyone using i2c driver includes it as 'i2c/i2c.h'
|
||||
INC_DIRS += $(i2c_ROOT)..
|
||||
|
||||
# args for passing into compile rule generation
|
||||
extras/i2c_INC_DIR = $(ROOT)extras
|
||||
extras/i2c_SRC_DIR = $(ROOT)extras/i2c
|
||||
i2c_INC_DIR =
|
||||
i2c_SRC_DIR = $(i2c_ROOT)
|
||||
|
||||
$(eval $(call component_compile_rules,extras/i2c))
|
||||
$(eval $(call component_compile_rules,i2c))
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# Component makefile for extras/rboot-ota
|
||||
|
||||
INC_DIRS += $(ROOT)extras/rboot-ota
|
||||
INC_DIRS += $(rboot-ota_ROOT)
|
||||
|
||||
# args for passing into compile rule generation
|
||||
extras/rboot-ota_INC_DIR = $(ROOT)extras/rboot-ota
|
||||
extras/rboot-ota_SRC_DIR = $(ROOT)extras/rboot-ota
|
||||
rboot-ota_SRC_DIR = $(rboot-ota_ROOT)
|
||||
|
||||
$(eval $(call component_compile_rules,rboot-ota))
|
||||
|
||||
$(eval $(call component_compile_rules,extras/rboot-ota))
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
# Component makefile for LWIP
|
||||
|
||||
LWIP_DIR = $(ROOT)lwip/lwip/src/
|
||||
INC_DIRS += $(LWIP_DIR)include $(ROOT)lwip/include $(ROOT)lwip/include $(LWIP_DIR)include/ipv4 $(LWIP_DIR)include/ipv4/lwip $(LWIP_DIR)include/lwip
|
||||
LWIP_DIR = $(lwip_ROOT)lwip/src/
|
||||
INC_DIRS += $(LWIP_DIR)include $(ROOT)lwip/include $(lwip_ROOT)include $(LWIP_DIR)include/ipv4 $(LWIP_DIR)include/ipv4/lwip $(LWIP_DIR)include/lwip
|
||||
|
||||
# args for passing into compile rule generation
|
||||
lwip_ROOT = $(ROOT)/lwip
|
||||
lwip_INC_DIR = # all in INC_DIRS, needed for normal operation
|
||||
lwip_SRC_DIR = $(ROOT)/lwip $(LWIP_DIR)api $(LWIP_DIR)core $(LWIP_DIR)core/ipv4 $(LWIP_DIR)netif
|
||||
lwip_SRC_DIR = $(lwip_ROOT) $(LWIP_DIR)api $(LWIP_DIR)core $(LWIP_DIR)core/ipv4 $(LWIP_DIR)netif
|
||||
|
||||
# LWIP 1.4.1 generates a single warning so we need to disable -Werror when building it
|
||||
lwip_CFLAGS = $(CFLAGS) -Wno-address
|
||||
|
|
Loading…
Reference in a new issue