Makefile.i386 revision 757
154359Sroberto# Copyright 1990 W. Jolitz
2182007Sroberto#	from: @(#)Makefile.i386	7.1 5/10/91
3290001Sglebius#	$Id: Makefile.i386,v 1.12 1993/11/07 16:46:33 wollman Exp $
4182007Sroberto#
554359Sroberto# Makefile for FreeBSD
654359Sroberto#
754359Sroberto# This makefile is constructed from a machine description:
8182007Sroberto#	config machineid
9290001Sglebius# Most changes should be made in the machine description
1054359Sroberto#	/sys/i386/conf/``machineid''
11182007Sroberto# after which you should do
12182007Sroberto#	 config machineid
13182007Sroberto# Generic makefile changes should be made in
14182007Sroberto#	/sys/i386/conf/Makefile.i386
15182007Sroberto# after which config should be rerun for all machines.
16182007Sroberto#
17182007Sroberto# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE INVISIBLE TO MAKEFILE
18182007Sroberto#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
19182007Sroberto#
20182007Sroberto# -DTRACE	compile in kernel tracing hooks
21182007Sroberto# -DQUOTA	compile in file system quotas
22182007Sroberto#
23182007SrobertoTOUCH=	touch -f -c
24182007SrobertoLD=	/usr/bin/ld
25182007SrobertoCC=	cc 
26182007SrobertoCPP=	cpp
27182007SrobertoSTRIP=	strip
28182007SrobertoDBSYM=	/usr/sbin/dbsym
29182007Sroberto
30182007SrobertoS=	../..
31182007SrobertoI386=	../../i386
32182007Sroberto
33182007SrobertoCWARNFLAGS=
34182007SrobertoCOPTFLAGS=-O
3554359SrobertoINCLUDES= -I. -I$S -I$S/sys
3654359SrobertoCOPTS=	${INCLUDES} ${IDENT} -DKERNEL -Di386 -DNPX
3754359SrobertoASFLAGS=
3854359SrobertoCFLAGS=	${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS}
3954359SrobertoLOAD_ADDRESS?=	FE000000
40182007Sroberto
4154359SrobertoNORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
4254359SrobertoNORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
43290001SglebiusNORMAL_S= ${CPP} -I. -DLOCORE ${COPTS} $< | ${AS} ${ASFLAGS} -o $*.o
4454359SrobertoDRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
4554359SrobertoDRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
4654359SrobertoSYSTEM_OBJS=locore.o exception.o swtch.o support.o ${OBJS} param.o \
4754359Sroberto	ioconf.o conf.o machdep.o
4854359SrobertoSYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS}
4954359SrobertoSYSTEM_LD_HEAD= 	@echo loading $@; rm -f $@
5054359SrobertoSYSTEM_LD= @${LD} -z -T ${LOAD_ADDRESS} -o $@ -X vers.o ${SYSTEM_OBJS}
5154359SrobertoSYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; \
5254359Sroberto	${DBSYM} -fT ${LOAD_ADDRESS} $@; ${STRIP} -x $@; size $@; chmod 755 $@
5354359Sroberto
5454359Sroberto# (XXX) ok, this is weird.  but we've got a working ed, and a broken ex, and
5554359Sroberto# the script is identical for either... -- cgd
5654359Sroberto#
5754359SrobertoGPROF.EX=	/usr/src/lib/csu.i386/gprof.ex
5854359SrobertoPROFILE_C=	${CC} -S -c ${CFLAGS} $< ; \
5954359Sroberto		ed - $*.s < ${GPROF.EX} ; \
6054359Sroberto		${AS} -o $@ $*.s ; \
6154359Sroberto		rm -f $*.s
6254359Sroberto
6354359Sroberto%OBJS
6454359Sroberto
6554359Sroberto%CFILES
6654359Sroberto
6754359Sroberto%LOAD
6854359Sroberto
6954359Srobertoclean:
7054359Sroberto	rm -f eddep *386bsd tags *.o locore.i [a-uw-z]*.s \
7154359Sroberto		errs linterrs makelinks genassym ,assym.s stamp-assym
7254359Sroberto
7354359Sroberto#lint: /tmp param.c
7454359Sroberto#	@lint -hbxn -I. -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
7554359Sroberto#	  ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \
7654359Sroberto#	    grep -v 'struct/union .* never defined' | \
77290001Sglebius#	    grep -v 'possible pointer alignment problem'
7854359Sroberto
7954359Srobertosymbols.sort: ${I386}/i386/symbols.raw
8054359Sroberto	grep -v '^#' ${I386}/i386/symbols.raw \
8154359Sroberto	    | sed 's/^	//' | sort -u > symbols.sort
8254359Sroberto
8354359Srobertolocore.o: assym.s ${I386}/i386/locore.s machine/trap.h machine/psl.h \
8454359Sroberto	machine/pte.h ${I386}/isa/vector.s ${I386}/isa/icu.s \
8554359Sroberto	$S/sys/errno.h machine/specialreg.h ${I386}/isa/debug.h \
8654359Sroberto	${I386}/isa/icu.h ${I386}/isa/isa.h vector.h $S/net/netisr.h \
8754359Sroberto	machine/asmacros.h
8854359Sroberto	${CPP} -I. -DLOCORE ${COPTS} ${I386}/i386/locore.s | \
8954359Sroberto		${AS} ${ASFLAGS} -o locore.o
9054359Sroberto
9154359Srobertoexception.o: assym.s ${I386}/i386/exception.s machine/trap.h \
9254359Sroberto	${I386}/isa/vector.s ${I386}/isa/icu.s \
9354359Sroberto	$S/sys/errno.h ${I386}/isa/icu.h ${I386}/isa/isa.h vector.h \
9454359Sroberto	$S/net/netisr.h machine/asmacros.h
9554359Sroberto	${CPP} -I. -DLOCORE ${COPTS} ${I386}/i386/exception.s | \
9654359Sroberto		${AS} ${ASFLAGS} -o exception.o
9754359Sroberto
9854359Srobertoswtch.o: assym.s ${I386}/i386/swtch.s \
9954359Sroberto	$S/sys/errno.h ${I386}/isa/debug.h machine/asmacros.h
10054359Sroberto	${CPP} -I. ${COPTS} ${I386}/i386/swtch.s | \
10154359Sroberto		${AS} ${ASFLAGS} -o swtch.o
10254359Sroberto
103290001Sglebiussupport.o: assym.s ${I386}/i386/support.s \
10454359Sroberto	$S/sys/errno.h machine/asmacros.h
105290001Sglebius	${CPP} -I. ${COPTS} ${I386}/i386/support.s | \
10654359Sroberto		${AS} ${ASFLAGS} -o support.o
10754359Sroberto
10854359Srobertomachdep.o: ${I386}/i386/machdep.c Makefile
109290001Sglebius	${CC} -c ${CFLAGS} -DLOAD_ADDRESS=0x${LOAD_ADDRESS} ${PROF} $<
11054359Sroberto
11154359Sroberto# the following is necessary because autoconf.o depends on #if GENERIC
11254359Srobertoautoconf.o: Makefile
11354359Sroberto
11454359Sroberto# depend on network configuration
11554359Srobertoaf.o uipc_proto.o locore.o: Makefile
11654359Sroberto
11754359Sroberto# depends on KDB (cons.o also depends on GENERIC)
11854359Srobertotrap.o cons.o: Makefile
11954359Sroberto
12054359Srobertoassym.s: genassym
12154359Sroberto	./genassym >,assym.s
12254359Sroberto	if cmp -s assym.s ,assym.s; then \
12354359Sroberto		rm -f ,assym.s; \
12454359Sroberto	else \
12554359Sroberto		rm -f assym.s; \
12654359Sroberto		mv ,assym.s assym.s; \
12754359Sroberto	fi
128290001Sglebius
129290001Sglebius# Some of the defines that genassym outputs may well depend on the 
13054359Sroberto# value of kernel options.
13154359Srobertogenassym:	Makefile
13254359Sroberto	${CC} ${INCLUDES} -DKERNEL ${IDENT} ${PARAM} \
13354359Sroberto		 ${I386}/i386/genassym.c -o genassym
13454359Sroberto
135290001Sglebiusdepend: assym.s param.c
13654359Sroberto	sh /usr/bin/mkdep -DLOAD_ADDRESS=0x${LOAD_ADDRESS} ${COPTS} ${CFILES} ioconf.c param.c ${I386}/i386/conf.c
13754359Sroberto	sh /usr/bin/mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${I386}/i386/genassym.c
13854359Sroberto
13954359Srobertolinks:
14054359Sroberto	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
141290001Sglebius	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
14254359Sroberto	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
14354359Sroberto	  sort -u | comm -23 - dontlink | \
14454359Sroberto	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
14554359Sroberto	sh makelinks && rm -f dontlink
146290001Sglebius
14754359Srobertotags:
14854359Sroberto	@echo "see $S/kern/Makefile for tags"
14954359Sroberto
15054359Srobertoioconf.o: ioconf.c $S/sys/param.h machine/pte.h $S/sys/buf.h \
15154359Sroberto    ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h
15254359Sroberto	${CC} -c ${CFLAGS} ioconf.c
15354359Sroberto
15454359Srobertoconf.o: ${I386}/i386/conf.c
15554359Sroberto	${CC} -traditional -c ${CFLAGS} ${I386}/i386/conf.c
15654359Sroberto
15754359Srobertoparam.c: $S/conf/param.c
15854359Sroberto	-rm -f param.c
15954359Sroberto	cp $S/conf/param.c .
16054359Sroberto
16154359Srobertoparam.o: param.c Makefile
16254359Sroberto	${CC} -c ${CFLAGS} ${PARAM} param.c
16354359Sroberto
16454359Srobertovers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
16554359Sroberto	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
16654359Sroberto	${CC} ${CFLAGS} -c vers.c
16754359Sroberto
16854359Sroberto%RULES
16954359Sroberto
17054359Sroberto# DO NOT DELETE THIS LINE -- make depend uses it
17154359Sroberto
17254359Sroberto