To start with, all binary objects get sent to the "build" directory. This ends up having a tree structure that parallels the directories that hold the source code.
The game starts with Makefile, which includes the file build-targets.mk as well as other files in support/make.
There are many ways to assign values to Make variables.
The plain "=" sets a value, but does not try to evaluate the right side.
Using ":=" does evaluate the right side immediately.
Using "::=" is the same as ":=" and exists to promote confusion (thanks to POSIX).
Using "?=" sets the value only if it is not set already.
Using "!=" runs the right side as a shell command and assigns the result.
Using "+=" appends to a variable.
.DEFAULT_GOAL := boraxThe following line uses a bunch of tricks.
$(foreach m,$(LIBMAPLE_MODULES),$(eval $(call LIBMAPLE_MODULE_template,$(m))))The syntax of foreach is: $(foreach var,list,text).
The use of eval is a bit tricky. I generates makefile syntax that gets added to the makefile, or something of the sort. See also "info" and "shell".
"call" actually calls a makefile subroutine. Who knew there were such things? There really aren't makefile subroutines, we just have variables, which can be defined via "define" as well as assigning to them. Call just expands the variable after setting $(1) and so on to any "arguments" The one in this case is actually named "LIBMAPLE_MODULE_template" and is defined (using the define command) as:
define LIBMAPLE_MODULE_template dir := $(1) include $$(dir)/rules.mk endefSo it has a single argument (here available as $(1)) which it assigns to the make variable "dir". It then pulls in a file "rules.mk" from that directory. Presumably rules.mk makes use of the value set to dir. Values for "dir" in the maple build scheme might be "./libmaple" or "./wirish".
Tom's Computer Info / tom@mmto.org