Use NAME instead of hard-coding the name.

Windows NT systems use the `.exe` extension, and thus binary name cannot
be hard-coded.
This commit is contained in:
2026-01-22 12:52:47 +01:00
parent 51dc8f85a6
commit 7ef3d16b53

View File

@@ -7,6 +7,7 @@ SHELL = /bin/sh
.SUFFIXES: .SUFFIXES:
VERSION = 0.0 VERSION = 0.0
NAME = mcaselector-lite
CMAKE ?= cmake -G 'Unix Makefiles' CMAKE ?= cmake -G 'Unix Makefiles'
XXD ?= xxd XXD ?= xxd
@@ -57,7 +58,7 @@ endif
# Default target; compiles everything. # Default target; compiles everything.
.PHONY: .PHONY:
all: bin/mcaselector-lite bin/mcaselector-lite.stripped all: bin/$(NAME) bin/stripped_$(NAME)
# TODO: Compile libraries with `all` # TODO: Compile libraries with `all`
# TODO: Write install recipe to install into DESTDIR, for UNIX® type systems, and Windows NT alongside uninstall recipes. # TODO: Write install recipe to install into DESTDIR, for UNIX® type systems, and Windows NT alongside uninstall recipes.
@@ -78,10 +79,10 @@ clean:
-$(Q)$(RM) -r bin/ -$(Q)$(RM) -r bin/
# Links together the object files into the final binary. # Links together the object files into the final binary.
bin/mcaselector-lite: $(OBJ) | bin/ bin/$(NAME): $(OBJ) | bin/
$(Q)$(call msg-ld,$@) $(Q)$(call msg-ld,$@)
$(Q)$(CC) $(LDFLAGS) $(LDLIBS) -o $@ $^ $(Q)$(CC) $(LDFLAGS) $(LDLIBS) -o $@ $^
bin/mcaselector-lite.stripped: $(OBJ) | bin/ bin/stripped_$(NAME): $(OBJ) | bin/
$(Q)$(call msg-ld,$@) $(Q)$(call msg-ld,$@)
$(Q)$(CC) -s $(LDFLAGS) $(LDLIBS) -o $@ $^ $(Q)$(CC) -s $(LDFLAGS) $(LDLIBS) -o $@ $^