Makefile.sparc64 revision 81084
1# Makefile.sparc64 -- with config changes. 2# Copyright 1990 W. Jolitz 3# from: @(#)Makefile.i386 7.1 5/10/91 4# $FreeBSD: head/sys/conf/Makefile.sparc64 81084 2001-08-03 01:09:10Z jake $ 5# 6# Makefile for FreeBSD 7# 8# This makefile is constructed from a machine description: 9# config machineid 10# Most changes should be made in the machine description 11# /sys/sparc64/conf/``machineid'' 12# after which you should do 13# config machineid 14# Generic makefile changes should be made in 15# /sys/sparc64/conf/Makefile.sparc64 16# after which config should be rerun for all machines. 17# 18 19MACHINE_ARCH= sparc64 20 21AR= sparc64-ar 22CC= sparc64-unknown-elf-gcc -D__sparc64__ 23LD= sparc64-ld 24NM= sparc64-nm 25OBJCOPY= sparc64-objcopy 26OBJDUMP= sparc64-objdump 27RANLIB= sparc64-ranlib 28SIZE= sparc64-size 29 30CWARNFLAGS= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \ 31 -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \ 32 -ansi 33 34# Which version of config(8) is required. 35%VERSREQ= 500007 36 37# Can be overridden by makeoptions or /etc/make.conf 38KERNEL_KO?= kernel 39KERNEL?= kernel 40KODIR?= /boot/${KERNEL} 41STD8X16FONT?= iso 42 43.if !defined(S) 44.if exists(./@/.) 45S= ./@ 46.else 47S= ../../.. 48.endif 49.endif 50M= ${MACHINE_ARCH} 51 52SIZE?= size 53OBJCOPY?= objcopy 54 55COPTFLAGS?=-O -pipe 56.if !defined(NO_CPU_COPTFLAGS) 57COPTFLAGS+= ${_CPUCFLAGS} 58.endif 59INCLUDES= -nostdinc -I- ${INCLMAGIC} -I. -I$S -I$S/dev 60# This hack is to allow kernel compiles to succeed on machines w/out srcdist 61.if exists($S/../include) 62INCLUDES+= -I$S/../include 63.else 64INCLUDES+= -I/usr/include 65.endif 66 67COPTS= ${INCLUDES} ${IDENT} -D_KERNEL -include opt_global.h 68CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS} 69 70# XXX LOCORE means "don't declare C stuff" not "for locore.s". 71ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS} 72 73# Select the correct set of tools. Can't set OBJFORMAT here because it 74# doesn't get exported into the environment, and if it were exported 75# then it might break building of utilities. 76FMT= 77CFLAGS+= ${FMT} 78 79DEFINED_PROF= ${PROF} 80.if defined(PROF) 81CFLAGS+= -malign-functions=4 82.if ${PROFLEVEL} >= 2 83IDENT+= -DGPROF4 -DGUPROF 84PROF+= -mprofiler-epilogue 85.endif 86.endif 87 88# Put configuration-specific C flags last (except for ${PROF}) so that they 89# can override the others. 90CFLAGS+= ${CONF_CFLAGS} 91 92NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC} 93NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC} 94NORMAL_S= ${CC} -c ${ASM_CFLAGS} ${.IMPSRC} 95PROFILE_C= ${CC} -c ${CFLAGS} ${.IMPSRC} 96 97NORMAL_M= perl5 $S/kern/makeobjops.pl -c $<; \ 98 ${CC} -c ${CFLAGS} ${PROF} ${.PREFIX}.c 99 100GEN_CFILES= $S/$M/$M/genassym.c 101SYSTEM_CFILES= vnode_if.c hints.c config.c 102SYSTEM_SFILES= $S/$M/$M/locore.s 103SYSTEM_DEP= Makefile ${SYSTEM_OBJS} 104SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} hints.o config.o hack.So 105SYSTEM_LD= @${LD} ${FMT} -Bdynamic -T $S/conf/ldscript.$M \ 106 -export-dynamic -dynamic-linker /red/herring \ 107 -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o 108SYSTEM_LD_TAIL= @${OBJCOPY} --strip-symbol gcc2_compiled. ${.TARGET} ; \ 109 ${SIZE} ${FMT} ${.TARGET} ; chmod 755 ${.TARGET} 110SYSTEM_DEP+= $S/conf/ldscript.$M 111 112%BEFORE_DEPEND 113 114%OBJS 115 116%FILES.c 117 118%FILES.s 119 120%FILES.m 121 122%CLEAN 123 124.PHONY: all modules 125 126all: ${KERNEL_KO} 127 128depend: kernel-depend 129clean: kernel-clean 130cleandepend: kernel-cleandepend 131clobber: kernel-clobber 132tags: kernel-tags 133install: kernel-install 134install.debug: kernel-install.debug 135reinstall: kernel-reinstall 136reinstall.debug: kernel-reinstall.debug 137 138.if !defined(DEBUG) 139FULLKERNEL= ${KERNEL_KO} 140.else 141FULLKERNEL= ${KERNEL_KO}.debug 142${KERNEL_KO}: ${FULLKERNEL} 143 ${OBJCOPY} --strip-debug ${FULLKERNEL} ${KERNEL_KO} 144.endif 145 146${FULLKERNEL}: ${SYSTEM_DEP} vers.o 147 @rm -f ${.TARGET} 148 @echo linking ${.TARGET} 149 ${SYSTEM_LD} 150 ${SYSTEM_LD_TAIL} 151 152.if !exists(.depend) 153${SYSTEM_OBJS}: vnode_if.h ${BEFORE_DEPEND:M*.h} ${MFILES:T:S/.m$/.h/} 154.endif 155 156.for mfile in ${MFILES} 157${mfile:T:S/.m$/.h/}: ${mfile} 158 perl5 $S/kern/makeobjops.pl -h ${mfile} 159.endfor 160 161kernel-clean: 162 rm -f *.o *.so *.So *.ko *.s eddep errs \ 163 ${FULLKERNEL} ${KERNEL_KO} linterrs makelinks \ 164 setdef[01].c setdefs.h tags \ 165 vers.c vnode_if.c vnode_if.h \ 166 ${MFILES:T:S/.m$/.c/} ${MFILES:T:S/.m$/.h/} \ 167 ${CLEAN} 168 169kernel-clobber: 170 find . -type f ! -name version -delete 171 172#lint: /tmp 173# @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} \ 174# $S/$M/$M/Locore.c ${CFILES} | \ 175# grep -v 'struct/union .* never defined' | \ 176# grep -v 'possible pointer alignment problem' 177 178locore.o: $S/$M/$M/locore.s assym.s 179 ${NORMAL_S} 180 181# This is a hack. BFD "optimizes" away dynamic mode if there are no 182# dynamic references. We could probably do a '-Bforcedynamic' mode like 183# in the a.out ld. For now, this works. 184hack.So: Makefile 185 touch hack.c 186 ${CC} ${FMT} -Wl,-shared -nostdlib hack.c -o hack.So 187 rm -f hack.c 188 189# this rule stops ./assym.s in .depend from causing problems 190./assym.s: assym.s 191 192assym.s: $S/kern/genassym.sh genassym.o 193 OBJFORMAT=elf NM=${NM} sh $S/kern/genassym.sh genassym.o > ${.TARGET} 194 195genassym.o: $S/$M/$M/genassym.c 196 ${CC} -c ${CFLAGS} -elf $S/$M/$M/genassym.c 197 198${SYSTEM_OBJS} genassym.o vers.o: opt_global.h 199 200kernel-depend: 201 rm -f .olddep 202 if [ -f .depend ]; then mv .depend .olddep; fi 203 ${MAKE} _kernel-depend 204 205_kernel-depend: assym.s vnode_if.h ${BEFORE_DEPEND} \ 206 ${CFILES} ${SYSTEM_CFILES} ${GEN_CFILES} ${SFILES} \ 207 ${SYSTEM_SFILES} ${MFILES:T:S/.m$/.h/} 208 if [ -f .olddep ]; then mv .olddep .depend; fi 209 rm -f .newdep 210 env MKDEP_CPP="${CC} -E" \ 211 mkdep -a -f .newdep ${CFLAGS} ${CFILES} ${SYSTEM_CFILES} ${GEN_CFILES} 212 env MKDEP_CPP="${CC} -E" \ 213 mkdep -a -f .newdep ${ASM_CFLAGS} ${SFILES} ${SYSTEM_SFILES} 214 rm -f .depend 215 mv .newdep .depend 216 217kernel-cleandepend: 218 rm -f .depend 219 220links: 221 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 222 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 223 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 224 sort -u | comm -23 - dontlink | \ 225 sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks 226 sh makelinks; rm -f dontlink 227 228kernel-tags: 229 @[ -f .depend ] || { echo "you must make depend first"; exit 1; } 230 sh $S/conf/systags.sh 231 rm -f tags1 232 sed -e 's, ../, ,' tags > tags1 233 234kernel-install kernel-install.debug: 235.if exists(${DESTDIR}/boot) 236 @if [ ! -f ${DESTDIR}/boot/device.hints ] ; then \ 237 echo "You must set up a ${DESTDIR}/boot/device.hints file first." ; \ 238 exit 1 ; \ 239 fi 240 @if [ x"`grep device.hints ${DESTDIR}/boot/defaults/loader.conf ${DESTDIR}/boot/loader.conf`" = "x" ]; then \ 241 echo "You must activate /boot/device.hints in loader.conf." ; \ 242 exit 1 ; \ 243 fi 244.endif 245 @if [ ! -f ${KERNEL_KO}${.TARGET:S/kernel-install//} ] ; then \ 246 echo "You must build a kernel first." ; \ 247 exit 1 ; \ 248 fi 249.if exists(${DESTDIR}${KODIR}) 250.if exists(${DESTDIR}${KODIR}.old) 251 @-chflags -R noschg ${DESTDIR}${KODIR}.old 252 -rm -rf ${DESTDIR}${KODIR}.old 253.endif 254 mv ${DESTDIR}${KODIR} ${DESTDIR}${KODIR}.old 255.endif 256 mkdir -p ${DESTDIR}${KODIR} 257 install -c -m 555 -o root -g wheel \ 258 ${KERNEL_KO}${.TARGET:S/kernel-install//} ${DESTDIR}${KODIR} 259 260kernel-reinstall kernel-reinstall.debug: 261 @-chflags -R noschg ${DESTDIR}${KODIR} 262 install -c -m 555 -o root -g wheel \ 263 ${KERNEL_KO}${.TARGET:S/kernel-reinstall//} ${DESTDIR}${KODIR} 264 265.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists($S/modules) 266all: modules 267depend: modules-depend 268clean: modules-clean 269cleandepend: modules-cleandepend 270cleandir: modules-cleandir 271clobber: modules-clobber 272tags: modules-tags 273install: modules-install 274install.debug: modules-install.debug 275reinstall: modules-reinstall 276reinstall.debug: modules-reinstall.debug 277.endif 278 279MKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR}/modules KMODDIR=${KODIR} 280.if defined(MODULES_OVERRIDE) 281MKMODULESENV+= MODULES_OVERRIDE="${MODULES_OVERRIDE}" 282.endif 283 284modules: 285 @mkdir -p ${.OBJDIR}/modules 286 cd $S/modules ; env ${MKMODULESENV} ${MAKE} obj ; \ 287 env ${MKMODULESENV} ${MAKE} all 288 289modules-depend: 290 @mkdir -p ${.OBJDIR}/modules 291 cd $S/modules ; env ${MKMODULESENV} ${MAKE} obj ; \ 292 env ${MKMODULESENV} ${MAKE} depend 293 294modules-clean: 295 cd $S/modules ; env ${MKMODULESENV} ${MAKE} clean 296 297modules-cleandepend: 298 cd $S/modules ; env ${MKMODULESENV} ${MAKE} cleandepend 299 300modules-clobber: modules-clean 301 rm -rf ${MKMODULESENV} 302 303modules-cleandir: 304 cd $S/modules ; env ${MKMODULESENV} ${MAKE} cleandir 305 306modules-tags: 307 cd $S/modules ; env ${MKMODULESENV} ${MAKE} tags 308 309modules-install modules-install.debug: 310 cd $S/modules ; env ${MKMODULESENV} ${MAKE} install 311 312modules-reinstall modules-reinstall.debug: 313 cd $S/modules ; env ${MKMODULESENV} ${MAKE} install 314 315config.o: 316 ${NORMAL_C} 317 318vers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP} 319 sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT} 320 321# XXX strictly, everything depends on Makefile because changes to ${PROF} 322# only appear there, but we don't handle that. 323vers.o: 324 ${NORMAL_C} 325 326hints.o: hints.c 327 ${NORMAL_C} 328 329vnode_if.c: $S/kern/vnode_if.pl $S/kern/vnode_if.src 330 perl5 $S/kern/vnode_if.pl -c $S/kern/vnode_if.src 331 332vnode_if.h: $S/kern/vnode_if.pl $S/kern/vnode_if.src 333 perl5 $S/kern/vnode_if.pl -h $S/kern/vnode_if.src 334 335vnode_if.o: 336 ${NORMAL_C} 337 338# Commented out for now pending a better solution. 339# How do we pick up compiler version specific flags?? 340#.if exists($S/../share/mk) 341#.include "$S/../share/mk/bsd.kern.mk" 342#.else 343.include <bsd.kern.mk> 344#.endif 345 346%RULES 347 348# DO NOT DELETE THIS LINE -- make depend uses it 349