Skip to content

Commit

Permalink
makefiles: Support .exe executable prefix on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Ericson2314 committed Jan 12, 2024
1 parent a38e6b9 commit 34bb6dc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions mk/programs.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
programs-list :=

ifdef HOST_WINDOWS
EXE_EXT = .exe
else
EXE_EXT =
endif

# Build a program with symbolic name $(1). The program is defined by
# various variables prefixed by ‘$(1)_’:
#
Expand Down Expand Up @@ -31,7 +37,7 @@ define build-program
_srcs := $$(sort $$(foreach src, $$($(1)_SOURCES), $$(src)))
$(1)_OBJS := $$(addprefix $(buildprefix), $$(addsuffix .o, $$(basename $$(_srcs))))
_libs := $$(foreach lib, $$($(1)_LIBS), $$(foreach lib2, $$($$(lib)_LIB_CLOSURE), $$($$(lib2)_PATH)))
$(1)_PATH := $$(_d)/$$($(1)_NAME)
$(1)_PATH := $$(_d)/$$($(1)_NAME)$(EXE_EXT)

$$(eval $$(call create-dir, $$(_d)))

Expand All @@ -42,7 +48,7 @@ define build-program

ifdef $(1)_INSTALL_DIR

$(1)_INSTALL_PATH := $$($(1)_INSTALL_DIR)/$$($(1)_NAME)
$(1)_INSTALL_PATH := $$($(1)_INSTALL_DIR)/$$($(1)_NAME)$(EXE_EXT)

$$(eval $$(call create-dir, $$($(1)_INSTALL_DIR)))

Expand Down

0 comments on commit 34bb6dc

Please sign in to comment.