aboutsummaryrefslogtreecommitdiff
path: root/scripts/Makefile.host
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/Makefile.host')
-rw-r--r--scripts/Makefile.host23
1 files changed, 21 insertions, 2 deletions
diff --git a/scripts/Makefile.host b/scripts/Makefile.host
index 2e628508d..7b380460a 100644
--- a/scripts/Makefile.host
+++ b/scripts/Makefile.host
@@ -92,13 +92,32 @@ endif
92hostc_flags = -Wp,-MD,$(depfile) $(__hostc_flags) 92hostc_flags = -Wp,-MD,$(depfile) $(__hostc_flags)
93hostcxx_flags = -Wp,-MD,$(depfile) $(__hostcxx_flags) 93hostcxx_flags = -Wp,-MD,$(depfile) $(__hostcxx_flags)
94 94
95# Programs built for use on the host are defined without a suffix
96# (usually '.exe' on Windows). Rather than adjust all the makefiles
97# force a suffix of '.' if the host platform is mingw32. This will
98# result in binaries with no suffix.
99#
100# It's not a big deal if this doesn't work. MSYS2 doesn't need it
101# and the downside is just that the programs will be rebuilt more
102# often than really needed.
103#
104host_target := $(shell $(HOSTCC) -v 2>&1 | grep ^Target:)
105host_platform := $(word 4,$(subst -, ,$(host_target)))
106dot :=
107ifeq ($(host_platform),mingw32)
108dot := .
109endif
110ifeq ($(host_platform),windows)
111dot := .
112endif
113
95##### 114#####
96# Compile programs on the host 115# Compile programs on the host
97 116
98# Create executable from a single .c file 117# Create executable from a single .c file
99# host-csingle -> Executable 118# host-csingle -> Executable
100quiet_cmd_host-csingle = HOSTCC $@ 119quiet_cmd_host-csingle = HOSTCC $@
101 cmd_host-csingle = $(HOSTCC) $(hostc_flags) -o $@ $< \ 120 cmd_host-csingle = $(HOSTCC) $(hostc_flags) -o $@$(dot) $< \
102 $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) 121 $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
103$(host-csingle): %: %.c FORCE 122$(host-csingle): %: %.c FORCE
104 $(call if_changed_dep,host-csingle) 123 $(call if_changed_dep,host-csingle)
@@ -106,7 +125,7 @@ $(host-csingle): %: %.c FORCE
106# Link an executable based on list of .o files, all plain c 125# Link an executable based on list of .o files, all plain c
107# host-cmulti -> executable 126# host-cmulti -> executable
108quiet_cmd_host-cmulti = HOSTLD $@ 127quiet_cmd_host-cmulti = HOSTLD $@
109 cmd_host-cmulti = $(HOSTCC) $(HOSTLDFLAGS) -o $@ \ 128 cmd_host-cmulti = $(HOSTCC) $(HOSTLDFLAGS) -o $@$(dot) \
110 $(addprefix $(obj)/,$($(@F)-objs)) \ 129 $(addprefix $(obj)/,$($(@F)-objs)) \
111 $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) 130 $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
112$(host-cmulti): %: $(host-cobjs) $(host-cshlib) FORCE 131$(host-cmulti): %: $(host-cobjs) $(host-cshlib) FORCE