xref: /freebsd/sys/conf/Makefile.riscv (revision a8197ad3aa952a03fc2aeebc2eafe9bb9de54550)
1# Makefile.riscv -- with config changes.
2# Copyright 1990 W. Jolitz
3#	from: @(#)Makefile.i386	7.1 5/10/91
4#	from FreeBSD: src/sys/conf/Makefile.i386,v 1.255 2002/02/20 23:35:49
5# $FreeBSD$
6#
7# Makefile for FreeBSD
8#
9# RISCVTODO: copy pasted from aarch64, needs to be
10# constructed from a machine description:
11#	config machineid
12# Most changes should be made in the machine description
13#	/sys/riscv/conf/``machineid''
14# after which you should do
15#	 config machineid
16# Generic makefile changes should be made in
17#	/sys/conf/Makefile.riscv
18# after which config should be rerun for all machines.
19#
20
21# Which version of config(8) is required.
22%VERSREQ=	600017
23
24.if !defined(S)
25S=	../../..
26.endif
27.include "$S/conf/kern.pre.mk"
28
29INCLUDES+= -I$S/contrib/libfdt
30
31# Set the ELF LMA to the address that OpenSBI's fw_jump jumps to. This allows
32# us to load the kernel with the -kernel flag in QEMU without having to embed
33# it inside BBL or OpenSBI's fw_payload first.
34# Note: For rv32 the start address is different (0x80400000).
35# We set this value using --defsym rather than hardcoding it in ldscript.riscv
36# so that different kernel configs can override the load address.
37KERNEL_LMA?=	0x80200000
38
39SYSTEM_LD= @${LD} -N -m ${LD_EMULATION} -Bdynamic -T ${LDSCRIPT} ${_LDFLAGS} \
40	--no-warn-mismatch --warn-common --export-dynamic \
41	--defsym='kernel_lma=${KERNEL_LMA}' \
42	--dynamic-linker /red/herring \
43	-o ${.TARGET} -X ${SYSTEM_OBJS} vers.o
44
45.if !empty(DDB_ENABLED)
46CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
47.endif
48
49# Currently, the compile flags don't let the kernel know if this is a hard-float
50# ABI build or a soft-float ABI build. We need to pass in this information.
51CFLAGS += -DMACHINE_ARCH=\"${MACHINE_ARCH}\"
52
53# hack because genassym.c includes sys/bus.h which includes these.
54genassym.o: bus_if.h device_if.h
55
56%BEFORE_DEPEND
57
58%OBJS
59
60%FILES.c
61
62%FILES.s
63
64%FILES.m
65
66%CLEAN
67
68%RULES
69
70.include "$S/conf/kern.post.mk"
71