1# $OpenBSD: Makefile.powerpc64,v 1.17 2023/09/06 09:12:49 kettenis Exp $ 2 3# For instructions on building kernels consult the config(8) and options(4) 4# manual pages. 5# 6# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE 7# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING 8# DEBUG is set to -g by config if debugging is requested (config -g). 9# PROF is set to -pg by config if profiling is requested (config -p). 10 11.include <bsd.own.mk> 12 13SIZE?= size 14STRIP?= ctfstrip 15 16# source tree is located via $S relative to the compilation directory 17.ifndef S 18S!= cd ../../../..; pwd 19.endif 20 21_machdir?= $S/arch/${_mach} 22_archdir?= $S/arch/${_arch} 23 24INCLUDES= -nostdinc -I$S -I${.OBJDIR} -I$S/arch \ 25 -I$S/dev/pci/drm/include \ 26 -I$S/dev/pci/drm/include/uapi \ 27 -I$S/dev/pci/drm/amd/include/asic_reg \ 28 -I$S/dev/pci/drm/amd/include \ 29 -I$S/dev/pci/drm/amd/amdgpu \ 30 -I$S/dev/pci/drm/amd/display \ 31 -I$S/dev/pci/drm/amd/display/include \ 32 -I$S/dev/pci/drm/amd/display/dc \ 33 -I$S/dev/pci/drm/amd/display/amdgpu_dm \ 34 -I$S/dev/pci/drm/amd/pm/inc \ 35 -I$S/dev/pci/drm/amd/pm/legacy-dpm \ 36 -I$S/dev/pci/drm/amd/pm/swsmu \ 37 -I$S/dev/pci/drm/amd/pm/swsmu/inc \ 38 -I$S/dev/pci/drm/amd/pm/swsmu/smu11 \ 39 -I$S/dev/pci/drm/amd/pm/swsmu/smu12 \ 40 -I$S/dev/pci/drm/amd/pm/swsmu/smu13 \ 41 -I$S/dev/pci/drm/amd/pm/powerplay/inc \ 42 -I$S/dev/pci/drm/amd/pm/powerplay/hwmgr \ 43 -I$S/dev/pci/drm/amd/pm/powerplay/smumgr \ 44 -I$S/dev/pci/drm/amd/pm/swsmu/inc \ 45 -I$S/dev/pci/drm/amd/pm/swsmu/inc/pmfw_if \ 46 -I$S/dev/pci/drm/amd/display/dc/inc \ 47 -I$S/dev/pci/drm/amd/display/dc/inc/hw \ 48 -I$S/dev/pci/drm/amd/display/dc/clk_mgr \ 49 -I$S/dev/pci/drm/amd/display/modules/inc \ 50 -I$S/dev/pci/drm/amd/display/modules/hdcp \ 51 -I$S/dev/pci/drm/amd/display/dmub/inc 52CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -MD -MP 53CWARNFLAGS= -Werror -Wall -Wimplicit-function-declaration \ 54 -Wno-pointer-sign \ 55 -Wno-constant-conversion -Wno-address-of-packed-member \ 56 -Wno-unused-but-set-variable -Wno-gnu-folding-constant \ 57 -Wframe-larger-than=2047 58 59CMACHFLAGS= -msoft-float -mno-altivec -mno-vsx 60CMACHFLAGS+= -ffreestanding 61SORTR= sort -R 62.if ${IDENT:M-DNO_PROPOLICE} 63CMACHFLAGS+= -fno-stack-protector 64.endif 65.if ${IDENT:M-DSMALL_KERNEL} 66SORTR= cat 67COPTIMIZE?= -Oz 68.endif 69 70DEBUG?= -g 71COPTIMIZE?= -O2 72CFLAGS= ${DEBUG} ${CWARNFLAGS} ${CMACHFLAGS} ${COPTIMIZE} ${COPTS} ${PIPE} 73AFLAGS= -D_LOCORE -x assembler-with-cpp ${CWARNFLAGS} ${CMACHFLAGS} 74LINKFLAGS= -T ld.script -X --warn-common -pie 75 76HOSTCC?= ${CC} 77HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} 78HOSTED_CFLAGS= ${CFLAGS} 79HOSTED_C= ${HOSTCC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $< 80 81NORMAL_C_NOP= ${CC} ${CFLAGS} ${CPPFLAGS} -fno-ret-protector -c $< 82NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 83NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} ${PROF} -c $< 84 85%OBJS 86 87%CFILES 88 89%SFILES 90 91# load lines for config "xxx" will be emitted as: 92# xxx: ${SYSTEM_DEP} swapxxx.o 93# ${SYSTEM_LD_HEAD} 94# ${SYSTEM_LD} swapxxx.o 95# ${SYSTEM_LD_TAIL} 96SYSTEM_HEAD= locore0.o gap.o 97SYSTEM_OBJ= ${SYSTEM_HEAD} ${OBJS} param.o ioconf.o 98SYSTEM_DEP= Makefile ${SYSTEM_OBJ} ld.script 99SYSTEM_LD_HEAD= @rm -f $@ 100SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_HEAD} vers.o $${OBJS}'; \ 101 umask 007; \ 102 echo ${OBJS} param.o ioconf.o vers.o | tr " " "\n" | ${SORTR} > lorder; \ 103 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_HEAD} `cat lorder` 104SYSTEM_LD_TAIL= @${SIZE} $@ 105 106.if ${DEBUG} == "-g" 107STRIPFLAGS= -S 108SYSTEM_LD_TAIL+=; umask 007; \ 109 echo mv $@ $@.gdb; rm -f $@.gdb; mv $@ $@.gdb; \ 110 echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \ 111 ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb 112.else 113LINKFLAGS+= -S 114.endif 115 116%LOAD 117 118# cc's -MD puts the source and output paths in the dependency file; 119# since those are temp files here we need to fix it up. It also 120# puts the file in /tmp, so we use -MF to put it in the current 121# directory as assym.P and then generate assym.d from it with a 122# good target name 123assym.h: $S/kern/genassym.sh Makefile \ 124 ${_archdir}/${_arch}/genassym.cf ${_machdir}/${_mach}/genassym.cf 125 cat ${_archdir}/${_arch}/genassym.cf ${_machdir}/${_mach}/genassym.cf | \ 126 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} -no-integrated-as -MF assym.P > assym.h.tmp 127 sed '1s/.*/assym.h: \\/' assym.P > assym.d 128 sort -u assym.h.tmp > assym.h 129 130param.c: $S/conf/param.c 131 rm -f param.c 132 cp $S/conf/param.c . 133 134param.o: param.c Makefile 135 ${NORMAL_C} 136 137mcount.o: $S/lib/libkern/mcount.c Makefile 138 ${NORMAL_C_NOP} 139 140ioconf.o: ioconf.c 141 ${NORMAL_C} 142 143ld.script: ${_machdir}/conf/ld.script 144 cp ${_machdir}/conf/ld.script $@ 145 146gapdummy.o: 147 echo '__asm(".section .rodata,\"a\"");' > gapdummy.c 148 ${CC} -c ${CFLAGS} ${CPPFLAGS} gapdummy.c -o $@ 149 150makegap.sh: 151 cp $S/conf/makegap.sh $@ 152 153MAKE_GAP = LD="${LD}" sh makegap.sh 0x00000000 gapdummy.o 154 155gap.o: Makefile makegap.sh gapdummy.o vers.o 156 ${MAKE_GAP} 157 158vers.o: ${SYSTEM_DEP:Ngap.o} 159 sh $S/conf/newvers.sh 160 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 161 162clean: 163 rm -f *bsd *bsd.gdb *.[dio] [a-z]*.s assym.* \ 164 gap.link gapdummy.c ld.script lorder makegap.sh param.c 165 166cleandir: clean 167 rm -f Makefile *.h ioconf.c options machine ${_mach} vers.c 168 169depend obj: 170 171locore0.o: ${_machdir}/${_mach}/locore0.S assym.h 172locore.o: ${_machdir}/${_mach}/locore.S assym.h 173trap_subr.o: ${_machdir}/${_mach}/trap_subr.S assym.h 174kexec_subr.o: ${_machdir}/dev/kexec_subr.S assym.h 175 176hardlink-obsd: 177 [[ ! -f /bsd ]] || cmp -s bsd /bsd || ln -f /bsd /obsd 178 179newinstall: 180 install -F -m 700 bsd /bsd && sha256 -h /var/db/kernel.SHA256 /bsd 181 182install: update-link hardlink-obsd newinstall 183 184# pull in the dependency information 185.ifnmake clean 186. for o in ${SYSTEM_OBJ:Ngap.o} assym.h 187. if exists(${o:R}.d) 188. include "${o:R}.d" 189. elif exists($o) 190 .PHONY: $o 191. endif 192. endfor 193.endif 194 195%RULES 196