#
# Copyright (c) 2026, Chloe M.
# Provided under the BSD-3 clause
#
# Description:  User build flags, etc
# Author:       Chloe M.
#

.SILENT:
PROMPT := printf "%s\t\t%s\n"

ifeq ($(PT_TARGET_ARCH), amd64)
	CC_TARGET = x86_64-unknown-elf
else
	CC_TARGET =
endif

CC =	\
	clang
ld =	\
	ld

SYS_CFLAGS =			\
	-nostdlib			\
	-nostdinc			\
	-ffreestanding		\
	-fexceptions		\
	-target $(CC_TARGET)\
	-Wno-attributes		\
	-Wno-multichar		\
	-fno-stack-protector\
	-I$(PT_PROJECT_ROOT)/sdk/head

ifeq ($(PT_TARGET_ARCH),amd64)
	SYS_CFLAGS += 		\
		-mno-sse		\
		-mno-sse2		\
		-mno-sse3		\
		-mno-avx		\
		-mno-avx2		\
		-mno-80387		\
		-mno-3dnow		\
		-mno-mmx
endif

PASSDOWN_ARGS = \
	ARCH=$(PT_TARGET_ARCH)		\
	SYS_CC=$(CC)				\
	SYS_LD=$(LD)				\
	SYS_CFLAGS="$(SYS_CFLAGS)"	\
	USER_LDS=$(PT_PROJECT_ROOT)/service/urt/dev/link.ld
