Home | History | Annotate | Line # | Download | only in conf
Makefile.sparc64 revision 1.81
      1 # 	$NetBSD: Makefile.sparc64,v 1.81 2016/02/27 19:26:14 joerg Exp $
      2 
      3 #=========================================================================
      4 #
      5 #			***** WARNING ******
      6 #
      7 # ANYONE WHO CHANGES THIS MAKEFILE AND DOES NOT TEST BOTH A 32-BIT
      8 # AND 64-BIT KERNEL WILL BE SHOT.
      9 #
     10 #=========================================================================
     11 
     12 
     13 # Makefile for NetBSD
     14 #
     15 # This makefile is constructed from a machine description:
     16 #	config machineid
     17 # Most changes should be made in the machine description
     18 #	/sys/arch/sparc64/conf/``machineid''
     19 # after which you should do
     20 #	config machineid
     21 # Machine generic makefile changes should be made in
     22 #	/sys/arch/sparc64/conf/Makefile.sparc64
     23 # after which config should be rerun for all machines of that type.
     24 #
     25 # To specify debugging, add the config line: makeoptions DEBUG="-g"
     26 # A better way is to specify -g only for a few files.
     27 #
     28 #	makeoptions DEBUGLIST="uvm* trap if_*"
     29 
     30 # Default to 32-bit.  Set the MACHINE_ARCH accordingly.
     31 #
     32 # You must also be using the correct toolchain or the kernel build
     33 # will fail.
     34 #
     35 LP64?=	no
     36 .if ${LP64} == "yes"
     37 MACHINE_ARCH=sparc64
     38 .else
     39 MACHINE_ARCH=sparc
     40 .endif
     41 
     42 USETOOLS?=	no
     43 NEED_OWN_INSTALL_TARGET?=no
     44 .include <bsd.own.mk>
     45 
     46 ##
     47 ## (1) port identification
     48 ##
     49 SPARC64=	$S/arch/sparc64
     50 GENASSYM_CONF=	${SPARC64}/sparc64/genassym.cf
     51 
     52 ##
     53 ## (2) compile settings
     54 ##
     55 CPPFLAGS+=	-Dsparc64 -D__sparc64__
     56 .if ${LP64} == "yes"
     57 # 64-bit kernels
     58 CPPFLAGS+=	-D_LP64 -Wa,-Av9a
     59 CPPFLAGS+=	${${ACTIVE_CC} == "clang":? -Qunused-arguments :}
     60 AFLAGS+=	-Wa,-Av9a
     61 .if defined(PROF)
     62 # Profiling is only supported in the medium low memory model.
     63 CFLAGS+=	${${ACTIVE_CC} == "gcc":? -mcmodel=medlow :}
     64 CFLAGS+=	${${ACTIVE_CC} == "clang":? -mcmodel=small :}
     65 .else
     66 # Since the kernel resides in the lower 32 bits, use medium low for now anyway.
     67 CFLAGS+=	${${ACTIVE_CC} == "gcc":? -mcmodel=medlow :}
     68 CFLAGS+=	${${ACTIVE_CC} == "clang":? -mcmodel=small :}
     69 .endif
     70 .else
     71 # 32-bit kernels
     72 CPPFLAGS+=	-m32 -Wa,-Av8plusa -mcpu=ultrasparc
     73 CPPFLAGS+=	${${ACTIVE_CC} == "clang":? -Qunused-arguments :}
     74 AFLAGS+=	-Wa,-Av8plusa
     75 AFLAGS+=	${${ACTIVE_CC} == "clang":? -Qunused-arguments :}
     76 .endif
     77 CFLAGS+=	${${ACTIVE_CC} == "gcc":? -mno-fpu :}
     78 AFLAGS+=	-x assembler-with-cpp
     79 
     80 ##
     81 ## (3) libkern and compat
     82 ##
     83 OPT_MODULAR=	%MODULAR%
     84 .if !empty(OPT_MODULAR)
     85 KERN_AS=	obj
     86 .else
     87 KERN_AS=	library
     88 .endif
     89 
     90 ##
     91 ## (4) local objects, compile rules, and dependencies
     92 ##
     93 MD_OBJS=	locore.o copy.o mp_subr.o
     94 MD_CFILES=
     95 MD_SFILES=	${SPARC64}/sparc64/locore.s ${SPARC64}/sparc64/copy.S \
     96 	 ${SPARC64}/sparc64/mp_subr.S
     97 
     98 locore.o: ${SPARC64}/sparc64/locore.s assym.h
     99 	${NORMAL_S}
    100 
    101 copy.o:	${SPARC64}/sparc64/copy.S assym.h
    102 	${NORMAL_S}
    103 
    104 mp_subr.o:	${SPARC64}/sparc64/mp_subr.S assym.h
    105 	${NORMAL_S}
    106 
    107 # Our libkern needs stuff from assym.h for memcpy and memset.
    108 dependkernlib:	assym.h
    109 
    110 ##
    111 ## (5) link settings
    112 ##
    113 TEXTADDR?=	01000000
    114 .if ${LP64} == "yes"
    115 KERNLDSCRIPT?= ${SPARC64}/conf/kern.ldscript
    116 .else
    117 KERNLDSCRIPT?= ${SPARC64}/conf/kern32.ldscript
    118 .endif
    119 
    120 ##
    121 ## (6) port specific target dependencies
    122 ##
    123 
    124 # depend on CPU configuration
    125 bwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile
    126 ms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile
    127 machdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile
    128 
    129 cpu_in_cksum.o lock_stubs.o: assym.h
    130 
    131 ##
    132 ## (7) misc settings
    133 ##
    134 
    135 # define .MAIN _before_ the make() check, so that implicit target
    136 # would be defined
    137 .MAIN: all
    138 
    139 .if make(depend) || make(all) || make(dependall)
    140 .BEGIN:
    141 	@rm -f sparc && \
    142 		ln -s $S/arch/sparc/include sparc
    143 .endif
    144 
    145 ##
    146 ## (8) config(8) generated machinery
    147 ##
    148 %INCLUDES
    149 
    150 %OBJS
    151 
    152 %CFILES
    153 
    154 %SFILES
    155 
    156 %LOAD
    157 
    158 %RULES
    159 
    160 ##
    161 ## (9) port independent kernel machinery
    162 ##
    163 .include "$S/conf/Makefile.kern.inc"
    164 
    165 ##
    166 ## (10) Appending make options.
    167 ##
    168 %MAKEOPTIONSAPPEND
    169