1# Makefile.riscv -- with config changes.
2# Copyright 1990 W. Jolitz
3#	from FreeBSD: src/sys/conf/Makefile.i386,v 1.255 2002/02/20 23:35:49
4#
5# Makefile for FreeBSD
6#
7# RISCVTODO: copy pasted from aarch64, needs to be
8# constructed from a machine description:
9#	config machineid
10# Most changes should be made in the machine description
11#	/sys/riscv/conf/``machineid''
12# after which you should do
13#	 config machineid
14# Generic makefile changes should be made in
15#	/sys/conf/Makefile.riscv
16# after which config should be rerun for all machines.
17#
18
19# Which version of config(8) is required.
20%VERSREQ=	600012
21
22.if !defined(S)
23S=	../../..
24.endif
25.include "$S/conf/kern.pre.mk"
26
27INCLUDES+= -I$S/contrib/libfdt -I$S/contrib/device-tree/include
28
29# Set the ELF LMA to the address that OpenSBI's fw_jump jumps to. This allows
30# us to load the kernel with the -kernel flag in QEMU without having to embed
31# it inside BBL or OpenSBI's fw_payload first.
32# Note: For rv32 the start address is different (0x80400000).
33# We set this value using --defsym rather than hardcoding it in ldscript.riscv
34# so that different kernel configs can override the load address.
35KERNEL_LMA?=	0x80200000
36LDFLAGS+= --defsym='kernel_lma=${KERNEL_LMA}'
37
38.if !empty(DDB_ENABLED) || !empty(DTRACE_ENABLED) || !empty(HWPMC_ENABLED)
39CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
40.endif
41
42# hack because genassym.c includes sys/bus.h which includes these.
43genassym.o: bus_if.h device_if.h
44
45%BEFORE_DEPEND
46
47%OBJS
48
49%FILES.c
50
51%FILES.s
52
53%FILES.m
54
55%CLEAN
56
57%RULES
58
59.include "$S/conf/kern.post.mk"
60