@@ -44,8 +44,8 @@ RISCV_ARCHS := rv32i/ilp32 rv32im/ilp32 rv32imac/ilp32
4444# - $(3): Arch
4545define PRECOMPILED_NEWLIB_RULES
4646
47- TOCK_NEWLIB_TARGETS += $$(TOCK_USERLAND_BASE_DIR ) /lib/%/$(1 ) /$(2 ) /lib/$(3 ) /libc.a
48- TOCK_NEWLIB_TARGETS += $$(TOCK_USERLAND_BASE_DIR ) /lib/%/$(1 ) /$(2 ) /lib/$(3 ) /libm.a
47+ TOCK_NEWLIB_TARGETS += $$(TOCK_USERLAND_BASE_DIR ) /lib/libtock-newlib- %/$(1 ) /$(2 ) /lib/$(3 ) /libc.a
48+ TOCK_NEWLIB_TARGETS += $$(TOCK_USERLAND_BASE_DIR ) /lib/libtock-newlib- %/$(1 ) /$(2 ) /lib/$(3 ) /libm.a
4949
5050endef
5151
@@ -55,10 +55,10 @@ $(foreach arch,$(RISCV_ARCHS),$(eval $(call PRECOMPILED_NEWLIB_RULES,riscv,riscv
5555
5656# Target to download and extract newlib.
5757#
58- # % will match something like " libtock-newlib-4.2.0.20211231" which we then
59- # strip down to just the version with some string manipulation .
58+ # `$*` will match the version number in the libtock-newlib folder name
59+ # (something like "libtock-newlib-4.2.0.20211231") .
6060$(TOCK_NEWLIB_TARGETS ) :
61- cd $(TOCK_USERLAND_BASE_DIR ) /lib; ./fetch-newlib.sh $( patsubst libtock-newlib- % , % , $* )
61+ cd $(TOCK_USERLAND_BASE_DIR ) /lib; ./fetch-newlib.sh $*
6262
6363# ###############################################################################
6464# Picolib Rules
@@ -68,17 +68,19 @@ $(TOCK_NEWLIB_TARGETS):
6868
6969# Rule to ensure that the picolib libraries for an architecture exist.
7070#
71- # Need to list all libraries which are possible targets to tell make that one
72- # invocation of this build rule will make all the target files.
71+ # Need to list all libraries which are possible targets into one variable. It is
72+ # imperative that the wildcard `%` expands to the same value for every target to
73+ # tell make that one invocation of this build rule will make all the target
74+ # files.
7375#
7476# Arguments:
7577# - $(1): Family
7678# - $(2): Toolchain
7779# - $(3): Arch
7880define PRECOMPILED_PICOLIB_RULES
7981
80- TOCK_PICOLIB_TARGETS += $$(TOCK_USERLAND_BASE_DIR ) /lib/%/$(1 ) /$(2 ) /lib/$(3 ) /libc.a
81- TOCK_PICOLIB_TARGETS += $$(TOCK_USERLAND_BASE_DIR ) /lib/%/$(1 ) /$(2 ) /lib/$(3 ) /libm.a
82+ TOCK_PICOLIB_TARGETS += $$(TOCK_USERLAND_BASE_DIR ) /lib/libtock-picolib- %/$(1 ) /$(2 ) /lib/$(3 ) /libc.a
83+ TOCK_PICOLIB_TARGETS += $$(TOCK_USERLAND_BASE_DIR ) /lib/libtock-picolib- %/$(1 ) /$(2 ) /lib/$(3 ) /libm.a
8284
8385endef
8486
@@ -88,10 +90,10 @@ $(foreach arch,$(RISCV_ARCHS),$(eval $(call PRECOMPILED_PICOLIB_RULES,riscv,risc
8890
8991# Target to download and extract picolib.
9092#
91- # % will match something like " libtock-picolib-1.8.5" which we then strip down
92- # to just the version with some string manipulation .
93+ # `$*` will match the version number in the libtock-picolib folder name
94+ # (something like "libtock-picolib-1.8.5") .
9395$(TOCK_PICOLIB_TARGETS ) :
94- cd $(TOCK_USERLAND_BASE_DIR ) /lib; ./fetch-picolib.sh $( patsubst libtock-picolib- % , % , $* )
96+ cd $(TOCK_USERLAND_BASE_DIR ) /lib; ./fetch-picolib.sh $*
9597
9698# ###############################################################################
9799# LIBC++ Rules
0 commit comments