1# $OpenBSD: Makefile.macppc,v 1.5 2002/01/08 15:01:02 drahn Exp $ 2# 3# Makefile for OpenBSD PowerPC 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/macppc/conf/``machineid'' 9# after which you should do 10# config machineid 11# Machine generic makefile changes should be made in 12# /sys/arch/macppc/conf/Makefile.macppc 13# after which config should be rerun for all machines of that type. 14# 15# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE 16# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING 17# 18# -DTRACE compile in kernel tracing hooks 19# -DQUOTA compile in file system quotas 20# 21.SUFFIXES: .S .c .o 22 23# DEBUG is set to -g if debugging. 24# PROF is set to -pg if profiling. 25 26.include <bsd.own.mk> 27 28AS?= as 29CC?= cc 30CPP?= cpp 31LD?= ld 32MKDEP?= mkdep 33STRIP?= strip 34SIZE?= size 35 36# source tree is located via $S relative to the compilation directory 37.ifndef S 38S!= cd ../../../..; pwd 39.endif 40MACPPC= $S/arch/macppc 41 42INCLUDES= -I. -I$S/arch -I$S -nostdinc -L${DESTDIR}/usr/include 43CPPFLAGS= ${INCLUDES} ${IDENT} -D_KERNEL \ 44 -Dmacppc 45CWARNFLAGS= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \ 46 -Wno-uninitialized -Wno-format -Wno-main 47CMACHFLAGS= -msoft-float 48#CMACHFLAGS= -msoft-float -Wa,-m7400 49COPTS?= -O2 50CFLAGS= ${DEBUG} ${CWARNFLAGS} ${CMACHFLAGS} ${COPTS} 51AFLAGS= -D_LOCORE 52LINKFLAGS= -N -Ttext 100074 -e start 53STRIPFLAGS= -g -X -x 54 55HOSTCC?= ${CC} 56HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} 57HOSTED_CFLAGS= ${CFLAGS} 58 59### find out what to use for libkern 60.include "$S/lib/libkern/Makefile.inc" 61.ifndef PROF 62LIBKERN= ${KERNLIB} 63.else 64LIBKERN= ${KERNLIB_PROF} 65.endif 66 67### find out what to use for libcompat 68.include "$S/compat/common/Makefile.inc" 69.ifndef PROF 70LIBCOMPAT= ${COMPATLIB} 71.else 72LIBCOMPAT= ${COMPATLIB_PROF} 73.endif 74 75# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP} 76# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix, 77# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file 78# is marked as config-dependent. 79 80USRLAND_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 81USRLAND_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $< 82 83NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 84NORMAL_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $< 85 86DRIVER_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 87DRIVER_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $< 88 89NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 90NORMAL_S_C= ${AS} ${COPTS} ${PARAM} $< -o $@ 91 92 93%OBJS 94 95%CFILES 96 97%SFILES 98 99# load lines for config "xxx" will be emitted as: 100# xxx: ${SYSTEM_DEP} swapxxx.o 101# ${SYSTEM_LD_HEAD} 102# ${SYSTEM_LD} swapxxx.o 103# ${SYSTEM_LD_TAIL} 104SYSTEM_OBJ= locore.o param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT} 105SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 106SYSTEM_LD_HEAD= rm -f $@ 107SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 108 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 109SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 110 111DEBUG?= 112.if ${DEBUG} == "-g" 113LINKFLAGS+= -X 114SYSTEM_LD_TAIL+=; \ 115 echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \ 116 echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@ 117.else 118LINKFLAGS+= -S 119.endif 120 121%LOAD 122 123assym.h: $S/kern/genassym.sh ${MACPPC}/macppc/genassym.cf 124 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} \ 125 < ${MACPPC}/macppc/genassym.cf > assym.h.tmp && \ 126 mv -f assym.h.tmp assym.h 127 128param.c: $S/conf/param.c 129 rm -f param.c 130 cp $S/conf/param.c . 131 132param.o: param.c Makefile 133 ${NORMAL_C_C} 134 135ioconf.o: ioconf.c 136 ${NORMAL_C} 137 138newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 139 sh $S/conf/newvers.sh 140 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 141 142clean:: 143 rm -f eddep *bsd bsd.gdb tags *.[io] [a-z]*.s \ 144 [Ee]rrs linterrs makelinks genassym genassym.o assym.h 145 146lint: 147 @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} -UKGDB \ 148 ${MACPPC}/macppc/Locore.c ${CFILES} ${MACPPC}/macppc/swapgeneric.c \ 149 ioconf.c param.c | \ 150 grep -v 'static function .* unused' 151 152tags: 153 @echo "see $S/kern/Makefile for tags" 154 155links: 156 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 157 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 158 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 159 sort -u | comm -23 - dontlink | \ 160 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 161 sh makelinks && rm -f dontlink 162 163SRCS= ${MACPPC}/macppc/locore.S \ 164 param.c ioconf.c ${CFILES} ${SFILES} 165depend:: .depend 166.depend: ${SRCS} assym.h param.c 167 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${MACPPC}/macppc/locore.S 168 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 169.if ${SFILES} != "" 170 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 171.endif 172 173# depend on root or device configuration 174autoconf.o conf.o: Makefile 175 176# depend on network or filesystem configuration 177uipc_proto.o vfs_conf.o: Makefile 178 179# depend on maxusers 180genassym.o machdep.o: Makefile 181 182# depend on CPU configuration 183locore.o machdep.o: Makefile 184 185 186locore.o: ${MACPPC}/macppc/locore.S assym.h 187 ${NORMAL_S} 188 189# The install target can be redefined by putting a 190# install-kernel-${MACHINE_NAME} target into /etc/mk.conf 191MACHINE_NAME!= uname -n 192install: install-kernel-${MACHINE_NAME} 193.if !target(install-kernel-${MACHINE_NAME}}) 194install-kernel-${MACHINE_NAME}: 195 rm -f /obsd 196 ln /bsd /obsd 197 cp bsd /nbsd 198 mv /nbsd /bsd 199.endif 200 201%RULES 202