2023-05-12 11:06:08 -07:00
|
|
|
import platform
|
|
|
|
|
|
|
|
|
|
CC = 'gcc'
|
|
|
|
|
system = platform.system()
|
|
|
|
|
if system == 'Darwin':
|
2023-08-04 10:46:56 -07:00
|
|
|
# gcc installed by homebrew has version suffix (e.g. gcc-12) in order to be
|
2023-05-12 11:06:08 -07:00
|
|
|
# distinguishable from system one - which acts as a symlink to clang
|
2023-08-24 22:52:59 +02:00
|
|
|
CC += '-13'
|
2023-05-12 11:06:08 -07:00
|
|
|
|
2022-11-30 17:41:24 -08:00
|
|
|
env = Environment(
|
2023-05-12 11:06:08 -07:00
|
|
|
CC=CC,
|
2022-11-30 17:41:24 -08:00
|
|
|
CFLAGS=[
|
|
|
|
|
'-nostdlib',
|
|
|
|
|
'-fno-builtin',
|
|
|
|
|
'-std=gnu11',
|
2022-11-30 22:12:28 -08:00
|
|
|
'-Wfatal-errors',
|
2023-08-04 22:16:49 -07:00
|
|
|
'-Wno-pointer-to-int-cast',
|
2023-09-21 15:28:19 -07:00
|
|
|
'-DENABLE_LOGGING',
|
2022-11-30 17:41:24 -08:00
|
|
|
],
|
2022-12-01 08:38:00 +01:00
|
|
|
CPPPATH=[".", "../../board/"],
|
2022-11-30 17:41:24 -08:00
|
|
|
)
|
2023-05-12 11:06:08 -07:00
|
|
|
if system == "Darwin":
|
|
|
|
|
env.PrependENVPath('PATH', '/opt/homebrew/bin')
|
2022-11-30 17:41:24 -08:00
|
|
|
|
2023-04-26 22:59:58 -07:00
|
|
|
if GetOption('ubsan'):
|
|
|
|
|
flags = [
|
|
|
|
|
"-fsanitize=undefined",
|
|
|
|
|
"-fno-sanitize-recover=undefined",
|
|
|
|
|
]
|
|
|
|
|
env['CFLAGS'] += flags
|
|
|
|
|
env['LINKFLAGS'] += flags
|
|
|
|
|
|
2022-11-30 22:12:28 -08:00
|
|
|
env.SharedLibrary("libpanda.so", ["panda.c",])
|