# Copyright (c) 2026 The Solidite Developers
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <https://www.gnu.org/licenses/>.
.POSIX:
ARCH != uname -m
ifndef AS
AS=as
endif
CFLAGS_x86_64=-ffreestanding -fno-PIC -fno-stack-protector -mcmodel=kernel \
-mno-red-zone
LDFLAGS_riscv64=-T riscv64.ld --no-warn-rwx-segments
LDFLAGS_x86_64=-T x86_64.ld --no-warn-rwx-segments
TARGET=../output/boot/kernel
all: $(TARGET)
$(TARGET): ../obj/main.o
$(CROSS_COMPILE)$(LD) $(LDFLAGS) $(LDFLAGS_$(ARCH)) ../obj/main.o \
../obj/arch.o ../output/lib/libc.a -o ../output/boot/kernel
../obj/arch.o:
$(CROSS_COMPILE)$(AS) $(ASFLAGS) libkernel/$(ARCH).s -o $@
../obj/main.o: ../obj/arch.o
$(CROSS_COMPILE)$(CC) $(CFLAGS) $(CFLAGS_$(ARCH)) -c main/main.c -o \
../obj/main.o
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>