Makefile.powerpc revision 1.58
11.58Suebayasi# $NetBSD: Makefile.powerpc,v 1.58 2014/11/15 12:36:42 uebayasi Exp $ 21.1Sws# 31.1Sws# Makefile for NetBSD 41.1Sws# 51.1Sws# This makefile is constructed from a machine description: 61.1Sws# config machineid 71.1Sws# Most changes should be made in the machine description 81.1Sws# /sys/arch/powerpc/conf/``machineid'' 91.1Sws# after which you should do 101.1Sws# config machineid 111.1Sws# Machine generic makefile changes should be made in 121.1Sws# /sys/arch/powerpc/conf/Makefile.powerpc 131.1Sws# after which config should be rerun for all machines of that type. 141.1Sws# 151.20Satatat# To specify debugging, add the config line: makeoptions DEBUG="-g" 161.20Satatat# A better way is to specify -g only for a few files. 171.1Sws# 181.20Satatat# makeoptions DEBUGLIST="uvm* trap if_*" 191.18Sthorpej 201.53SmattMACHINE_ARCH?=powerpc 211.19SjmcUSETOOLS?= no 221.20SatatatNEED_OWN_INSTALL_TARGET?=no 231.16Sthorpej.include <bsd.own.mk> 241.1Sws 251.20Satatat## 261.20Satatat## (1) port identification 271.20Satatat## 281.17SthorpejTHISPPC= $S/arch/${MACHINE} 291.14SmattPOWERPC= $S/arch/powerpc 301.46SmattGENASSYM_CONF= ${POWERPC}/powerpc/genassym.cf 311.46SmattGENASSYM_CONF+= ${POWERPC}/${PPCDIR}/genassym.cf 321.22Smatt.if exists(${THISPPC}/${MACHINE}/genassym.cf) 331.46SmattGENASSYM_CONF+= ${THISPPC}/${MACHINE}/genassym.cf 341.22Smatt.endif 351.20Satatat.-include "${THISPPC}/conf/Makefile.${MACHINE}.inc" 361.1Sws 371.20Satatat## 381.20Satatat## (2) compile settings 391.20Satatat## 401.29SbriggsCPPFLAGS+= -D${MACHINE}=${MACHINE} 411.20SatatatCWARNFLAGS+= -Wreturn-type 421.32Smatt.if ${PPCDIR} == "oea" 431.57SjoergCFLAGS+= ${${ACTIVE_CC} == "gcc":? -mno-strict-align :} 441.57SjoergCFLAGS+= ${${ACTIVE_CC} == "gcc":? -Wa,-maltivec :} 451.32Smatt.endif 461.50Smatt.if ${PPCDIR} == "booke" 471.50SmattDEFCOPTS= -O2 481.50SmattCFLAGS+= -fstack-protector 491.57SjoergCFLAGS+= ${${ACTIVE_CC} == "gcc":? -misel :} 501.50Smatt.endif 511.57SjoergCFLAGS+= ${${ACTIVE_CC} == "gcc":? -msdata=none -msoft-float :} 521.57SjoergCFLAGS+= ${${ACTIVE_CC} == "clang":? -mllvm -disable-ppc-float-in-variadic=true :} 531.57SjoergCFLAGS+= ${CCPUOPTS} 541.44SmattAFLAGS+= ${AOPTS} -D_NOREGNAMES 551.20Satatat 561.20Satatat## 571.20Satatat## (3) libkern and compat 581.20Satatat## 591.43ScubeOPT_MODULAR= %MODULAR% 601.42Sapb.if !empty(OPT_MODULAR) 611.26SmattKERN_AS= obj 621.51Schristos.else 631.51SchristosKERN_AS= library 641.27Smatt.endif 651.20Satatat 661.20Satatat## 671.20Satatat## (4) local objects, compile rules, and dependencies 681.20Satatat## 691.24Sscw.if !defined(SYSTEM_FIRST_OBJ) 701.24SscwSYSTEM_FIRST_OBJ= locore.o 711.24Sscw.endif 721.24Sscw.if !defined(SYSTEM_FIRST_SFILE) 731.24SscwSYSTEM_FIRST_SFILE= ${THISPPC}/${MACHINE}/locore.S 741.24Sscw.endif 751.24SscwMD_OBJS= ${SYSTEM_FIRST_OBJ} 761.20SatatatMD_CFILES= 771.24SscwMD_SFILES= ${SYSTEM_FIRST_SFILE} 781.15Ssimonb 791.24Sscw${SYSTEM_FIRST_OBJ}: ${SYSTEM_FIRST_SFILE} assym.h 801.20Satatat ${NORMAL_S} 811.1Sws 821.20Satatat## 831.20Satatat## (5) link settings 841.20Satatat## 851.44SmattKERNLDSCRIPT?= ${POWERPC}/conf/kern.ldscript 861.20SatatatTEXTADDR?= 0x100000 871.58SuebayasiLINKFORMAT= -N 881.58SuebayasiLINKSCRIPT= -T ${KERNLDSCRIPT} 891.44Smatt 901.20SatatatENTRYPOINT= __start 911.14Smatt 921.47Smatt.if defined(NEED_MDSETIMAGE) && $(NEED_MDSETIMAGE) != "no" \ 931.47Smatt && defined(RAMDISKDIR) && exists(${RAMDISKDIR}/ramdisk.fs) 941.52SmattSYSTEM_DEP+= ${RAMDISKDIR}/ramdisk.fs 951.25SaugustssSYSTEM_LD_TAIL_EXTRA+=; \ 961.47Smatt echo ${TOOL_MDSETIMAGE} -s $@ ${RAMDISKDIR}/ramdisk.fs; \ 971.47Smatt ${TOOL_MDSETIMAGE} -s $@ ${RAMDISKDIR}/ramdisk.fs 981.54Smatt.if !empty(DEBUG:M-g*) 991.54SmattSYSTEM_LD_TAIL_EXTRA+=; \ 1001.54Smatt echo ${TOOL_MDSETIMAGE} -s $@.gdb ${RAMDISKDIR}/ramdisk.fs; \ 1011.54Smatt ${TOOL_MDSETIMAGE} -s $@.gdb ${RAMDISKDIR}/ramdisk.fs 1021.54Smatt.endif 1031.23Saugustss.endif 1041.23Saugustss 1051.47Smatt.if defined(NEED_SREC) && ${NEED_SREC} != "no" 1061.25SaugustssSYSTEM_LD_TAIL_EXTRA+=; \ 1071.47Smatt echo ${OBJCOPY} -O srec $@ $@.srec; \ 1081.47Smatt ${OBJCOPY} -O srec $@ $@.srec 1091.47Smatt.endif 1101.47Smatt 1111.47Smatt.if defined(NEED_BINARY) && ${NEED_BINARY} != "no" 1121.47SmattSYSTEM_LD_TAIL_EXTRA+=; \ 1131.47Smatt echo ${OBJCOPY} -S -O binary $@ $@.bin; \ 1141.47Smatt ${OBJCOPY} -S -O binary $@ $@.bin 1151.47Smatt 1161.47SmattEXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.bin@} 1171.47Smatt 1181.47Smatt.if defined(NEED_UBOOTIMAGE) && ${NEED_UBOOTIMAGE} != "no" 1191.47Smatt_OSRELEASE!= ${HOST_SH} $S/conf/osrelease.sh 1201.47SmattMKUBOOTIMAGEARGS= -A powerpc -T kernel -C gz 1211.47SmattMKUBOOTIMAGEARGS+= -a ${TEXTADDR:C/....$/0000/} -e $(TEXTADDR) 1221.47SmattMKUBOOTIMAGEARGS+= -n "NetBSD/$(MACHINE) ${_OSRELEASE} ($(KERNEL_BUILD:T))" 1231.47Smatt 1241.47SmattSYSTEM_LD_TAIL_EXTRA+=; \ 1251.55Sapb echo ${TOOL_GZIP_N} -9c $@.bin '>' $@.bin.gz; \ 1261.55Sapb ${TOOL_GZIP_N} -9c $@.bin > $@.bin.gz; \ 1271.47Smatt echo ${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS} $@.bin.gz $@.ub; \ 1281.47Smatt ${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS} $@.bin.gz $@.ub 1291.47Smatt 1301.47SmattEXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.bin.gz@} 1311.47SmattEXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.ub@} 1321.47Smatt.endif 1331.1Sws.endif 1341.1Sws 1351.49Smatt.if !empty(SYSTEM_LD_TAIL_EXTRA_EXTRA) 1361.49SmattSYSTEM_LD_TAIL_EXTRA+= ${SYSTEM_LD_TAIL_EXTRA_EXTRA} 1371.49Smatt.endif 1381.49Smatt 1391.20Satatat## 1401.20Satatat## (6) port specific target dependencies 1411.20Satatat## 1421.1Sws 1431.20Satatat# depend on CPU configuration 1441.20Satatatlocore.o machdep.o: Makefile 1451.28Ssimonb 1461.40Sphxlock_stubs.o setfault.o: assym.h 1471.1Sws 1481.20Satatat## 1491.20Satatat## (7) misc settings 1501.20Satatat## 1511.20Satatat 1521.20Satatat## 1531.20Satatat## (8) config(8) generated machinery 1541.20Satatat## 1551.20Satatat%INCLUDES 1561.1Sws 1571.1Sws%OBJS 1581.1Sws 1591.1Sws%CFILES 1601.1Sws 1611.1Sws%SFILES 1621.1Sws 1631.1Sws%LOAD 1641.1Sws 1651.20Satatat%RULES 1661.1Sws 1671.20Satatat## 1681.20Satatat## (9) port independent kernel machinery 1691.20Satatat## 1701.20Satatat.include "$S/conf/Makefile.kern.inc" 1711.39Smatt${KERNLIB} ${KERNLIB_PROF} ${KERNLIBLN}: assym.h 1721.30Sthorpej 1731.30Sthorpej## 1741.30Sthorpej## (10) Appending make options. 1751.30Sthorpej## 1761.30Sthorpej%MAKEOPTIONSAPPEND 177