From 86441df336fd25afd5748d4e5aa9789f8dd4dc7b Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Thu, 21 Apr 2022 18:47:54 -0700 Subject: [PATCH] Platform settings for Linux This changes the variables in the platform settings to work more like the ones in the other platforms, and updates their values. --- Materials/platforms/inweb-on-linux.mk | 15 ++++++++++---- Materials/platforms/linux.mk | 11 ++++++++-- Materials/platforms/linux.mkscript | 29 ++++++++++++++++++--------- 3 files changed, 40 insertions(+), 15 deletions(-) diff --git a/Materials/platforms/inweb-on-linux.mk b/Materials/platforms/inweb-on-linux.mk index e0a6de9..e787446 100644 --- a/Materials/platforms/inweb-on-linux.mk +++ b/Materials/platforms/inweb-on-linux.mk @@ -7,12 +7,19 @@ INFORM6OS = LINUX GLULXEOS = OS_UNIX -EXEEXTENSION = +EXEEXTENSION = INTEST = intest/Tangled/intest INWEB = inweb/Tangled/inweb -GCCWARNINGS = -Wall -Wextra -Wno-pointer-to-int-cast -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-unknown-pragmas +CCOPTS = -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -DPLATFORM_LINUX -fdiagnostics-color=auto -O2 + +MANYWARNINGS = -Wall -Wextra -Wimplicit-fallthrough=2 -Wno-pointer-to-int-cast \ + -Wno-unknown-pragmas -Wno-unused-but-set-parameter \ + -Wno-unused-but-set-variable -Wno-unused-function -Wno-unused-parameter \ + -Wno-unused-variable -fmax-errors=1000 + +FEWERWARNINGS = -Wno-implicit-int ME = inweb FTEST = $(ME)/foundation-test @@ -61,8 +68,8 @@ safe: $(call make-me-using-safety-copy) define make-me-once-tangled - gcc -c -D_BSD_SOURCE -DPLATFORM_UNIX -fdiagnostics-color=auto $(GCCWARNINGS) -g -o $(ME)/Tangled/$(ME).o $(ME)/Tangled/$(ME).c - gcc -D_BSD_SOURCE -DPLATFORM_UNIX -fdiagnostics-color=auto -g -o $(ME)/Tangled/$(ME)$(EXEEXTENSION) $(ME)/Tangled/$(ME).o -lm + gcc -std=c11 -c $(MANYWARNINGS) $(CCOPTS) -g -o $(ME)/Tangled/$(ME).o $(ME)/Tangled/$(ME).c + gcc $(CCOPTS) -g -o $(ME)/Tangled/$(ME)$(EXEEXTENSION) $(ME)/Tangled/$(ME).o -lm endef define make-me diff --git a/Materials/platforms/linux.mk b/Materials/platforms/linux.mk index 78ef168..10e2aa2 100644 --- a/Materials/platforms/linux.mk +++ b/Materials/platforms/linux.mk @@ -7,10 +7,17 @@ INFORM6OS = LINUX GLULXEOS = OS_UNIX -EXEEXTENSION = +EXEEXTENSION = INTEST = intest/Tangled/intest INWEB = inweb/Tangled/inweb -GCCWARNINGS = -Wall -Wextra -Wno-pointer-to-int-cast -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-unknown-pragmas +CCOPTS = -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -DPLATFORM_LINUX -fdiagnostics-color=auto -O2 + +MANYWARNINGS = -Wall -Wextra -Wimplicit-fallthrough=2 -Wno-pointer-to-int-cast \ + -Wno-unknown-pragmas -Wno-unused-but-set-parameter \ + -Wno-unused-but-set-variable -Wno-unused-function -Wno-unused-parameter \ + -Wno-unused-variable -fmax-errors=1000 + +FEWERWARNINGS = -Wno-implicit-int diff --git a/Materials/platforms/linux.mkscript b/Materials/platforms/linux.mkscript index 507fe29..09952a4 100644 --- a/Materials/platforms/linux.mkscript +++ b/Materials/platforms/linux.mkscript @@ -49,7 +49,7 @@ GLULXEOS = OS_UNIX # On some platforms, executables have a specific file extension, which we define here: -EXEEXTENSION = +EXEEXTENSION = # ----------------------------------------------------------------------------- @@ -65,23 +65,34 @@ INWEB = inweb/Tangled/inweb # and one for linking those *.o files into an executable. {define: compile to: TO from: FROM ?options: OPTS} - gcc -c -D_BSD_SOURCE -DPLATFORM_UNIX -fdiagnostics-color=auto $(GCCWARNINGS) -g {OPTS} -o {TO} {FROM} + gcc -std=c11 -c $(MANYWARNINGS) $(CCOPTS) -g {OPTS} -o {TO} {FROM} {end-define} {define: compile-indulgently to: TO from: FROM ?options: OPTS} - gcc -c -D_BSD_SOURCE -DPLATFORM_UNIX -fdiagnostics-color=auto $(GCCWARNINGS) -g {OPTS} -o {TO} {FROM} + gcc -std=c99 -c $(FEWERWARNINGS) $(CCOPTS) -g {OPTS} -o {TO} {FROM} {end-define} {define: link to: TO from: FROM ?options: OPTS} - gcc -D_BSD_SOURCE -DPLATFORM_UNIX -fdiagnostics-color=auto -g -o {TO} {FROM} {OPTS} -lm + gcc $(CCOPTS) -g -o {TO} {FROM} {OPTS} -lm {end-define} -# On this platform we use the same set of warnings whichever way we compile. To -# excuse these warning waivers: +# Where: -GCCWARNINGS = -Wall -Wextra -Wno-pointer-to-int-cast -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-unknown-pragmas +# Basic options; color error messages and optimization; _POSIX_C_SOURCE is +# necessary for readlink(). +CCOPTS = -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -DPLATFORM_LINUX -fdiagnostics-color=auto -O2 + +MANYWARNINGS = -Wall -Wextra -Wimplicit-fallthrough=2 -Wno-pointer-to-int-cast \ + -Wno-unknown-pragmas -Wno-unused-but-set-parameter \ + -Wno-unused-but-set-variable -Wno-unused-function -Wno-unused-parameter \ + -Wno-unused-variable -fmax-errors=1000 + +# To explain those: + +# -Wimplicit-fallthrough=2: comments are fallthrough comments as long as they contain the words "fall through" # -Wno-pointer-to-int-cast: we use the gcc extension allowing (void *) pointers to increment -# -Wno-unused-parameter: we don't much care if a function argument isn't used -# -Wno-unused-but-set-variable: we don't much care about this either # -Wno-unknown-pragmas: there is plenty of #pragma clang and we don't want a warning every time it is encountered +# -Wno-unused-*: we don't much care if a function argument, etc. isn't used + +FEWERWARNINGS = -Wno-implicit-int