Makefile.sparc64 revision 81084
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 81084 2001-08-03 01:09:10Z jake $ 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 1581084Sjake# /sys/sparc64/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. 3581084Sjake%VERSREQ= 500007 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 5281084SjakeSIZE?= size 5381084SjakeOBJCOPY?= objcopy 5481084Sjake 5581084SjakeCOPTFLAGS?=-O -pipe 5681084Sjake.if !defined(NO_CPU_COPTFLAGS) 5781084SjakeCOPTFLAGS+= ${_CPUCFLAGS} 5881084Sjake.endif 5981084SjakeINCLUDES= -nostdinc -I- ${INCLMAGIC} -I. -I$S -I$S/dev 6081084Sjake# This hack is to allow kernel compiles to succeed on machines w/out srcdist 6181084Sjake.if exists($S/../include) 6281084SjakeINCLUDES+= -I$S/../include 6381084Sjake.else 6481084SjakeINCLUDES+= -I/usr/include 6581084Sjake.endif 6681084Sjake 6781084SjakeCOPTS= ${INCLUDES} ${IDENT} -D_KERNEL -include opt_global.h 6881084SjakeCFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS} 6981084Sjake 7081084Sjake# XXX LOCORE means "don't declare C stuff" not "for locore.s". 7181084SjakeASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS} 7281084Sjake 7381084Sjake# Select the correct set of tools. Can't set OBJFORMAT here because it 7481084Sjake# doesn't get exported into the environment, and if it were exported 7581084Sjake# then it might break building of utilities. 7681084SjakeFMT= 7781084SjakeCFLAGS+= ${FMT} 7881084Sjake 7981084SjakeDEFINED_PROF= ${PROF} 8081084Sjake.if defined(PROF) 8181084SjakeCFLAGS+= -malign-functions=4 8281084Sjake.if ${PROFLEVEL} >= 2 8381084SjakeIDENT+= -DGPROF4 -DGUPROF 8481084SjakePROF+= -mprofiler-epilogue 8581084Sjake.endif 8681084Sjake.endif 8781084Sjake 8881084Sjake# Put configuration-specific C flags last (except for ${PROF}) so that they 8981084Sjake# can override the others. 9081084SjakeCFLAGS+= ${CONF_CFLAGS} 9181084Sjake 9281084SjakeNORMAL_C= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC} 9381084SjakeNORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC} 9481084SjakeNORMAL_S= ${CC} -c ${ASM_CFLAGS} ${.IMPSRC} 9581084SjakePROFILE_C= ${CC} -c ${CFLAGS} ${.IMPSRC} 9681084Sjake 9781084SjakeNORMAL_M= perl5 $S/kern/makeobjops.pl -c $<; \ 9881084Sjake ${CC} -c ${CFLAGS} ${PROF} ${.PREFIX}.c 9981084Sjake 10081084SjakeGEN_CFILES= $S/$M/$M/genassym.c 10181084SjakeSYSTEM_CFILES= vnode_if.c hints.c config.c 10281084SjakeSYSTEM_SFILES= $S/$M/$M/locore.s 10381084SjakeSYSTEM_DEP= Makefile ${SYSTEM_OBJS} 10481084SjakeSYSTEM_OBJS= locore.o vnode_if.o ${OBJS} hints.o config.o hack.So 10581084SjakeSYSTEM_LD= @${LD} ${FMT} -Bdynamic -T $S/conf/ldscript.$M \ 10681084Sjake -export-dynamic -dynamic-linker /red/herring \ 10781084Sjake -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o 10881084SjakeSYSTEM_LD_TAIL= @${OBJCOPY} --strip-symbol gcc2_compiled. ${.TARGET} ; \ 10981084Sjake ${SIZE} ${FMT} ${.TARGET} ; chmod 755 ${.TARGET} 11081084SjakeSYSTEM_DEP+= $S/conf/ldscript.$M 11181084Sjake 11281084Sjake%BEFORE_DEPEND 11381084Sjake 11481084Sjake%OBJS 11581084Sjake 11681084Sjake%FILES.c 11781084Sjake 11881084Sjake%FILES.s 11981084Sjake 12081084Sjake%FILES.m 12181084Sjake 12281084Sjake%CLEAN 12381084Sjake 12481084Sjake.PHONY: all modules 12581084Sjake 12681084Sjakeall: ${KERNEL_KO} 12781084Sjake 12881084Sjakedepend: kernel-depend 12981084Sjakeclean: kernel-clean 13081084Sjakecleandepend: kernel-cleandepend 13181084Sjakeclobber: kernel-clobber 13281084Sjaketags: kernel-tags 13381084Sjakeinstall: kernel-install 13481084Sjakeinstall.debug: kernel-install.debug 13581084Sjakereinstall: kernel-reinstall 13681084Sjakereinstall.debug: kernel-reinstall.debug 13781084Sjake 13881084Sjake.if !defined(DEBUG) 13981084SjakeFULLKERNEL= ${KERNEL_KO} 14081084Sjake.else 14181084SjakeFULLKERNEL= ${KERNEL_KO}.debug 14281084Sjake${KERNEL_KO}: ${FULLKERNEL} 14381084Sjake ${OBJCOPY} --strip-debug ${FULLKERNEL} ${KERNEL_KO} 14481084Sjake.endif 14581084Sjake 14681084Sjake${FULLKERNEL}: ${SYSTEM_DEP} vers.o 14781084Sjake @rm -f ${.TARGET} 14881084Sjake @echo linking ${.TARGET} 14981084Sjake ${SYSTEM_LD} 15081084Sjake ${SYSTEM_LD_TAIL} 15181084Sjake 15281084Sjake.if !exists(.depend) 15381084Sjake${SYSTEM_OBJS}: vnode_if.h ${BEFORE_DEPEND:M*.h} ${MFILES:T:S/.m$/.h/} 15481084Sjake.endif 15581084Sjake 15681084Sjake.for mfile in ${MFILES} 15781084Sjake${mfile:T:S/.m$/.h/}: ${mfile} 15881084Sjake perl5 $S/kern/makeobjops.pl -h ${mfile} 15981084Sjake.endfor 16081084Sjake 16181084Sjakekernel-clean: 16281084Sjake rm -f *.o *.so *.So *.ko *.s eddep errs \ 16381084Sjake ${FULLKERNEL} ${KERNEL_KO} linterrs makelinks \ 16481084Sjake setdef[01].c setdefs.h tags \ 16581084Sjake vers.c vnode_if.c vnode_if.h \ 16681084Sjake ${MFILES:T:S/.m$/.c/} ${MFILES:T:S/.m$/.h/} \ 16781084Sjake ${CLEAN} 16881084Sjake 16981084Sjakekernel-clobber: 17081084Sjake find . -type f ! -name version -delete 17181084Sjake 17281084Sjake#lint: /tmp 17381084Sjake# @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} \ 17481084Sjake# $S/$M/$M/Locore.c ${CFILES} | \ 17581084Sjake# grep -v 'struct/union .* never defined' | \ 17681084Sjake# grep -v 'possible pointer alignment problem' 17781084Sjake 17881084Sjakelocore.o: $S/$M/$M/locore.s assym.s 17981084Sjake ${NORMAL_S} 18081084Sjake 18181084Sjake# This is a hack. BFD "optimizes" away dynamic mode if there are no 18281084Sjake# dynamic references. We could probably do a '-Bforcedynamic' mode like 18381084Sjake# in the a.out ld. For now, this works. 18481084Sjakehack.So: Makefile 18581084Sjake touch hack.c 18681084Sjake ${CC} ${FMT} -Wl,-shared -nostdlib hack.c -o hack.So 18781084Sjake rm -f hack.c 18881084Sjake 18981084Sjake# this rule stops ./assym.s in .depend from causing problems 19081084Sjake./assym.s: assym.s 19181084Sjake 19281084Sjakeassym.s: $S/kern/genassym.sh genassym.o 19381084Sjake OBJFORMAT=elf NM=${NM} sh $S/kern/genassym.sh genassym.o > ${.TARGET} 19481084Sjake 19581084Sjakegenassym.o: $S/$M/$M/genassym.c 19681084Sjake ${CC} -c ${CFLAGS} -elf $S/$M/$M/genassym.c 19781084Sjake 19881084Sjake${SYSTEM_OBJS} genassym.o vers.o: opt_global.h 19981084Sjake 20081084Sjakekernel-depend: 20181084Sjake rm -f .olddep 20281084Sjake if [ -f .depend ]; then mv .depend .olddep; fi 20381084Sjake ${MAKE} _kernel-depend 20481084Sjake 20581084Sjake_kernel-depend: assym.s vnode_if.h ${BEFORE_DEPEND} \ 20681084Sjake ${CFILES} ${SYSTEM_CFILES} ${GEN_CFILES} ${SFILES} \ 20781084Sjake ${SYSTEM_SFILES} ${MFILES:T:S/.m$/.h/} 20881084Sjake if [ -f .olddep ]; then mv .olddep .depend; fi 20981084Sjake rm -f .newdep 21081084Sjake env MKDEP_CPP="${CC} -E" \ 21181084Sjake mkdep -a -f .newdep ${CFLAGS} ${CFILES} ${SYSTEM_CFILES} ${GEN_CFILES} 21281084Sjake env MKDEP_CPP="${CC} -E" \ 21381084Sjake mkdep -a -f .newdep ${ASM_CFLAGS} ${SFILES} ${SYSTEM_SFILES} 21481084Sjake rm -f .depend 21581084Sjake mv .newdep .depend 21681084Sjake 21781084Sjakekernel-cleandepend: 21881084Sjake rm -f .depend 21981084Sjake 22081084Sjakelinks: 22181084Sjake egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 22281084Sjake sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 22381084Sjake echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 22481084Sjake sort -u | comm -23 - dontlink | \ 22581084Sjake sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks 22681084Sjake sh makelinks; rm -f dontlink 22781084Sjake 22881084Sjakekernel-tags: 22981084Sjake @[ -f .depend ] || { echo "you must make depend first"; exit 1; } 23081084Sjake sh $S/conf/systags.sh 23181084Sjake rm -f tags1 23281084Sjake sed -e 's, ../, ,' tags > tags1 23381084Sjake 23481084Sjakekernel-install kernel-install.debug: 23581084Sjake.if exists(${DESTDIR}/boot) 23681084Sjake @if [ ! -f ${DESTDIR}/boot/device.hints ] ; then \ 23781084Sjake echo "You must set up a ${DESTDIR}/boot/device.hints file first." ; \ 23881084Sjake exit 1 ; \ 23981084Sjake fi 24081084Sjake @if [ x"`grep device.hints ${DESTDIR}/boot/defaults/loader.conf ${DESTDIR}/boot/loader.conf`" = "x" ]; then \ 24181084Sjake echo "You must activate /boot/device.hints in loader.conf." ; \ 24281084Sjake exit 1 ; \ 24381084Sjake fi 24481084Sjake.endif 24581084Sjake @if [ ! -f ${KERNEL_KO}${.TARGET:S/kernel-install//} ] ; then \ 24681084Sjake echo "You must build a kernel first." ; \ 24781084Sjake exit 1 ; \ 24881084Sjake fi 24981084Sjake.if exists(${DESTDIR}${KODIR}) 25081084Sjake.if exists(${DESTDIR}${KODIR}.old) 25181084Sjake @-chflags -R noschg ${DESTDIR}${KODIR}.old 25281084Sjake -rm -rf ${DESTDIR}${KODIR}.old 25381084Sjake.endif 25481084Sjake mv ${DESTDIR}${KODIR} ${DESTDIR}${KODIR}.old 25581084Sjake.endif 25681084Sjake mkdir -p ${DESTDIR}${KODIR} 25781084Sjake install -c -m 555 -o root -g wheel \ 25881084Sjake ${KERNEL_KO}${.TARGET:S/kernel-install//} ${DESTDIR}${KODIR} 25981084Sjake 26081084Sjakekernel-reinstall kernel-reinstall.debug: 26181084Sjake @-chflags -R noschg ${DESTDIR}${KODIR} 26281084Sjake install -c -m 555 -o root -g wheel \ 26381084Sjake ${KERNEL_KO}${.TARGET:S/kernel-reinstall//} ${DESTDIR}${KODIR} 26481084Sjake 26581084Sjake.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists($S/modules) 26681084Sjakeall: modules 26781084Sjakedepend: modules-depend 26881084Sjakeclean: modules-clean 26981084Sjakecleandepend: modules-cleandepend 27081084Sjakecleandir: modules-cleandir 27181084Sjakeclobber: modules-clobber 27281084Sjaketags: modules-tags 27381084Sjakeinstall: modules-install 27481084Sjakeinstall.debug: modules-install.debug 27581084Sjakereinstall: modules-reinstall 27681084Sjakereinstall.debug: modules-reinstall.debug 27781084Sjake.endif 27881084Sjake 27981084SjakeMKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR}/modules KMODDIR=${KODIR} 28081084Sjake.if defined(MODULES_OVERRIDE) 28181084SjakeMKMODULESENV+= MODULES_OVERRIDE="${MODULES_OVERRIDE}" 28281084Sjake.endif 28381084Sjake 28481084Sjakemodules: 28581084Sjake @mkdir -p ${.OBJDIR}/modules 28681084Sjake cd $S/modules ; env ${MKMODULESENV} ${MAKE} obj ; \ 28781084Sjake env ${MKMODULESENV} ${MAKE} all 28881084Sjake 28981084Sjakemodules-depend: 29081084Sjake @mkdir -p ${.OBJDIR}/modules 29181084Sjake cd $S/modules ; env ${MKMODULESENV} ${MAKE} obj ; \ 29281084Sjake env ${MKMODULESENV} ${MAKE} depend 29381084Sjake 29481084Sjakemodules-clean: 29581084Sjake cd $S/modules ; env ${MKMODULESENV} ${MAKE} clean 29681084Sjake 29781084Sjakemodules-cleandepend: 29881084Sjake cd $S/modules ; env ${MKMODULESENV} ${MAKE} cleandepend 29981084Sjake 30081084Sjakemodules-clobber: modules-clean 30181084Sjake rm -rf ${MKMODULESENV} 30281084Sjake 30381084Sjakemodules-cleandir: 30481084Sjake cd $S/modules ; env ${MKMODULESENV} ${MAKE} cleandir 30581084Sjake 30681084Sjakemodules-tags: 30781084Sjake cd $S/modules ; env ${MKMODULESENV} ${MAKE} tags 30881084Sjake 30981084Sjakemodules-install modules-install.debug: 31081084Sjake cd $S/modules ; env ${MKMODULESENV} ${MAKE} install 31181084Sjake 31281084Sjakemodules-reinstall modules-reinstall.debug: 31381084Sjake cd $S/modules ; env ${MKMODULESENV} ${MAKE} install 31481084Sjake 31581084Sjakeconfig.o: 31681084Sjake ${NORMAL_C} 31781084Sjake 31881084Sjakevers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP} 31981084Sjake sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT} 32081084Sjake 32181084Sjake# XXX strictly, everything depends on Makefile because changes to ${PROF} 32281084Sjake# only appear there, but we don't handle that. 32381084Sjakevers.o: 32481084Sjake ${NORMAL_C} 32581084Sjake 32681084Sjakehints.o: hints.c 32781084Sjake ${NORMAL_C} 32881084Sjake 32981084Sjakevnode_if.c: $S/kern/vnode_if.pl $S/kern/vnode_if.src 33081084Sjake perl5 $S/kern/vnode_if.pl -c $S/kern/vnode_if.src 33181084Sjake 33281084Sjakevnode_if.h: $S/kern/vnode_if.pl $S/kern/vnode_if.src 33381084Sjake perl5 $S/kern/vnode_if.pl -h $S/kern/vnode_if.src 33481084Sjake 33581084Sjakevnode_if.o: 33681084Sjake ${NORMAL_C} 33781084Sjake 33881084Sjake# Commented out for now pending a better solution. 33981084Sjake# How do we pick up compiler version specific flags?? 34081084Sjake#.if exists($S/../share/mk) 34181084Sjake#.include "$S/../share/mk/bsd.kern.mk" 34281084Sjake#.else 34381084Sjake.include <bsd.kern.mk> 34481084Sjake#.endif 34581084Sjake 34681084Sjake%RULES 34781084Sjake 34881084Sjake# DO NOT DELETE THIS LINE -- make depend uses it 349