Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux platform settings #3

Merged
merged 1 commit into from
Apr 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions Materials/platforms/inweb-on-linux.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
11 changes: 9 additions & 2 deletions Materials/platforms/linux.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

29 changes: 20 additions & 9 deletions Materials/platforms/linux.mkscript
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ GLULXEOS = OS_UNIX

# On some platforms, executables have a specific file extension, which we define here:

EXEEXTENSION =
EXEEXTENSION =

# -----------------------------------------------------------------------------

Expand All @@ -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