Makefile.sparc64 revision 85532
181084Sjake# Makefile.sparc64 -- with config changes. 281084Sjake# Copyright 1990 W. Jolitz 381084Sjake# from: @(#)Makefile.i386 7.1 5/10/91 481084Sjake# $FreeBSD: head/sys/conf/Makefile.sparc64 85532 2001-10-26 10:33:45Z ru $ 581084Sjake# 681084Sjake# Makefile for FreeBSD 781084Sjake# 881084Sjake# This makefile is constructed from a machine description: 981084Sjake# config machineid 1081084Sjake# Most changes should be made in the machine description 1181084Sjake# /sys/sparc64/conf/``machineid'' 1281084Sjake# after which you should do 1381084Sjake# config machineid 1481084Sjake# Generic makefile changes should be made in 1585532Sru# /sys/conf/Makefile.sparc64 1681084Sjake# after which config should be rerun for all machines. 1781084Sjake# 1881084Sjake 1981084SjakeMACHINE_ARCH= sparc64 2081084Sjake 2181084SjakeAR= sparc64-ar 2281084SjakeCC= sparc64-unknown-elf-gcc -D__sparc64__ 2381084SjakeLD= sparc64-ld 2481084SjakeNM= sparc64-nm 2581084SjakeOBJCOPY= sparc64-objcopy 2681084SjakeOBJDUMP= sparc64-objdump 2781084SjakeRANLIB= sparc64-ranlib 2881084SjakeSIZE= sparc64-size 2981084Sjake 3081084SjakeCWARNFLAGS= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \ 3181084Sjake -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \ 3281084Sjake -ansi 3381084Sjake 3481084Sjake# Which version of config(8) is required. 3582393Speter%VERSREQ= 500008 3681084Sjake 3781084Sjake# Can be overridden by makeoptions or /etc/make.conf 3881084SjakeKERNEL_KO?= kernel 3981084SjakeKERNEL?= kernel 4081084SjakeKODIR?= /boot/${KERNEL} 4181084SjakeSTD8X16FONT?= iso 4281084Sjake 4381084Sjake.if !defined(S) 4481084Sjake.if exists(./@/.) 4581084SjakeS= ./@ 4681084Sjake.else 4781084SjakeS= ../../.. 4881084Sjake.endif 4981084Sjake.endif 5081084SjakeM= ${MACHINE_ARCH} 5181084Sjake 5285198SmpNM?= nm 5385198SmpOBJCOPY?= objcopy 5481084SjakeSIZE?= size 5581084Sjake 5681084SjakeCOPTFLAGS?=-O -pipe 5781084Sjake.if !defined(NO_CPU_COPTFLAGS) 5881084SjakeCOPTFLAGS+= ${_CPUCFLAGS} 5981084Sjake.endif 6081084SjakeINCLUDES= -nostdinc -I- ${INCLMAGIC} -I. -I$S -I$S/dev 6181084Sjake# This hack is to allow kernel compiles to succeed on machines w/out srcdist 6281084Sjake.if exists($S/../include) 6381084SjakeINCLUDES+= -I$S/../include 6481084Sjake.else 6581084SjakeINCLUDES+= -I/usr/include 6681084Sjake.endif 6781084Sjake 6881084SjakeCOPTS= ${INCLUDES} ${IDENT} -D_KERNEL -include opt_global.h 6981173SjakeCFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS} -mcmodel=medlow 7081084Sjake 7181084Sjake# XXX LOCORE means "don't declare C stuff" not "for locore.s". 7281084SjakeASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS} 7381084Sjake 7481084Sjake# Select the correct set of tools. Can't set OBJFORMAT here because it 7581084Sjake# doesn't get exported into the environment, and if it were exported 7681084Sjake# then it might break building of utilities. 7781084SjakeFMT= 7881084SjakeCFLAGS+= ${FMT} 7981084Sjake 8081084SjakeDEFINED_PROF= ${PROF} 8181084Sjake.if defined(PROF) 8281084SjakeCFLAGS+= -malign-functions=4 8381084Sjake.if ${PROFLEVEL} >= 2 8481084SjakeIDENT+= -DGPROF4 -DGUPROF 8581084SjakePROF+= -mprofiler-epilogue 8681084Sjake.endif 8781084Sjake.endif 8881084Sjake 8981084Sjake# Put configuration-specific C flags last (except for ${PROF}) so that they 9081084Sjake# can override the others. 9181084SjakeCFLAGS+= ${CONF_CFLAGS} 9281084Sjake 9381084SjakeNORMAL_C= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC} 9481084SjakeNORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC} 9581084SjakeNORMAL_S= ${CC} -c ${ASM_CFLAGS} ${.IMPSRC} 9681084SjakePROFILE_C= ${CC} -c ${CFLAGS} ${.IMPSRC} 9781084Sjake 9881084SjakeNORMAL_M= perl5 $S/kern/makeobjops.pl -c $<; \ 9981084Sjake ${CC} -c ${CFLAGS} ${PROF} ${.PREFIX}.c 10081084Sjake 10181084SjakeGEN_CFILES= $S/$M/$M/genassym.c 10282393SpeterSYSTEM_CFILES= vnode_if.c hints.c env.c config.c 10381173SjakeSYSTEM_SFILES= $S/$M/$M/locore.s $S/$M/$M/exception.s 10481084SjakeSYSTEM_DEP= Makefile ${SYSTEM_OBJS} 10582393SpeterSYSTEM_OBJS= locore.o exception.o vnode_if.o ${OBJS} hints.o env.o config.o hack.So 10681084SjakeSYSTEM_LD= @${LD} ${FMT} -Bdynamic -T $S/conf/ldscript.$M \ 10781084Sjake -export-dynamic -dynamic-linker /red/herring \ 10881084Sjake -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o 10981084SjakeSYSTEM_LD_TAIL= @${OBJCOPY} --strip-symbol gcc2_compiled. ${.TARGET} ; \ 11081084Sjake ${SIZE} ${FMT} ${.TARGET} ; chmod 755 ${.TARGET} 11181084SjakeSYSTEM_DEP+= $S/conf/ldscript.$M 11281084Sjake 11381084Sjake%BEFORE_DEPEND 11481084Sjake 11581084Sjake%OBJS 11681084Sjake 11781084Sjake%FILES.c 11881084Sjake 11981084Sjake%FILES.s 12081084Sjake 12181084Sjake%FILES.m 12281084Sjake 12381084Sjake%CLEAN 12481084Sjake 12581084Sjake.PHONY: all modules 12681084Sjake 12781084Sjakeall: ${KERNEL_KO} 12881084Sjake 12981084Sjakedepend: kernel-depend 13081084Sjakeclean: kernel-clean 13181084Sjakecleandepend: kernel-cleandepend 13281084Sjakeclobber: kernel-clobber 13381084Sjaketags: kernel-tags 13481084Sjakeinstall: kernel-install 13581084Sjakeinstall.debug: kernel-install.debug 13681084Sjakereinstall: kernel-reinstall 13781084Sjakereinstall.debug: kernel-reinstall.debug 13881084Sjake 13981084Sjake.if !defined(DEBUG) 14081084SjakeFULLKERNEL= ${KERNEL_KO} 14181084Sjake.else 14281084SjakeFULLKERNEL= ${KERNEL_KO}.debug 14381084Sjake${KERNEL_KO}: ${FULLKERNEL} 14481084Sjake ${OBJCOPY} --strip-debug ${FULLKERNEL} ${KERNEL_KO} 14581084Sjake.endif 14681084Sjake 14781084Sjake${FULLKERNEL}: ${SYSTEM_DEP} vers.o 14881084Sjake @rm -f ${.TARGET} 14981084Sjake @echo linking ${.TARGET} 15081084Sjake ${SYSTEM_LD} 15181084Sjake ${SYSTEM_LD_TAIL} 15281084Sjake 15381084Sjake.if !exists(.depend) 15481084Sjake${SYSTEM_OBJS}: vnode_if.h ${BEFORE_DEPEND:M*.h} ${MFILES:T:S/.m$/.h/} 15581084Sjake.endif 15681084Sjake 15781084Sjake.for mfile in ${MFILES} 15881084Sjake${mfile:T:S/.m$/.h/}: ${mfile} 15981084Sjake perl5 $S/kern/makeobjops.pl -h ${mfile} 16081084Sjake.endfor 16181084Sjake 16281084Sjakekernel-clean: 16381084Sjake rm -f *.o *.so *.So *.ko *.s eddep errs \ 16481084Sjake ${FULLKERNEL} ${KERNEL_KO} linterrs makelinks \ 16581084Sjake setdef[01].c setdefs.h tags \ 16681084Sjake vers.c vnode_if.c vnode_if.h \ 16781084Sjake ${MFILES:T:S/.m$/.c/} ${MFILES:T:S/.m$/.h/} \ 16881084Sjake ${CLEAN} 16981084Sjake 17081084Sjakekernel-clobber: 17181084Sjake find . -type f ! -name version -delete 17281084Sjake 17381084Sjake#lint: /tmp 17481084Sjake# @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} \ 17581084Sjake# $S/$M/$M/Locore.c ${CFILES} | \ 17681084Sjake# grep -v 'struct/union .* never defined' | \ 17781084Sjake# grep -v 'possible pointer alignment problem' 17881084Sjake 17981084Sjakelocore.o: $S/$M/$M/locore.s assym.s 18081084Sjake ${NORMAL_S} 18181084Sjake 18281173Sjakeexception.o: $S/$M/$M/exception.s assym.s 18381173Sjake ${NORMAL_S} 18481173Sjake 18581084Sjake# This is a hack. BFD "optimizes" away dynamic mode if there are no 18681084Sjake# dynamic references. We could probably do a '-Bforcedynamic' mode like 18781084Sjake# in the a.out ld. For now, this works. 18881084Sjakehack.So: Makefile 18981084Sjake touch hack.c 19081084Sjake ${CC} ${FMT} -Wl,-shared -nostdlib hack.c -o hack.So 19181084Sjake rm -f hack.c 19281084Sjake 19381084Sjake# this rule stops ./assym.s in .depend from causing problems 19481084Sjake./assym.s: assym.s 19581084Sjake 19681084Sjakeassym.s: $S/kern/genassym.sh genassym.o 19785198Smp NM=${NM} OBJFORMAT=elf sh $S/kern/genassym.sh genassym.o > ${.TARGET} 19881084Sjake 19981084Sjakegenassym.o: $S/$M/$M/genassym.c 20081084Sjake ${CC} -c ${CFLAGS} -elf $S/$M/$M/genassym.c 20181084Sjake 20281084Sjake${SYSTEM_OBJS} genassym.o vers.o: opt_global.h 20381084Sjake 20481084Sjakekernel-depend: 20581084Sjake rm -f .olddep 20681084Sjake if [ -f .depend ]; then mv .depend .olddep; fi 20781084Sjake ${MAKE} _kernel-depend 20881084Sjake 20981084Sjake_kernel-depend: assym.s vnode_if.h ${BEFORE_DEPEND} \ 21081084Sjake ${CFILES} ${SYSTEM_CFILES} ${GEN_CFILES} ${SFILES} \ 21181084Sjake ${SYSTEM_SFILES} ${MFILES:T:S/.m$/.h/} 21281084Sjake if [ -f .olddep ]; then mv .olddep .depend; fi 21381084Sjake rm -f .newdep 21481084Sjake env MKDEP_CPP="${CC} -E" \ 21581084Sjake mkdep -a -f .newdep ${CFLAGS} ${CFILES} ${SYSTEM_CFILES} ${GEN_CFILES} 21681084Sjake env MKDEP_CPP="${CC} -E" \ 21781084Sjake mkdep -a -f .newdep ${ASM_CFLAGS} ${SFILES} ${SYSTEM_SFILES} 21881084Sjake rm -f .depend 21981084Sjake mv .newdep .depend 22081084Sjake 22181084Sjakekernel-cleandepend: 22281084Sjake rm -f .depend 22381084Sjake 22481084Sjakelinks: 22581084Sjake egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 22681084Sjake sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 22781084Sjake echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 22881084Sjake sort -u | comm -23 - dontlink | \ 22981084Sjake sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks 23081084Sjake sh makelinks; rm -f dontlink 23181084Sjake 23281084Sjakekernel-tags: 23381084Sjake @[ -f .depend ] || { echo "you must make depend first"; exit 1; } 23481084Sjake sh $S/conf/systags.sh 23581084Sjake rm -f tags1 23681084Sjake sed -e 's, ../, ,' tags > tags1 23781084Sjake 23881084Sjakekernel-install kernel-install.debug: 23981084Sjake.if exists(${DESTDIR}/boot) 24081084Sjake @if [ ! -f ${DESTDIR}/boot/device.hints ] ; then \ 24181084Sjake echo "You must set up a ${DESTDIR}/boot/device.hints file first." ; \ 24281084Sjake exit 1 ; \ 24381084Sjake fi 24481084Sjake @if [ x"`grep device.hints ${DESTDIR}/boot/defaults/loader.conf ${DESTDIR}/boot/loader.conf`" = "x" ]; then \ 24581084Sjake echo "You must activate /boot/device.hints in loader.conf." ; \ 24681084Sjake exit 1 ; \ 24781084Sjake fi 24881084Sjake.endif 24981084Sjake @if [ ! -f ${KERNEL_KO}${.TARGET:S/kernel-install//} ] ; then \ 25081084Sjake echo "You must build a kernel first." ; \ 25181084Sjake exit 1 ; \ 25281084Sjake fi 25381084Sjake.if exists(${DESTDIR}${KODIR}) 25481084Sjake.if exists(${DESTDIR}${KODIR}.old) 25581084Sjake @-chflags -R noschg ${DESTDIR}${KODIR}.old 25681084Sjake -rm -rf ${DESTDIR}${KODIR}.old 25781084Sjake.endif 25881084Sjake mv ${DESTDIR}${KODIR} ${DESTDIR}${KODIR}.old 25985073Sbrian [ "`sysctl -n kern.bootfile`" != "${DESTDIR}${KODIR}/kernel" ] || \ 26085073Sbrian sysctl kern.bootfile=${DESTDIR}${KODIR}.old/kernel 26181084Sjake.endif 26281084Sjake mkdir -p ${DESTDIR}${KODIR} 26381084Sjake install -c -m 555 -o root -g wheel \ 26481084Sjake ${KERNEL_KO}${.TARGET:S/kernel-install//} ${DESTDIR}${KODIR} 26581084Sjake 26681084Sjakekernel-reinstall kernel-reinstall.debug: 26781084Sjake @-chflags -R noschg ${DESTDIR}${KODIR} 26881084Sjake install -c -m 555 -o root -g wheel \ 26981084Sjake ${KERNEL_KO}${.TARGET:S/kernel-reinstall//} ${DESTDIR}${KODIR} 27081084Sjake 27181084Sjake.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists($S/modules) 27281084Sjakeall: modules 27381084Sjakedepend: modules-depend 27481084Sjakeclean: modules-clean 27581084Sjakecleandepend: modules-cleandepend 27681084Sjakecleandir: modules-cleandir 27781084Sjakeclobber: modules-clobber 27881084Sjaketags: modules-tags 27981084Sjakeinstall: modules-install 28081084Sjakeinstall.debug: modules-install.debug 28181084Sjakereinstall: modules-reinstall 28281084Sjakereinstall.debug: modules-reinstall.debug 28381084Sjake.endif 28481084Sjake 28581084SjakeMKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR}/modules KMODDIR=${KODIR} 28681084Sjake.if defined(MODULES_OVERRIDE) 28781084SjakeMKMODULESENV+= MODULES_OVERRIDE="${MODULES_OVERRIDE}" 28881084Sjake.endif 28981084Sjake 29081084Sjakemodules: 29181084Sjake @mkdir -p ${.OBJDIR}/modules 29281084Sjake cd $S/modules ; env ${MKMODULESENV} ${MAKE} obj ; \ 29381084Sjake env ${MKMODULESENV} ${MAKE} all 29481084Sjake 29581084Sjakemodules-depend: 29681084Sjake @mkdir -p ${.OBJDIR}/modules 29781084Sjake cd $S/modules ; env ${MKMODULESENV} ${MAKE} obj ; \ 29881084Sjake env ${MKMODULESENV} ${MAKE} depend 29981084Sjake 30081084Sjakemodules-clean: 30181084Sjake cd $S/modules ; env ${MKMODULESENV} ${MAKE} clean 30281084Sjake 30381084Sjakemodules-cleandepend: 30481084Sjake cd $S/modules ; env ${MKMODULESENV} ${MAKE} cleandepend 30581084Sjake 30681084Sjakemodules-clobber: modules-clean 30781084Sjake rm -rf ${MKMODULESENV} 30881084Sjake 30981084Sjakemodules-cleandir: 31081084Sjake cd $S/modules ; env ${MKMODULESENV} ${MAKE} cleandir 31181084Sjake 31281084Sjakemodules-tags: 31381084Sjake cd $S/modules ; env ${MKMODULESENV} ${MAKE} tags 31481084Sjake 31581084Sjakemodules-install modules-install.debug: 31681084Sjake cd $S/modules ; env ${MKMODULESENV} ${MAKE} install 31781084Sjake 31881084Sjakemodules-reinstall modules-reinstall.debug: 31981084Sjake cd $S/modules ; env ${MKMODULESENV} ${MAKE} install 32081084Sjake 32181084Sjakeconfig.o: 32281084Sjake ${NORMAL_C} 32381084Sjake 32481084Sjakevers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP} 32581084Sjake sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT} 32681084Sjake 32781084Sjake# XXX strictly, everything depends on Makefile because changes to ${PROF} 32881084Sjake# only appear there, but we don't handle that. 32981084Sjakevers.o: 33081084Sjake ${NORMAL_C} 33181084Sjake 33281084Sjakehints.o: hints.c 33381084Sjake ${NORMAL_C} 33481084Sjake 33582393Speterenv.o: env.c 33682393Speter ${NORMAL_C} 33782393Speter 33881084Sjakevnode_if.c: $S/kern/vnode_if.pl $S/kern/vnode_if.src 33981084Sjake perl5 $S/kern/vnode_if.pl -c $S/kern/vnode_if.src 34081084Sjake 34181084Sjakevnode_if.h: $S/kern/vnode_if.pl $S/kern/vnode_if.src 34281084Sjake perl5 $S/kern/vnode_if.pl -h $S/kern/vnode_if.src 34381084Sjake 34481084Sjakevnode_if.o: 34581084Sjake ${NORMAL_C} 34681084Sjake 34781084Sjake# Commented out for now pending a better solution. 34881084Sjake# How do we pick up compiler version specific flags?? 34981084Sjake#.if exists($S/../share/mk) 35081084Sjake#.include "$S/../share/mk/bsd.kern.mk" 35181084Sjake#.else 35281084Sjake.include <bsd.kern.mk> 35381084Sjake#.endif 35481084Sjake 35581084Sjake%RULES 356