this seems to work quite nicely as a local Makefile using the new options from the develop branch.
it allows me to store my apps and gcc in whatever directory i like (not inside the firmware repo) and just call “make” from inside my app directory, it will then compile a dfu file in cwd/build-core/ or cwd/build-photon/ and i can upload using “make all program-dfu”
i also updated the “clean” target to remove the cwd/build-core/ directory, not just the stuff inside firmware/build/target/
i turn on verbose by default.
nothing is hardcoded, so i can use the same Makefile in all of my apps. and just modify the PLATFORM.
Makefile:
GCC_ARM_PATH = $(HOME)/gcc-arm-none-eabi/bin/
APPDIR = $(realpath $(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
APP = $(notdir $(CURDIR))
PLATFORM = core
TARGET_DIR = $(CURDIR)/build-$(PLATFORM)
all:
clean: local_clean
local_clean:
rm -rf $(TARGET_DIR)
%:
$(MAKE) -C $(HOME)/firmware/main APP=$(APP) PLATFORM=$(PLATFORM) APPDIR=$(APPDIR) GCC_ARM_PATH=$(GCC_ARM_PATH) TARGET_DIR=$(TARGET_DIR) v=1 $@
everything after the $(MAKE) should be all on one line, but the forum has wrapped it.
you end up with a directory structure like:
blink/
├── blink.cpp
├── build-core
│ ├── blink.bin
│ ├── blink.bin.crc_block
│ ├── blink.bin.no_crc
│ ├── blink.elf
│ ├── blink.hex
│ ├── blink.lst
│ ├── blink.map
│ └── obj
└── Makefile