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

87 lines
3.7 KiB
Text

# This is "linux.mkscript", a script which defines build settings used in
# inweb, intest, inform and all of their subsidiary tools for the platform
# "linux", used for tools compiled for use in the Gnome app. The maintainer
# of this file is Philip Chimento.
# The script is used for two purposes. Firstly, it is used to generate the
# file "linux.mk" of platform settings. If an inweb user selects linux 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 "linux.mk" directly. Instead, edit this script, and then
# rebuild "linux.mk" by setting the current working directory to the directory
# _above_ "inweb", and using the command:
# inweb/Tangled/inweb inweb -prototype inweb/Materials/platforms/linux.mkscript -makefile inweb/Materials/platforms/linux.mk
# Or simply:
# make -f inweb/inweb.mk makers
# which recreates all of the make-files in the inweb repository from their
# scripts, including linux.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 = linux
# 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}
gcc -c -D_BSD_SOURCE -DPLATFORM_UNIX -fdiagnostics-color=auto $(GCCWARNINGS) -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}
{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
{end-define}
# On this platform we use the same set of warnings whichever way we compile. To
# excuse these warning waivers:
GCCWARNINGS = -Wall -Wextra -Wno-pointer-to-int-cast -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-unknown-pragmas
# -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