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