]> git.proxmox.com Git - wasi-libc.git/blobdiff - Makefile
Override Make's default for CC and AR.
[wasi-libc.git] / Makefile
index 98aa995bc124269057925838a534e14f8d2e33e5..44acdee993cf9c99a72b2773dac92a81f4337e7c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,13 @@
 # These variables are specifically meant to be overridable via the make
 # command-line.
-CC ?= clang
+# ?= doesn't work for CC and AR because make has a default value for them.
+ifeq ($(origin CC), default)
+CC := clang
+endif
 NM ?= $(patsubst %clang,%llvm-nm,$(filter-out ccache sccache,$(CC)))
-AR ?= $(patsubst %clang,%llvm-ar,$(filter-out ccache sccache,$(CC)))
+ifeq ($(origin AR), default)
+AR = $(patsubst %clang,%llvm-ar,$(filter-out ccache sccache,$(CC)))
+endif
 EXTRA_CFLAGS ?= -O2 -DNDEBUG
 # The directory where we build the sysroot.
 SYSROOT ?= $(CURDIR)/sysroot