@@ -44,8 +44,8 @@ RISCV_ARCHS := rv32i/ilp32 rv32im/ilp32 rv32imac/ilp32
44
44
# - $(3): Arch
45
45
define PRECOMPILED_NEWLIB_RULES
46
46
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
49
49
50
50
endef
51
51
@@ -55,10 +55,10 @@ $(foreach arch,$(RISCV_ARCHS),$(eval $(call PRECOMPILED_NEWLIB_RULES,riscv,riscv
55
55
56
56
# Target to download and extract newlib.
57
57
#
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") .
60
60
$(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 $*
62
62
63
63
# ###############################################################################
64
64
# Picolib Rules
@@ -68,17 +68,19 @@ $(TOCK_NEWLIB_TARGETS):
68
68
69
69
# Rule to ensure that the picolib libraries for an architecture exist.
70
70
#
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.
73
75
#
74
76
# Arguments:
75
77
# - $(1): Family
76
78
# - $(2): Toolchain
77
79
# - $(3): Arch
78
80
define PRECOMPILED_PICOLIB_RULES
79
81
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
82
84
83
85
endef
84
86
@@ -88,10 +90,10 @@ $(foreach arch,$(RISCV_ARCHS),$(eval $(call PRECOMPILED_PICOLIB_RULES,riscv,risc
88
90
89
91
# Target to download and extract picolib.
90
92
#
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") .
93
95
$(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 $*
95
97
96
98
# ###############################################################################
97
99
# LIBC++ Rules
0 commit comments