Merge pull request #2275 from openmv/makefile_refactor

misc: Export common environment variables from top Makefile.
This commit is contained in:
Ibrahim Abdelkader 2024-07-12 22:11:32 +02:00 committed by GitHub
commit b7c5b7bdeb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 91 additions and 88 deletions

View File

@ -1,7 +1,7 @@
# This file is part of the OpenMV project. # This file is part of the OpenMV project.
# #
# Copyright (c) 2013-2019 Ibrahim Abdelkader <iabdalkader@openmv.io> # Copyright (c) 2013-2024 Ibrahim Abdelkader <iabdalkader@openmv.io>
# Copyright (c) 2013-2019 Kwabena W. Agyeman <kwagyeman@openmv.io> # Copyright (c) 2013-2024 Kwabena W. Agyeman <kwagyeman@openmv.io>
# #
# This work is licensed under the MIT license, see the file LICENSE for details. # This work is licensed under the MIT license, see the file LICENSE for details.
# #
@ -195,5 +195,8 @@ MPY_CFLAGS += -DMP_CONFIGFILE=\<$(OMV_PORT_DIR)/omv_mpconfigport.h\>
# Include the port Makefile. # Include the port Makefile.
include $(OMV_PORT_DIR)/omv_portconfig.mk include $(OMV_PORT_DIR)/omv_portconfig.mk
# Export all common variables
include $(OMV_COMMON_DIR)/export.mk
clean: clean:
$(RM) -fr $(BUILD) $(RM) -fr $(BUILD)

77
src/omv/common/export.mk Normal file
View File

@ -0,0 +1,77 @@
# This file is part of the OpenMV project.
#
# Copyright (c) 2013-2024 Ibrahim Abdelkader <iabdalkader@openmv.io>
# Copyright (c) 2013-2024 Kwabena W. Agyeman <kwagyeman@openmv.io>
#
# This work is licensed under the MIT license, see the file LICENSE for details.
#
# Tools, directories and common variables that need to be exported when calling
# sub-Makefiles.
# Export Commands
export Q
export CC
export CXX
export AS
export LD
export AR
export RM
export CPP
export SIZE
export STRIP
export OBJCOPY
export OBJDUMP
export PYTHON
export MKDIR
export ECHO
export MAKE
export CAT
export TFLITE2C
# Export Flags
export CFLAGS
export AFLAGS
export LDFLAGS
export MPY_CFLAGS
# Export variables
export TARGET
export FIRMWARE
export SYSTEM
export STARTUP
export MICROPY_ARGS
export FROZEN_MANIFEST
# Export board config variables
export PORT
export HAL_DIR
export MCU
export MCU_SERIES
export MCU_VARIANT
export MCU_CORE
# Export Directories
export TOP_DIR
export BUILD
export TOOLS
export FW_DIR
export OMV_DIR
export CMSIS_DIR
export MICROPY_DIR
export LEPTON_DIR
export LSM6DS3_DIR
export LSM6DSOX_DIR
export WINC1500_DIR
export MLX90621_DIR
export MLX90640_DIR
export MLX90641_DIR
export VL53L5CX_DIR
export PIXART_DIR
export DISPLAY_DIR
export LIBPDM_DIR
export TENSORFLOW_DIR
export OMV_BOARD_CONFIG_DIR
export OMV_PORT_DIR
export MP_BOARD_CONFIG_DIR
export OMV_LIB_DIR
export OMV_COMMON_DIR

View File

@ -1,6 +1,6 @@
# Set startup and system files based on MCU. # Set startup and system files for CMSIS Makefile.
SYSTEM ?= mimxrt/system_$(MCU_SERIES) SYSTEM ?= mimxrt/system_$(MCU_SERIES)
STARTUP ?= mimxrt/startup_$(MCU_SERIES) STARTUP ?= mimxrt/startup_$(MCU_SERIES)
LDSCRIPT ?= mimxrt LDSCRIPT ?= mimxrt
# Compiler Flags # Compiler Flags
@ -511,34 +511,6 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/,\
) )
endif endif
###################################################
#Export Variables
export Q
export CC
export CXX
export AS
export LD
export AR
export SIZE
export OBJCOPY
export OBJDUMP
export MKDIR
export ECHO
export CFLAGS
export AFLAGS
export LDFLAGS
export TOP_DIR
export BUILD
export TOOLS
export TARGET
export STARTUP
export SYSTEM
export FROZEN_MANIFEST
export PORT
export HAL_DIR
export CMSIS_DIR
export PYTHON
export TFLITE2C
################################################### ###################################################
all: $(OPENMV) all: $(OPENMV)

View File

@ -2,7 +2,7 @@
SYSTEM ?= nrf/system_nrf52840 SYSTEM ?= nrf/system_nrf52840
STARTUP ?= nrf/startup_$(shell echo $(MCU) | tr '[:upper:]' '[:lower:]') STARTUP ?= nrf/startup_$(shell echo $(MCU) | tr '[:upper:]' '[:lower:]')
LDSCRIPT ?= nrf52xxx LDSCRIPT ?= nrf52xxx
SD_DIR = $(TOP_DIR)/drivers/nrf export SD_DIR = $(TOP_DIR)/drivers/nrf
# Compiler Flags # Compiler Flags
CFLAGS += -std=gnu99 -Wall -Werror -Warray-bounds -mthumb -nostartfiles -fdata-sections -ffunction-sections CFLAGS += -std=gnu99 -Wall -Werror -Warray-bounds -mthumb -nostartfiles -fdata-sections -ffunction-sections
@ -369,28 +369,6 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/modules/ulab/code/,\
) )
endif endif
###################################################
#Export Variables
export Q
export CC
export AS
export LD
export AR
export SIZE
export OBJCOPY
export OBJDUMP
export MKDIR
export ECHO
export CFLAGS
export LDFLAGS
export TOP_DIR
export BUILD
export TARGET
export STARTUP
export SYSTEM
export FROZEN_MANIFEST
export PORT
export SD_DIR
################################################### ###################################################
all: $(OPENMV) all: $(OPENMV)

View File

@ -8,9 +8,7 @@
# RP2 Makefile. # RP2 Makefile.
# This just invokes make in MicroPython RP2 port with OpenMV's cmake arg. # This just invokes make in MicroPython RP2 port with OpenMV's cmake arg.
export PORT export Q=
export TARGET
export TOP_DIR
export CC= export CC=
export CXX= export CXX=

View File

@ -1,6 +1,7 @@
# Set startup and system files based on MCU. # Set startup and system files for CMSIS Makefile.
SYSTEM ?= st/system_stm32fxxx SYSTEM ?= st/system_stm32fxxx
STARTUP ?= st/startup_$(shell echo $(MCU) | tr '[:upper:]' '[:lower:]') STARTUP ?= st/startup_$(shell echo $(MCU) | tr '[:upper:]' '[:lower:]')
LDSCRIPT ?= stm32fxxx LDSCRIPT ?= stm32fxxx
# Compiler Flags # Compiler Flags
@ -645,32 +646,6 @@ UVC_OBJ += $(wildcard $(BUILD)/$(VL53L5CX_DIR)/src/*.o)
UVC_OBJ += $(wildcard $(BUILD)/$(PIXART_DIR)/src/*.o) UVC_OBJ += $(wildcard $(BUILD)/$(PIXART_DIR)/src/*.o)
endif endif
###################################################
#Export Variables
export Q
export CC
export AS
export LD
export AR
export SIZE
export OBJCOPY
export OBJDUMP
export MKDIR
export ECHO
export CFLAGS
export LDFLAGS
export TOP_DIR
export BUILD
export TOOLS
export TARGET
export STARTUP
export SYSTEM
export FROZEN_MANIFEST
export PORT
export HAL_DIR
export CMSIS_DIR
export PYTHON
export TFLITE2C
################################################### ###################################################
all: $(OPENMV) all: $(OPENMV)