From 23c6e066bd392dbc7b87565ff91c36cca7a65f61 Mon Sep 17 00:00:00 2001 From: Tim Allen Date: Mon, 2 May 2022 00:17:58 +1000 Subject: [PATCH] Use $(CC) as the compiler on Linux. While other platforms may have a standard compiler that can be hardcoded, Linux systems may want to switch between gcc and clang, or even a wrapper script for producing portable static binaries like musl-gcc. Using the standard $(CC) variable for the compiler name makes it easy to override the compiler choice without having to modify makefiles. --- Materials/platforms/inweb-on-linux.mk | 4 ++-- Materials/platforms/linux.mkscript | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Materials/platforms/inweb-on-linux.mk b/Materials/platforms/inweb-on-linux.mk index 5497845..16a63e6 100644 --- a/Materials/platforms/inweb-on-linux.mk +++ b/Materials/platforms/inweb-on-linux.mk @@ -73,8 +73,8 @@ safe: $(call make-me-using-safety-copy) define make-me-once-tangled - gcc -std=c11 -c $(MANYWARNINGS) $(CCOPTS) -g -o $(ME)/Tangled/$(ME).o $(ME)/Tangled/$(ME).c - gcc $(CCOPTS) -o $(ME)/Tangled/$(ME)$(EXEEXTENSION) $(ME)/Tangled/$(ME).o -lm -pthread $(LDFLAGS) + $(CC) -std=c11 -c $(MANYWARNINGS) $(CCOPTS) -g -o $(ME)/Tangled/$(ME).o $(ME)/Tangled/$(ME).c + $(CC) $(CCOPTS) -o $(ME)/Tangled/$(ME)$(EXEEXTENSION) $(ME)/Tangled/$(ME).o -lm -pthread $(LDFLAGS) endef define make-me diff --git a/Materials/platforms/linux.mkscript b/Materials/platforms/linux.mkscript index e492729..68cc893 100644 --- a/Materials/platforms/linux.mkscript +++ b/Materials/platforms/linux.mkscript @@ -65,15 +65,15 @@ INWEB = inweb/Tangled/inweb # and one for linking those *.o files into an executable. {define: compile to: TO from: FROM ?options: OPTS} - gcc -std=c11 -c $(MANYWARNINGS) $(CCOPTS) -g {OPTS} -o {TO} {FROM} + $(CC) -std=c11 -c $(MANYWARNINGS) $(CCOPTS) -g {OPTS} -o {TO} {FROM} {end-define} {define: compile-indulgently to: TO from: FROM ?options: OPTS} - gcc -std=c99 -c $(FEWERWARNINGS) $(CCOPTS) -g {OPTS} -o {TO} {FROM} + $(CC) -std=c99 -c $(FEWERWARNINGS) $(CCOPTS) -g {OPTS} -o {TO} {FROM} {end-define} {define: link to: TO from: FROM ?options: OPTS} - gcc $(CCOPTS) -o {TO} {FROM} {OPTS} -lm -pthread $(LDFLAGS) + $(CC) $(CCOPTS) -o {TO} {FROM} {OPTS} -lm -pthread $(LDFLAGS) {end-define} # Where: