Skip to content

Build the tools with $(MAKE), not bare make - #774

Closed
quarrel07 wants to merge 1 commit into
n64decomp:masterfrom
quarrel07:macos-tools-make
Closed

Build the tools with $(MAKE), not bare make#774
quarrel07 wants to merge 1 commit into
n64decomp:masterfrom
quarrel07:macos-tools-make

Conversation

@quarrel07

Copy link
Copy Markdown
Contributor

On macOS the tools are not built, and the failure points somewhere else entirely.

tools/Makefile:51 generates its per-tool rules with:

define COMPILE =
$(1): $($1_SOURCES)
	$(CC) $(CFLAGS) $($1_CFLAGS) $$^ -o $$@
endef

$(foreach p,$(PROGRAMS),$(eval $(call COMPILE,$(p))))

define NAME = is GNU make 3.82 syntax. macOS still ships 3.81 as make, where those rules never take effect, so make falls back to its built-in %: %.c rule and links each tool from its first source file alone. n64graphics_SOURCES := n64graphics.c utils.c, so utils.c is dropped:

Undefined symbols for architecture arm64:
  "_g_verbosity", referenced from:
      _rgba2raw in n64graphics-7584c8.o
...
make[1]: *** [n64graphics] Error 1

Nothing there suggests the make version is at fault.

docs/basics/compiling.md already tells macOS users to build with gmake, but Makefile:201 then calls bare make and undoes it. The root makefile uses !=, which needs make 4.0, so $(MAKE) is always new enough.

Verified on macOS 26.6, Apple Silicon. Deleting tools/n64graphics and running the root build: with bare make it stays missing and the build fails; with $(MAKE) it is rebuilt and make reports mk64.us: OK.

macOS still ships GNU make 3.81 as `make`, and tools/Makefile generates
its per-tool rules with `define COMPILE =`, which is 3.82 syntax. Under
3.81 those rules do not take effect and make falls back to its built-in
%: %.c rule, so each tool is linked from its first source file alone.
n64graphics is built from n64graphics.c and utils.c, so it fails with an
undefined _g_verbosity rather than anything that points at the cause.

The docs already tell macOS users to build with gmake, but this line
then calls bare make and undoes that. This makefile needs 4.0+ for != in
the first place, so $(MAKE) is always a new enough make.
@quarrel07

Copy link
Copy Markdown
Contributor Author

Folded into #772.

@quarrel07 quarrel07 closed this Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant