aboutsummaryrefslogtreecommitdiffhomepage
path: root/notes/build_defines.txt
blob: 6380f0d09b8e649682f6bb482dcbc50b68005643 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121

Build Defines and Environment Variables
=======================================

Build #defines
--------------

DEFAULT_CPU
    The default target CPU architecture when not explicitly specified.
    If this #define is absent, an attempt is made to auto-detect it
    at compile time.

NO_HOST_TARGET
    If defined, a target CPU architecture must always be specified when
    running the compiler (instead of using DEFAULT_CPU or the auto-detected
    host CPU). This is useful to support running the compiler on platforms
    that it cannot target.

NO_GETTEXT
    Don't use gettext. I.e. don't support translation of messages.

NO_GETPWUID
    Don't try to use getpwuid as a fallback when neither $XDG_DATA_HOME or
    $HOME is set.

NO_DEFAULT_IFACEDIRS
    Only search the main slul-interfaces directory from the makefile
    variable "slulinterfacesdir".

ARENA_SIZE
    Allocation chunk size for the arena allocator. Default: 4096 bytes

PARSEBUFFER
    Parse chunk size. Default: 4096 bytes (increase to 64kB?)


Debugging #defines
------------------

FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
    Enables fuzzing mode (for running the compiler in a fuzzer). Currently,
    it disables filesystem modification, and adds a call to abort() on
    internal compiler errors.

CSLUL_NO_STDIO_MOCKS
    Allow filesystem modification even in fuzzing mode
    (FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)

SLUL_DEBUG
    Enables bug-finding code. Currently, it enables to features:
    1. Tree nodes get initialized with non-zero data, to detect
       uninitialized pointers.
    2. Type-confusion of structs is enabled by tracking the type
       in a "trailer" field as well as in a separate array, and
       comparing them at de-allocation.

CSBE_TRAP_ON_ERROR
    Causes the backend (CSBE) to immediately trap when an error occurs.
    When this is NOT set, the backend will return an error to the frontend,
    which will show a rather useless "Internal compiler error" message.


Makefile options
----------------
srcdir
    Path to the root of the source tree, if building in a separate
    directory. Please run "make outdirs", in this case, before running
    any other commands.

DESTDIR
    Used for creating packages. Specifies a path that everything is
    installed to, instead of the root file system.

prefix
    Overrides the installation prefix. The default value is /usr/local

exec_prefix, bindir, datarootdir, datadir,
docdir, htmldir, libdir, includedir, slulinterfacesdir, localedir,
mandir, man1dir, man1ext
    Overrides specific installation directories and file extensions.

multiarch
    Uses a multiarch subdirectory when installing library files.
    For example: aarch64-linux-gnu. Used on Debian based systems.

multilib_suffix
    Adds a numeric suffix to libdir, e.g. 32 or 64.

INSTALL, INSTALL_DIR, INSTALL_PROGRAM, INSTALL_DATA, MKDIR_P, RM, RM_F
    Overrides system commands used by the makefiles.

CFLAGS
    Compiler flags.

CSLUL_LIBS
    Additional flags, for libraries for example, to pass to the final
    compilation step. For example, to use libintl on BSD, specify:
    CSLUL_LIBS=-lintl


Makefile options for development
--------------------------------
UNITTEST_OPTS
    Build options to pass to the unittest. Can be -v for verbose,
    or -q for quiet.

CPPCHECK_OPTS
    Options to pass to cppcheck. For example --check-config

GCC_FANALYZER_OPTS
    Options to pass to `gcc -fanalyzer` when running `make gcc-analyze`

VALGRIND_OPTS
    Options to pass to Valgrind. For example, --vgdb-error=1 to stop
    when there's an error and wait for a debugger to connect.

FUZZ_INPUT_DIR
    Overrides the directory with input test cases when fuzzing with afl++

FUZZ_FLAGS_AFL
    Additional flags to afl++. For example, "-p fast" to use the power
    schedule "fast", and "-d" to use the fast non-deterministic mode.