1#         $NetBSD: Makefile.buildboot,v 1.32 2016/10/01 13:57:44 christos Exp $
2#
3# This file is for the sparc `boot' and `bootxx' only; it does not
4# currently play well on a 64-bit system.
5
6NOSSP=              # defined
7NOPIE=              # defined
8NOMAN=              # defined
9
10S=        ${.CURDIR}/../../../..
11
12.PATH: ${.CURDIR}/../common ${.CURDIR}/../../sparc
13
14COMMONSOURCE=       srt0.S promdev.c dvma.c promlib.c isfloppy.c
15
16SRCS=               ${COMMONSOURCE} ${PROGSOURCE}
17BINMODE=  444
18
19.include <bsd.own.mk>
20
21#
22# The relocation address for `boot' must leave enough free memory below
23# it to load a kernel at address 0x4000. On the other hand, on some
24# machines, the PROM uses memory in the upper portion of the first 4MB
25# segment, depending on the actual memory bank configuration probably.
26# Our boot program must stear clear of that as well.
27#
28# Relocating `boot' at 0x388000 seems to provide a working compromise
29# on the machines tested so far.
30#
31RELOC_DEFAULT?=     388000
32RELOCS=             $(RELOC_DEFAULT)
33#RELOCS+= 200000 400000 700000                    # additional link addresses
34
35# `bootxx' is linked at a different address to circumvent i-cache
36# flushing issues on Hypersparcs
37RELOC_BOOTXX=       300000
38
39CPPFLAGS+=          -D_STANDALONE -DSUN4 -DSUN4C -DSUN4M -DSUN4D -DHEAP_VARIABLE
40
41CPPFLAGS+=          -I. -I${.CURDIR}/../../.. -I${.CURDIR}/../../../..
42CPPFLAGS+=          -I${.CURDIR}/../../../../../common/include
43CFLAGS=             ${${ACTIVE_CC} == "clang":? -Oz -fomit-frame-pointer : -Os } -fno-unwind-tables
44AFLAGS+=  ${${ACTIVE_CC} == "clang":? -Oz :}
45CFLAGS+=  -Wall -Wstrict-prototypes -Wmissing-prototypes -ffreestanding
46
47### find out what to use for libkern
48KERN_AS=  library
49.include "${S}/lib/libkern/Makefile.inc"
50LIBKERN=  ${KERNLIB}
51
52.ifdef INCLUDE_LIBZ
53### find out what to use for libz
54Z_AS=               library
55.include "${S}/lib/libz/Makefile.inc"
56LIBZ=               ${ZLIB}
57.endif
58
59### find out what to use for libsa
60SA_AS=              library
61SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes"
62.include "${S}/lib/libsa/Makefile.inc"
63LIBSA=              ${SALIB}
64
65.include <bsd.klinks.mk>
66
67cleandir distclean: .WAIT cleanlibdir
68
69cleanlibdir:
70          -rm -rf lib
71