summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-10-25 21:55:07 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-10-25 21:55:07 -0600
commit7c03983529f6502206cd40692c794b7c6605d9bf (patch)
treeecac9afa4928b6a1c040c97662371c01fde046c3 /Makefile
parent9f4494685a29714c57cc11d62dead71f7004e061 (diff)
Enable pico-sdk for host binaries
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile14
1 files changed, 8 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index d0c5c78..417bd0c 100644
--- a/Makefile
+++ b/Makefile
@@ -33,15 +33,17 @@ libusb/include/libusb/tusb_helpers.h 3rd-party/MS-LCID.pdf 3rd-party/MS-LCID.txt
################################################################################
-commands := $(patsubst cmd/%/CMakeLists.txt,%,$(wildcard cmd/*/CMakeLists.txt))
-build: $(foreach c,$(commands),cmd/$c/build)
+platforms := $(shell sed -nE 's/if *\(PICO_PLATFORM STREQUAL "(.*)"\)/\1/p' cmd/*/CMakeLists.txt)
+
+build: $(foreach p,$(platforms),build/$p/build)
.PHONY: build
-cmd/%/build: build/%/Makefile $(generate/files)
+$(foreach p,$(platforms),build/$p/Makefile): build/%/Makefile:
+ mkdir -p $(@D) && cd $(@D) && cmake -DCMAKE_BUILD_TYPE=Debug -DPICO_PLATFORM=$* ../..
+
+$(foreach p,$(platforms),build/$p/build): build/%/build: build/%/Makefile
$(MAKE) -C $(<D)
-.PHONY: cmd/%/build
-build/%/Makefile: cmd/%/CMakeLists.txt
- mkdir -p $(@D) && cd $(@D) && cmake -DCMAKE_BUILD_TYPE=Debug -D_UBUILD_CMD=$* $(shell if grep -q pico_sdk_init $<; then echo ' -D_UBUILD_USE_PICO_SDK=1 '; fi) ../..
+.PHONY: $(foreach p,$(platforms),build/$p/build)
generate: $(generate/files)
.PHONY: generate