inweb-bootstrap/Materials/platforms/unix.mkscript
2022-04-22 00:06:45 +01:00

84 lines
3.8 KiB
Text

# This is "unix.mkscript", a script which defines build settings used in
# inweb, intest, inform and all of their subsidiary tools for the platform
# "unix". The maintainer of this file is Adam Thornton.
# The script is used for two purposes. Firstly, it is used to generate the
# file "unix.mk" of platform settings. If an inweb user selects unix as
# platform on a first run, then this is the file copied into place as
# inweb/platform-settings.mk. But secondly, it also defines macros which
# can be used by any *.mkscript files being converted to *.mk files on
# this platform.
# Do not edit "unix.mk" directly. Instead, edit this script, and then
# rebuild "unix.mk" by setting the current working directory to the directory
# _above_ "inweb", and using the command:
# inweb/Tangled/inweb inweb -prototype inweb/Materials/platforms/unix.mkscript -makefile inweb/Materials/platforms/unix.mk
# Or simply:
# make -f inweb/inweb.mk makers
# which recreates all of the make-files in the inweb repository from their
# scripts, including unix.mk among them.
# See the inweb manual for documentation on the *.mkscript file format, i.e.,
# the format in which this file is written. But it is essentially just a makefile
# with a number of special macro and loop features whose syntax involves braces
# { ... }, so anywhere that you see braces, you're looking at something special
# to *.mkscript; anything else is straightforward make syntax.
# -----------------------------------------------------------------------------
# The first definition in this file must set INWEBPLATFORM to the platform
# name, which is the same as the leafname of this file without the ".mkscript"
# file extension. So:
INWEBPLATFORM = unix
# The I6 source code has its own set of symbolic names for operating systems,
# not always the same as inweb's names for platforms, so:
INFORM6OS = LINUX
# And similarly for glulxe, which is used as part of the dumb-glulx interpreter,
# which is used in testing Inform on the command line:
GLULXEOS = OS_UNIX
# On some platforms, executables have a specific file extension, which we define here:
EXEEXTENSION =
# -----------------------------------------------------------------------------
# These are likely to be the same on all platforms:
INTEST = intest/Tangled/intest
INWEB = inweb/Tangled/inweb
# -----------------------------------------------------------------------------
# Now three macro definitions: two for compiling C code to *.o object files
# (one being strict about warnings, the other indulgently suppressing them);
# and one for linking those *.o files into an executable.
{define: compile to: TO from: FROM ?options: OPTS}
clang -std=c11 -c $(MANYWARNINGS) $(CCOPTS) -g {OPTS} -o {TO} {FROM}
{end-define}
{define: compile-indulgently to: TO from: FROM ?options: OPTS}
clang -std=c99 -c $(FEWERWARNINGS) $(CCOPTS) -g {OPTS} -o {TO} {FROM}
{end-define}
{define: link to: TO from: FROM ?options: OPTS}
clang -lm -lpthread -static -g -o {TO} {FROM} {OPTS}
{end-define}
# Where:
CCOPTS = -Wno-unused -DPLATFORM_UNIX -DUNIX64 -DCPU_WORDSIZE_MULTIPLIER=2 -O2
MANYWARNINGS = -Weverything -Wno-pointer-arith -Wno-unused-macros -Wno-shadow -Wno-cast-align -Wno-variadic-macros -Wno-missing-noreturn -Wno-missing-prototypes -Wno-unused-parameter -Wno-padded -Wno-missing-variable-declarations -Wno-unreachable-code-break -Wno-class-varargs -Wno-format-nonliteral -Wno-cast-qual -Wno-double-promotion -Wno-comma -Wno-strict-prototypes -Wno-extra-semi-stmt -Wno-c11-extensions -Wno-unreachable-code-return -ferror-limit=1000
FEWERWARNINGS = -Wno-implicit-int -Wno-dangling-else -Wno-pointer-sign -Wno-format-extra-args -Wno-tautological-compare -Wno-deprecated-declarations -Wno-logical-op-parentheses -Wno-format -Wno-extra-semi-stmt -Wno-c11-extensions -Wno-unreachable-code-return