first stab at having all intermediate + binary files in a different folders - hopefully allow more than one build at the same time eventually

This commit is contained in:
Gordon Williams 2022-02-16 16:56:22 +00:00
parent 5da94d2513
commit 3f62edcfc4
6 changed files with 40 additions and 21 deletions

View File

@ -37,8 +37,9 @@
# CC3000=1 # If compiling for a non-linux target that has internet support, use CC3000 support
# USB_PRODUCT_ID=0x1234 # force a specific USB Product ID (default 0x5740)
#
# GENDIR=MyGenDir # sets directory for files generated during make
# # GENDIR=/home/mydir/mygendir
# GENDIR=MyGenDir # sets directory for intermediate files generated during make
# OBJDIR=MyObjDir # sets directory for object files generated during make
# BINDIR=MyBinDir # sets directory for binaries generated during make
# SETDEFINES=FileDefines # settings which are called after definitions for board are done
# # SETDEFINES=/home/mydir/myDefines
# UNSUPPORTEDMAKE=FileUnsu# Adds additional files from unsupported sources(means not supported by Gordon) to actual make
@ -65,6 +66,12 @@ include make/sanitycheck.make
ifndef GENDIR
GENDIR=gen
endif
ifndef OBJDIR
OBJDIR=obj
endif
ifndef BINDIR
BINDIR=bin
endif
ifndef SINGLETHREAD
MAKEFLAGS=-j5 # multicore
@ -172,9 +179,9 @@ endif
# Get info out of BOARDNAME.py
# ---------------------------------------------------------------------------------
# TODO: could check board here and make clean if it's different?
$(shell rm -f CURRENT_BOARD.make)
$(shell python scripts/get_makefile_decls.py $(BOARD) > CURRENT_BOARD.make)
include CURRENT_BOARD.make
$(shell rm -f $(GENDIR)/CURRENT_BOARD.make)
$(shell python scripts/get_makefile_decls.py $(BOARD) > $(GENDIR)/CURRENT_BOARD.make)
include $(GENDIR)/CURRENT_BOARD.make
#set or reset defines like USE_GRAPHIC from an external file to customize firmware
ifdef SETDEFINES
@ -668,7 +675,13 @@ PININFOFILE=$(GENDIR)/jspininfo
SOURCES += $(PININFOFILE).c
SOURCES += $(WRAPPERSOURCES) $(TARGETSOURCES)
SOURCEOBJS = $(SOURCES:.c=.o) $(CPPSOURCES:.cpp=.o) $(CCSOURCES:.cc=.o)
SOURCEOBJS = $(patsubst %.c,$(OBJDIR)/%.o,$(SOURCES))
ifdef CPPSOURCES
SOURCEOBJS += $(patsubst %.cpp,$(OBJDIR)/%.cpp.o,$(CPPSOURCES))
endif
ifdef CCSOURCES
SOURCEOBJS += $(patsubst %.cc,$(OBJDIR)/%.cc.o,$(CCSOURCES))
endif
OBJS = $(PRECOMPILED_OBJS) $(SOURCEOBJS)
@ -795,25 +808,30 @@ quiet_link= LD $@
quiet_obj_dump= GEN $(PROJ_NAME).lst
quiet_obj_to_bin= GEN $(PROJ_NAME).$2
%.o: %.c $(PLATFORM_CONFIG_FILE) $(PININFOFILE).h
$(OBJDIR)/%.o: %.c $(PLATFORM_CONFIG_FILE) $(PININFOFILE).h
@echo $($(quiet_)compile)
@mkdir -p $(shell dirname $@) # create directory if it doesn't exist
@$(call compile)
.cc.o: %.cc $(PLATFORM_CONFIG_FILE) $(PININFOFILE).h
$(OBJDIR)/%.cc.o: %.cc $(PLATFORM_CONFIG_FILE) $(PININFOFILE).h
@echo $($(quiet_)compile)
@mkdir -p $(shell dirname $@) # create directory if it doesn't exist
@$(CC) $(CCFLAGS) $(CFLAGS) $< -o $@
.cpp.o: $(PLATFORM_CONFIG_FILE) $(PININFOFILE).h
$(OBJDIR)/%.cpp.o: $(PLATFORM_CONFIG_FILE) $(PININFOFILE).h
@echo $($(quiet_)compile)
@mkdir -p $(shell dirname $@) # create directory if it doesn't exist
@$(call compile)
# case sensitive - Nordic's files are capitals
.s.o:
$(OBJDIR)/%.s.o:
@echo $($(quiet_)compile)
@mkdir -p $(shell dirname $@) # create directory if it doesn't exist
@$(call compile)
.S.o:
$(OBJDIR)/%.S.o:
@echo $($(quiet_)compile)
@mkdir -p $(shell dirname $@) # create directory if it doesn't exist
@$(call compile)
ifdef LINUX # ---------------------------------------------------
@ -832,8 +850,7 @@ lst: $(PROJ_NAME).lst
clean:
@echo Cleaning targets
$(Q)find . -name \*.o | grep -v "./arm-bcm2708\|./gcc-arm-none-eabi" | xargs rm -f
$(Q)find . -name \*.d | grep -v "./arm-bcm2708\|./gcc-arm-none-eabi" | xargs rm -f
$(Q)rm -rf $(OBJDIR)/*
$(Q)rm -f $(ROOT)/gen/*.c $(ROOT)/gen/*.h $(ROOT)/gen/*.ld
$(Q)rm -f $(ROOT)/scripts/*.pyc $(ROOT)/boards/*.pyc
$(Q)rm -f $(PROJ_NAME).elf

1
bin/README.md Normal file
View File

@ -0,0 +1 @@
This is where built binaries go

1
build/README.md Normal file
View File

@ -0,0 +1 @@
Intermediate build files end up here

View File

@ -12,7 +12,7 @@ ifdef NRF_SDK17
# Use SDK17
NRF5X_SDK=17
NRF5X_SDK_17=1
NRF5X_SDK_PATH=$(ROOT)/targetlibs/nrf5x_17
NRF5X_SDK_PATH=targetlibs/nrf5x_17
DEFINES += -DNRF_SD_BLE_API_VERSION=7
DEFINES += -D__HEAP_SIZE=0
ifeq ($(CHIP),NRF52840)
@ -29,7 +29,7 @@ ifdef NRF_SDK15
# Use SDK15
NRF5X_SDK=15
NRF5X_SDK_15=1
NRF5X_SDK_PATH=$(ROOT)/targetlibs/nrf5x_15
NRF5X_SDK_PATH=targetlibs/nrf5x_15
DEFINES += -DNRF_SD_BLE_API_VERSION=6
DEFINES += -D__HEAP_SIZE=0
ifeq ($(CHIP),NRF52840)
@ -48,7 +48,7 @@ ifdef NRF_SDK14
# Use SDK14
NRF5X_SDK=14
NRF5X_SDK_14=1
NRF5X_SDK_PATH=$(ROOT)/targetlibs/nrf5x_14
NRF5X_SDK_PATH=targetlibs/nrf5x_14
DEFINES += -DNRF_SD_BLE_API_VERSION=5
DEFINES += -D__HEAP_SIZE=0
ifeq ($(CHIP),NRF52840)
@ -61,14 +61,14 @@ ifdef NRF_SDK11
# Use SDK11
NRF5X_SDK=11
NRF5X_SDK_11=1
NRF5X_SDK_PATH=$(ROOT)/targetlibs/nrf5x_11
NRF5X_SDK_PATH=targetlibs/nrf5x_11
DEFINES += -DNRF_SD_BLE_API_VERSION=2
SOFTDEVICE = $(SOFTDEVICE_PATH)/hex/s132_nrf52_2.0.0_softdevice.hex
else
# Use SDK12
NRF5X_SDK=12
NRF5X_SDK_12=1
NRF5X_SDK_PATH=$(ROOT)/targetlibs/nrf5x_12
NRF5X_SDK_PATH=targetlibs/nrf5x_12
DEFINES += -DNRF_SD_BLE_API_VERSION=3
SOFTDEVICE = $(SOFTDEVICE_PATH)/hex/s132_nrf52_3.1.0_softdevice.hex
endif

View File

@ -1,4 +1,4 @@
TENSOR_ROOT := $(ROOT)/libs/tensorflow
TENSOR_ROOT := libs/tensorflow
CCSOURCES += \
$(TENSOR_ROOT)/tensorflow/lite/micro/simple_memory_allocator.cc \
$(TENSOR_ROOT)/tensorflow/lite/micro/memory_helpers.cc \

View File

@ -53,7 +53,7 @@ if binaryName.find('.bin')>=0:
binaryName = binaryName[:binaryName.find('.bin')]
if binaryName.find('.hex')>=0:
binaryName = binaryName[:binaryName.find('.hex')]
print("PROJ_NAME="+binaryName)
print("PROJ_NAME=$(BINDIR)/"+binaryName)
if board.chip["family"]!="LINUX":
print("EMBEDDED=1")
@ -76,5 +76,5 @@ if 'USB' in board.devices:
if 'bootloader' in board.info and board.info['bootloader']==1:
print("USE_BOOTLOADER:=1")
print("BOOTLOADER_PROJ_NAME:=bootloader_$(PROJ_NAME)")
print("BOOTLOADER_PROJ_NAME:=$(BINDIR)/bootloader_"+binaryName)
print("DEFINES+=-DUSE_BOOTLOADER")