Makefile.powerpc revision 1.54.2.1       1 #	$NetBSD: Makefile.powerpc,v 1.54.2.1 2014/08/10 06:54:05 tls Exp $
      2 #
      3 # Makefile for NetBSD
      4 #
      5 # This makefile is constructed from a machine description:
      6 #	config machineid
      7 # Most changes should be made in the machine description
      8 #	/sys/arch/powerpc/conf/``machineid''
      9 # after which you should do
     10 #	config machineid
     11 # Machine generic makefile changes should be made in
     12 #	/sys/arch/powerpc/conf/Makefile.powerpc
     13 # after which config should be rerun for all machines of that type.
     14 #
     15 # To specify debugging, add the config line: makeoptions DEBUG="-g"
     16 # A better way is to specify -g only for a few files.
     17 #
     18 #	makeoptions DEBUGLIST="uvm* trap if_*"
     19 
     20 MACHINE_ARCH?=powerpc
     21 USETOOLS?=	no
     22 NEED_OWN_INSTALL_TARGET?=no
     23 .include <bsd.own.mk>
     24 
     25 ##
     26 ## (1) port identification
     27 ##
     28 THISPPC=	$S/arch/${MACHINE}
     29 POWERPC=	$S/arch/powerpc
     30 GENASSYM_CONF=	${POWERPC}/powerpc/genassym.cf
     31 GENASSYM_CONF+=	${POWERPC}/${PPCDIR}/genassym.cf
     32 .if exists(${THISPPC}/${MACHINE}/genassym.cf)
     33 GENASSYM_CONF+=	${THISPPC}/${MACHINE}/genassym.cf
     34 .endif
     35 .-include "${THISPPC}/conf/Makefile.${MACHINE}.inc"
     36 
     37 ##
     38 ## (2) compile settings
     39 ##
     40 CPPFLAGS+=	-D${MACHINE}=${MACHINE}
     41 CWARNFLAGS+=	-Wreturn-type
     42 .if ${PPCDIR} == "oea"
     43 CFLAGS+=	-mno-strict-align
     44 CFLAGS+=	-Wa,-maltivec
     45 .endif
     46 .if ${PPCDIR} == "booke"
     47 DEFCOPTS=	-O2
     48 CFLAGS+=	-fstack-protector
     49 .endif
     50 CFLAGS+=	-msdata=none
     51 CFLAGS+=	-msoft-float ${CCPUOPTS}
     52 AFLAGS+=	${AOPTS} -D_NOREGNAMES
     53 
     54 ##
     55 ## (3) libkern and compat
     56 ##
     57 OPT_MODULAR=	%MODULAR%
     58 .if !empty(OPT_MODULAR)
     59 KERN_AS=	obj
     60 .else
     61 KERN_AS=	library
     62 .endif
     63 
     64 ##
     65 ## (4) local objects, compile rules, and dependencies
     66 ##
     67 .if !defined(SYSTEM_FIRST_OBJ)
     68 SYSTEM_FIRST_OBJ= locore.o
     69 .endif
     70 .if !defined(SYSTEM_FIRST_SFILE)
     71 SYSTEM_FIRST_SFILE= ${THISPPC}/${MACHINE}/locore.S
     72 .endif
     73 MD_OBJS=	${SYSTEM_FIRST_OBJ}
     74 MD_CFILES=
     75 MD_SFILES=	${SYSTEM_FIRST_SFILE}
     76 
     77 ${SYSTEM_FIRST_OBJ}: ${SYSTEM_FIRST_SFILE} assym.h
     78 	${NORMAL_S}
     79 
     80 ##
     81 ## (5) link settings
     82 ##
     83 KERNLDSCRIPT?=	${POWERPC}/conf/kern.ldscript
     84 TEXTADDR?=	0x100000
     85 LINKFORMAT=	-N -T ${KERNLDSCRIPT}
     86 
     87 ENTRYPOINT=	__start
     88 
     89 .if defined(NEED_MDSETIMAGE) && $(NEED_MDSETIMAGE) != "no" \
     90     && defined(RAMDISKDIR) && exists(${RAMDISKDIR}/ramdisk.fs)
     91 SYSTEM_DEP+=	${RAMDISKDIR}/ramdisk.fs
     92 SYSTEM_LD_TAIL_EXTRA+=; \
     93 	echo ${TOOL_MDSETIMAGE} -s $@ ${RAMDISKDIR}/ramdisk.fs; \
     94 	${TOOL_MDSETIMAGE} -s $@ ${RAMDISKDIR}/ramdisk.fs
     95 .if !empty(DEBUG:M-g*)
     96 SYSTEM_LD_TAIL_EXTRA+=; \
     97 	echo ${TOOL_MDSETIMAGE} -s $@.gdb ${RAMDISKDIR}/ramdisk.fs; \
     98 	${TOOL_MDSETIMAGE} -s $@.gdb ${RAMDISKDIR}/ramdisk.fs
     99 .endif
    100 .endif
    101 
    102 .if defined(NEED_SREC) && ${NEED_SREC} != "no"
    103 SYSTEM_LD_TAIL_EXTRA+=; \
    104 	echo ${OBJCOPY} -O srec $@ $@.srec; \
    105 	${OBJCOPY} -O srec $@ $@.srec
    106 .endif
    107 
    108 .if defined(NEED_BINARY) && ${NEED_BINARY} != "no"
    109 SYSTEM_LD_TAIL_EXTRA+=; \
    110 	echo ${OBJCOPY} -S -O binary $@ $@.bin; \
    111 	${OBJCOPY} -S -O binary $@ $@.bin
    112 
    113 EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.bin@}
    114 
    115 .if defined(NEED_UBOOTIMAGE) && ${NEED_UBOOTIMAGE} != "no"
    116 _OSRELEASE!=		${HOST_SH} $S/conf/osrelease.sh
    117 MKUBOOTIMAGEARGS=       -A powerpc -T kernel -C gz
    118 MKUBOOTIMAGEARGS+=      -a ${TEXTADDR:C/....$/0000/} -e $(TEXTADDR)
    119 MKUBOOTIMAGEARGS+=      -n "NetBSD/$(MACHINE) ${_OSRELEASE} ($(KERNEL_BUILD:T))"
    120 
    121 SYSTEM_LD_TAIL_EXTRA+=; \
    122 	echo ${TOOL_GZIP_N} -9c $@.bin '>' $@.bin.gz; \
    123 	${TOOL_GZIP_N} -9c $@.bin > $@.bin.gz; \
    124 	echo ${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS} $@.bin.gz $@.ub; \
    125 	${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS} $@.bin.gz $@.ub
    126 
    127 EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.bin.gz@}
    128 EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.ub@}
    129 .endif
    130 .endif
    131 
    132 .if !empty(SYSTEM_LD_TAIL_EXTRA_EXTRA)
    133 SYSTEM_LD_TAIL_EXTRA+= ${SYSTEM_LD_TAIL_EXTRA_EXTRA}
    134 .endif
    135 
    136 ##
    137 ## (6) port specific target dependencies
    138 ##
    139 
    140 # depend on CPU configuration
    141 locore.o machdep.o: Makefile
    142 
    143 lock_stubs.o setfault.o: assym.h
    144 
    145 ##
    146 ## (7) misc settings
    147 ##
    148 
    149 ##
    150 ## (8) config(8) generated machinery
    151 ##
    152 %INCLUDES
    153 
    154 %OBJS
    155 
    156 %CFILES
    157 
    158 %SFILES
    159 
    160 %LOAD
    161 
    162 %RULES
    163 
    164 ##
    165 ## (9) port independent kernel machinery
    166 ##
    167 .include "$S/conf/Makefile.kern.inc"
    168 ${KERNLIB} ${KERNLIB_PROF} ${KERNLIBLN}: assym.h
    169 
    170 ##
    171 ## (10) Appending make options.
    172 ##
    173 %MAKEOPTIONSAPPEND
    174