jscrane / uC-Makefile

Makefile for Microcontrollers
GNU General Public License v2.0
10 stars 2 forks source link

All-in-one #12

Closed jscrane closed 1 year ago

jscrane commented 5 years ago

Have a single include for all architectures, with defines for each scoped by processor family.

Aim is to allow a single makefile to build a sketch for multiple architectures.

jscrane commented 5 years ago

A single file is included, uC.mk, which includes all of the other architectures previously included.

Architecture-specific include files, e.g., arduino-esp32.mk, esp32.mk, etc., have defines scoped by the architecture. Thus it should be possible to say,

make -I ~/src/uC-makefile esp32

Backward-compatibility would also be nice: if, e.g., arduino-esp32.mk is included, it should become the default.

jscrane commented 5 years ago
a: CPPFLAGS += -I "foo"
a: all
b: CPPFLAGS += -I "bar"
b: all

CPPFLAGS := -I .. -I $@

all:
        echo $(CPPFLAGS)

.PHONY: a/foo b/foo

%/bar: %
        echo $(@D)
jscrane commented 5 years ago

For now have bodged this with conditionals and renaming of fragments. However there must be a better solution involving target- and pattern-specific macros.

jscrane commented 5 years ago

Think a better solution involves using a prefix macro:

p = foo
foo_board := d1_mini

Then find board and use that to search various board.txt:

board = $($p_board)