Makefile.powerpc revision 2408
14Srgrimes# Copyright 1990 W. Jolitz
2509Srgrimes#	from: @(#)Makefile.i386	7.1 5/10/91
32408Sbde#	$Id: Makefile.i386,v 1.31 1994/08/23 09:54:22 jkh Exp $
44Srgrimes#
5509Srgrimes# Makefile for FreeBSD
6509Srgrimes#
74Srgrimes# This makefile is constructed from a machine description:
84Srgrimes#	config machineid
94Srgrimes# Most changes should be made in the machine description
104Srgrimes#	/sys/i386/conf/``machineid''
114Srgrimes# after which you should do
124Srgrimes#	 config machineid
134Srgrimes# Generic makefile changes should be made in
144Srgrimes#	/sys/i386/conf/Makefile.i386
154Srgrimes# after which config should be rerun for all machines.
164Srgrimes#
174Srgrimes# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE INVISIBLE TO MAKEFILE
184Srgrimes#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
194Srgrimes#
204Srgrimes# -DTRACE	compile in kernel tracing hooks
214Srgrimes# -DQUOTA	compile in file system quotas
224Srgrimes#
234SrgrimesTOUCH=	touch -f -c
244SrgrimesLD=	/usr/bin/ld
254SrgrimesCC=	cc 
264SrgrimesCPP=	cpp
27509SrgrimesDBSYM=	/usr/sbin/dbsym
284Srgrimes
292056Swollman.if exists(./@/.)
302056SwollmanS=	./@
312056Swollman.else
324SrgrimesS=	../..
332056Swollman.endif
342056SwollmanI386=	${S}/i386
354Srgrimes
362112SwollmanCWARNFLAGS=-W -Wreturn-type -Wcomment -Wredundant-decls
37798Swollman#
382408Sbde# The following flag is next up for working on:
392408Sbde# -Wnested-externs 
40798Swollman#
41798Swollman# When working on removing warnings from code, the `-Werror' flag should be
42798Swollman# of material assistance.
43798Swollman#
44712SwollmanCOPTFLAGS=-O
454SrgrimesINCLUDES= -I. -I$S -I$S/sys
462408SbdeCOPTS=	${INCLUDES} ${IDENT} -DKERNEL -Di386 -DLOAD_ADDRESS=0x${LOAD_ADDRESS}
474SrgrimesASFLAGS=
48712SwollmanCFLAGS=	${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS}
49974SdgLOAD_ADDRESS?=	F0100000
504Srgrimes
514SrgrimesNORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
524SrgrimesNORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
532408Sbde# XXX errors leak out of all the pipes.  Should use cc *.S.
542408Sbde# XXX LOCORE means "don't declare C stuff" not "for locore.s".
554SrgrimesNORMAL_S= ${CPP} -I. -DLOCORE ${COPTS} $< | ${AS} ${ASFLAGS} -o $*.o
564SrgrimesDRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
574SrgrimesDRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
582408Sbde
592408SbdeSFILES=	${I386}/i386/exception.s ${I386}/i386/microtime.s \
602408Sbde	${I386}/i386/support.s ${I386}/i386/swtch.s
612408SbdeSYSTEM_CFILES= ioconf.c param.c vnode_if.c
622408SbdeSYSTEM_SFILES= ${I386}/i386/locore.s
632408SbdeSYSTEM_OBJS=locore.o ${OBJS} ioconf.o param.o vnode_if.o
641549SrgrimesSYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS} libkern.a
654SrgrimesSYSTEM_LD_HEAD= 	@echo loading $@; rm -f $@
661549SrgrimesSYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o libkern.a
674SrgrimesSYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; \
681891Sdg	${DBSYM} -fT ${LOAD_ADDRESS} $@; size $@; chmod 755 $@
694Srgrimes
70509Srgrimes# (XXX) ok, this is weird.  but we've got a working ed, and a broken ex, and
71509Srgrimes# the script is identical for either... -- cgd
72509Srgrimes#
734SrgrimesGPROF.EX=	/usr/src/lib/csu.i386/gprof.ex
744SrgrimesPROFILE_C=	${CC} -S -c ${CFLAGS} $< ; \
75509Srgrimes		ed - $*.s < ${GPROF.EX} ; \
764Srgrimes		${AS} -o $@ $*.s ; \
774Srgrimes		rm -f $*.s
784Srgrimes
794Srgrimes%OBJS
804Srgrimes
814Srgrimes%CFILES
824Srgrimes
834Srgrimes%LOAD
844Srgrimes
852232Sjkh# This is slightly different from before in that if you define PROF
862232Sjkh# to anything, it will assume profiling.  Don't do "PROF=" to turn
872232Sjkh# profiling off!
882232Sjkh.if exists($S/libkern/obj)
892232SjkhLIBKERNP=$S/libkern/obj
902232Sjkh.else
912232SjkhLIBKERNP=$S/libkern
922239Sjkh.endif
932239Sjkh
942232Sjkh.if defined(PROF)
952232SjkhLIBKERN=${LIBKERNP}/libkern_p.a
962232Sjkh.else
972232SjkhLIBKERN=${LIBKERNP}/libkern.a
982239Sjkh.endif
991549Srgrimes
1002232Sjkhlibkern.a: ${LIBKERN}
1012232Sjkh	ln -s ${LIBKERN} libkern.a
1022232Sjkh	echo ln -s ${LIBKERN} libkern.a
1032232Sjkh
1042232Sjkh${LIBKERN}:
1052232Sjkh	@(cd $S/libkern; make)
1062232Sjkh
1074Srgrimesclean:
1081569Srgrimes	rm -f eddep *kernel tags *.o locore.i [a-uw-z]*.s \
109715Swollman		errs linterrs makelinks genassym ,assym.s stamp-assym
1104Srgrimes
111715Swollman#lint: /tmp param.c
112715Swollman#	@lint -hbxn -I. -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
113715Swollman#	  ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \
114715Swollman#	    grep -v 'struct/union .* never defined' | \
115715Swollman#	    grep -v 'possible pointer alignment problem'
1164Srgrimes
1174Srgrimessymbols.sort: ${I386}/i386/symbols.raw
1184Srgrimes	grep -v '^#' ${I386}/i386/symbols.raw \
1194Srgrimes	    | sed 's/^	//' | sort -u > symbols.sort
1204Srgrimes
1212408Sbdelocore.o:
1222408Sbde	${NORMAL_S}
1234Srgrimes
1242408Sbde# everything potentially depends on the Makefile since everything potentially
1252408Sbde# depends on the options.  Some things are more dependent on the Makefile for
1262408Sbde# historical reasons.
1272408Sbdemachdep.o: Makefile
128757Sdg
1294Srgrimes# the following is necessary because autoconf.o depends on #if GENERIC
1304Srgrimesautoconf.o: Makefile
1314Srgrimes
1324Srgrimes# depend on network configuration
1334Srgrimesaf.o uipc_proto.o locore.o: Makefile
1344Srgrimes
1354Srgrimes# depends on KDB (cons.o also depends on GENERIC)
1364Srgrimestrap.o cons.o: Makefile
1374Srgrimes
1382408Sbde# this rule stops ./assym.s in .depend from causing problems
1392408Sbde./assym.s: assym.s
1402408Sbde
141649Snateassym.s: genassym
142715Swollman	./genassym >,assym.s
143715Swollman	if cmp -s assym.s ,assym.s; then \
144715Swollman		rm -f ,assym.s; \
145715Swollman	else \
146715Swollman		rm -f assym.s; \
147715Swollman		mv ,assym.s assym.s; \
148715Swollman	fi
1494Srgrimes
150715Swollman# Some of the defines that genassym outputs may well depend on the 
151715Swollman# value of kernel options.
152715Swollmangenassym:	Makefile
1534Srgrimes	${CC} ${INCLUDES} -DKERNEL ${IDENT} ${PARAM} \
1541030Snate		 ${I386}/i386/genassym.c -static -o genassym
1554Srgrimes
1562408Sbde# XXX this assumes that the options for NORMAL_C* and DRIVER_C* are identical.
1571549Srgrimesdepend: assym.s param.c vnode_if.h
1582408Sbde	mkdep ${COPTS} ${CFILES} ${SYSTEM_CFILES}
1592408Sbde	mkdep -a -p ${INCLUDES} -DKERNEL ${IDENT} ${PARAM} \
1602408Sbde		${I386}/i386/genassym.c
1612408Sbde	MKDEP_CPP=${CPP} ; export MKDEP_CPP ; \
1622408Sbde	mkdep -a -I. -DLOCORE ${COPTS} ${SFILES} ${SYSTEM_SFILES}
1634Srgrimes
1644Srgrimeslinks:
1654Srgrimes	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1664Srgrimes	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1674Srgrimes	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1684Srgrimes	  sort -u | comm -23 - dontlink | \
1694Srgrimes	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
1704Srgrimes	sh makelinks && rm -f dontlink
1714Srgrimes
1724Srgrimestags:
1734Srgrimes	@echo "see $S/kern/Makefile for tags"
1744Srgrimes
1754Srgrimesioconf.o: ioconf.c $S/sys/param.h machine/pte.h $S/sys/buf.h \
1764Srgrimes    ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h
1774Srgrimes	${CC} -c ${CFLAGS} ioconf.c
1784Srgrimes
179509Srgrimesparam.c: $S/conf/param.c
1804Srgrimes	-rm -f param.c
1814Srgrimes	cp $S/conf/param.c .
1824Srgrimes
1834Srgrimesparam.o: param.c Makefile
1844Srgrimes	${CC} -c ${CFLAGS} ${PARAM} param.c
1854Srgrimes
186509Srgrimesvers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1874Srgrimes	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
1884Srgrimes	${CC} ${CFLAGS} -c vers.c
1894Srgrimes
1901549Srgrimesvnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src
1911549Srgrimes	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
1921549Srgrimesvnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
1931549Srgrimes	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
1941549Srgrimes
1954Srgrimes%RULES
1964Srgrimes
1974Srgrimes# DO NOT DELETE THIS LINE -- make depend uses it
198