From 738747bd0589ff304e17d2b3efd6f3dbf88ad809 Mon Sep 17 00:00:00 2001 From: ayan george Date: Thu, 28 Sep 2023 12:49:48 -0400 Subject: [PATCH] build: use $(MAKE) to represent make executable Prior to this commit, our Makefiles assumed the name of the make program was simply "make". Since we use GNU make extensions, this isn't always the case -- operating systems like FreeBSD come with their own implementation named make which can be incompatible with the extensions used in by tinygo. To run a compatible make on some of these systems, we have explicitly call GNU make by running gmake. This commit changes references to the command "make" to "$(MAKE)" which is a variable that contains the name of the executable invoked to process the Makefile. This allow the Makefiles to be uniformly processed by the same make program. --- Makefile | 4 ++-- docs/Makefile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 03c3f17d..cf41866c 100644 --- a/Makefile +++ b/Makefile @@ -265,7 +265,7 @@ endif wasi-libc: lib/wasi-libc/sysroot/lib/wasm32-wasi/libc.a lib/wasi-libc/sysroot/lib/wasm32-wasi/libc.a: @if [ ! -e lib/wasi-libc/Makefile ]; then echo "Submodules have not been downloaded. Please download them using:\n git submodule update --init"; exit 1; fi - cd lib/wasi-libc && make -j4 EXTRA_CFLAGS="-O2 -g -DNDEBUG -mnontrapping-fptoint -msign-ext" MALLOC_IMPL=none CC=$(CLANG) AR=$(LLVM_AR) NM=$(LLVM_NM) + cd lib/wasi-libc && $(MAKE) -j4 EXTRA_CFLAGS="-O2 -g -DNDEBUG -mnontrapping-fptoint -msign-ext" MALLOC_IMPL=none CC=$(CLANG) AR=$(LLVM_AR) NM=$(LLVM_NM) # Check for Node.js used during WASM tests. NODEJS_VERSION := $(word 1,$(subst ., ,$(shell node -v | cut -c 2-))) @@ -280,7 +280,7 @@ endif # Build the Go compiler. tinygo: - @if [ ! -f "$(LLVM_BUILDDIR)/bin/llvm-config" ]; then echo "Fetch and build LLVM first by running:"; echo " make llvm-source"; echo " make $(LLVM_BUILDDIR)"; exit 1; fi + @if [ ! -f "$(LLVM_BUILDDIR)/bin/llvm-config" ]; then echo "Fetch and build LLVM first by running:"; echo " $(MAKE) llvm-source"; echo " $(MAKE) $(LLVM_BUILDDIR)"; exit 1; fi CGO_CPPFLAGS="$(CGO_CPPFLAGS)" CGO_CXXFLAGS="$(CGO_CXXFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" $(GOENVFLAGS) $(GO) build -buildmode exe -o build/tinygo$(EXE) -tags "byollvm osusergo" -ldflags="-X github.com/tinygo-org/tinygo/goenv.GitSha1=`git rev-parse --short HEAD`" . test: wasi-libc check-nodejs-version CGO_CPPFLAGS="$(CGO_CPPFLAGS)" CGO_CXXFLAGS="$(CGO_CXXFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" $(GO) test $(GOTESTFLAGS) -timeout=20m -buildmode exe -tags "byollvm osusergo" ./builder ./cgo ./compileopts ./compiler ./interp ./transform . diff --git a/docs/Makefile b/docs/Makefile index e7128bfe..fb389beb 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -16,7 +16,7 @@ I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help help: - @echo "Please use \`make ' where is one of" + @echo "Please use \`$(MAKE) ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file"