@@ -62,17 +62,14 @@ TOYBOX_ROOT := $(BASEDIR)/tmp
6262TOYBOX_VER := 0.8.12
6363TOYBOX_SRC := $(TOYBOX_ROOT ) /toybox-$(TOYBOX_VER )
6464
65- # ------------------------------------------------------------------------
66- # Detect the host system.
67- # On Windows uname -s might return MINGW_NT-* or CYGWIN_NT-*.
68- # Otherwise let it default to the kernel name returned by uname -s
69- # (Linux, Darwin, FreeBSD, …).
70- # ------------------------------------------------------------------------
71- OS ?= $(shell uname -s)
65+ # Detect the target system
66+ # See https://doc.rust-lang.org/beta/rustc/platform-support.html
67+ # todo: support building wasm
68+ OS := $(or $(CARGO_BUILD_TARGET ) ,$(shell rustc --print host-tuple) )
7269
7370# Windows does not allow symlink by default.
7471# Allow to override LN for AppArmor.
75- ifneq (,$(findstring _NT ,$(OS ) ) )
72+ ifneq (,$(findstring windows ,$(OS ) ) )
7673 LN ?= ln -f
7774endif
7875LN ?= ln -sf
@@ -97,7 +94,7 @@ SELINUX_PROGS := \
9794
9895$(info Detected OS = $(OS))
9996
100- ifeq (,$(findstring MINGW ,$(OS ) ) )
97+ ifeq (,$(findstring windows ,$(OS ) ) )
10198 PROGS += $(UNIX_PROGS)
10299endif
103100ifeq ($(SELINUX_ENABLED ) ,1)
@@ -288,7 +285,7 @@ install: build install-manpages install-completions install-locales
288285 mkdir -p $(INSTALLDIR_BIN )
289286ifneq (,$(and $(findstring stdbuf,$(UTILS ) ) ,$(findstring feat_external_libstdbuf,$(CARGOFLAGS ) ) ) )
290287 mkdir -p $(DESTDIR)$(LIBSTDBUF_DIR)
291- ifneq (,$(findstring CYGWIN ,$(OS ) ) )
288+ ifneq (,$(findstring cygwin ,$(OS ) ) )
292289 $(INSTALL) -m 755 $(BUILDDIR)/deps/stdbuf.dll $(DESTDIR)$(LIBSTDBUF_DIR)/libstdbuf.dll
293290else
294291 $(INSTALL) -m 755 $(BUILDDIR)/deps/libstdbuf.* $(DESTDIR)$(LIBSTDBUF_DIR)/
308305endif
309306
310307uninstall :
311- ifeq (,$(findstring MINGW ,$(OS ) ) )
308+ ifeq (,$(findstring windows ,$(OS ) ) )
312309 rm -f $(DESTDIR)$(LIBSTDBUF_DIR)/libstdbuf.*
313310 -rm -d $(DESTDIR)$(LIBSTDBUF_DIR) 2>/dev/null || true
314311endif
0 commit comments