Makefile.i386 revision 1321
1283625Sdim# Copyright 1990 W. Jolitz
2283625Sdim#	from: @(#)Makefile.i386	7.1 5/10/91
3353358Sdim#	$Id: Makefile.i386,v 1.23 1994/03/21 20:48:47 ats Exp $
4353358Sdim#
5353358Sdim# Makefile for FreeBSD
6283625Sdim#
7283625Sdim# This makefile is constructed from a machine description:
8283625Sdim#	config machineid
9283625Sdim# Most changes should be made in the machine description
10283625Sdim#	/sys/i386/conf/``machineid''
11283625Sdim# after which you should do
12283625Sdim#	 config machineid
13283625Sdim# Generic makefile changes should be made in
14283625Sdim#	/sys/i386/conf/Makefile.i386
15283625Sdim# after which config should be rerun for all machines.
16283625Sdim#
17283625Sdim# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE INVISIBLE TO MAKEFILE
18283625Sdim#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
19327952Sdim#
20283625Sdim# -DTRACE	compile in kernel tracing hooks
21283625Sdim# -DQUOTA	compile in file system quotas
22283625Sdim#
23283625SdimTOUCH=	touch -f -c
24283625SdimLD=	/usr/bin/ld
25283625SdimCC=	cc 
26283625SdimCPP=	cpp
27283625SdimSTRIP=	strip
28283625SdimDBSYM=	/usr/sbin/dbsym
29283625Sdim
30341825SdimS=	../..
31341825SdimI386=	../../i386
32283625Sdim
33283625SdimCWARNFLAGS=-W -Wreturn-type -Wcomment
34283625Sdim#
35283625Sdim# The following flags are next up for working on:
36283625Sdim# -Wredundant-decls -Wnested-externs 
37283625Sdim#
38283625Sdim# When working on removing warnings from code, the `-Werror' flag should be
39283625Sdim# of material assistance.
40283625Sdim#
41283625SdimCOPTFLAGS=-O
42283625SdimCOPTFLAGS+=-D__FreeBSD__
43283625SdimINCLUDES= -I. -I$S -I$S/sys
44283625SdimCOPTS=	${INCLUDES} ${IDENT} -DKERNEL -Di386 -DNPX
45321369SdimASFLAGS=
46321369SdimCFLAGS=	${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS}
47321369SdimLOAD_ADDRESS?=	F0100000
48321369Sdim
49327952SdimNORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
50327952SdimNORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
51327952SdimNORMAL_S= ${CPP} -I. -DLOCORE ${COPTS} $< | ${AS} ${ASFLAGS} -o $*.o
52327952SdimDRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
53283625SdimDRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
54309124SdimSYSTEM_OBJS=locore.o exception.o swtch.o support.o ${OBJS} param.o \
55283625Sdim	ioconf.o conf.o machdep.o
56283625SdimSYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS}
57341825SdimSYSTEM_LD_HEAD= 	@echo loading $@; rm -f $@
58353358SdimSYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o
59327952SdimSYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; \
60327952Sdim	${DBSYM} -fT ${LOAD_ADDRESS} $@; ${STRIP} -x $@; size $@; chmod 755 $@
61341825Sdim
62341825Sdim# (XXX) ok, this is weird.  but we've got a working ed, and a broken ex, and
63341825Sdim# the script is identical for either... -- cgd
64341825Sdim#
65341825SdimGPROF.EX=	/usr/src/lib/csu.i386/gprof.ex
66283625SdimPROFILE_C=	${CC} -S -c ${CFLAGS} $< ; \
67327952Sdim		ed - $*.s < ${GPROF.EX} ; \
68341825Sdim		${AS} -o $@ $*.s ; \
69353358Sdim		rm -f $*.s
70327952Sdim
71327952Sdim%OBJS
72283625Sdim
73283625Sdim%CFILES
74283625Sdim
75283625Sdim%LOAD
76283625Sdim
77283625Sdimclean:
78283625Sdim	rm -f eddep *386bsd tags *.o locore.i [a-uw-z]*.s \
79309124Sdim		errs linterrs makelinks genassym ,assym.s stamp-assym
80309124Sdim
81283625Sdim#lint: /tmp param.c
82283625Sdim#	@lint -hbxn -I. -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
83309124Sdim#	  ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \
84309124Sdim#	    grep -v 'struct/union .* never defined' | \
85309124Sdim#	    grep -v 'possible pointer alignment problem'
86283625Sdim
87283625Sdimsymbols.sort: ${I386}/i386/symbols.raw
88283625Sdim	grep -v '^#' ${I386}/i386/symbols.raw \
89283625Sdim	    | sed 's/^	//' | sort -u > symbols.sort
90283625Sdim
91283625Sdimlocore.o: assym.s ${I386}/i386/locore.s machine/trap.h machine/psl.h \
92283625Sdim	machine/pte.h ${I386}/isa/vector.s ${I386}/isa/icu.s \
93283625Sdim	$S/sys/errno.h machine/specialreg.h \
94309124Sdim	${I386}/isa/icu.h ${I386}/isa/isa.h vector.h $S/net/netisr.h \
95283625Sdim	machine/asmacros.h
96283625Sdim	${CPP} -I. -DLOCORE ${COPTS} ${I386}/i386/locore.s | \
97283625Sdim		${AS} ${ASFLAGS} -o locore.o
98283625Sdim
99309124Sdimexception.o: assym.s ${I386}/i386/exception.s machine/trap.h \
100283625Sdim	${I386}/isa/vector.s ${I386}/isa/icu.s \
101283625Sdim	$S/sys/errno.h ${I386}/isa/icu.h ${I386}/isa/isa.h vector.h \
102283625Sdim	$S/net/netisr.h machine/asmacros.h
103283625Sdim	${CPP} -I. -DLOCORE ${COPTS} ${I386}/i386/exception.s | \
104353358Sdim		${AS} ${ASFLAGS} -o exception.o
105283625Sdim
106283625Sdimswtch.o: assym.s ${I386}/i386/swtch.s \
107283625Sdim	$S/sys/errno.h machine/asmacros.h
108283625Sdim	${CPP} -I. ${COPTS} ${I386}/i386/swtch.s | \
109283625Sdim		${AS} ${ASFLAGS} -o swtch.o
110283625Sdim
111283625Sdimsupport.o: assym.s ${I386}/i386/support.s \
112341825Sdim	$S/sys/errno.h machine/asmacros.h
113360784Sdim	${CPP} -I. ${COPTS} ${I386}/i386/support.s | \
114360784Sdim		${AS} ${ASFLAGS} -o support.o
115360784Sdim
116360784Sdimmachdep.o: ${I386}/i386/machdep.c Makefile
117360784Sdim	${CC} -c ${CFLAGS} -DLOAD_ADDRESS=0x${LOAD_ADDRESS} ${PROF} $<
118360784Sdim
119360784Sdim# the following is necessary because autoconf.o depends on #if GENERIC
120360784Sdimautoconf.o: Makefile
121360784Sdim
122360784Sdim# depend on network configuration
123360784Sdimaf.o uipc_proto.o locore.o: Makefile
124360784Sdim
125360784Sdim# depends on KDB (cons.o also depends on GENERIC)
126341825Sdimtrap.o cons.o: Makefile
127341825Sdim
128341825Sdimassym.s: genassym
129341825Sdim	./genassym >,assym.s
130341825Sdim	if cmp -s assym.s ,assym.s; then \
131341825Sdim		rm -f ,assym.s; \
132341825Sdim	else \
133283625Sdim		rm -f assym.s; \
134285181Sdim		mv ,assym.s assym.s; \
135283625Sdim	fi
136283625Sdim
137# Some of the defines that genassym outputs may well depend on the 
138# value of kernel options.
139genassym:	Makefile
140	${CC} ${INCLUDES} -DKERNEL ${IDENT} ${PARAM} \
141		 ${I386}/i386/genassym.c -static -o genassym
142
143depend: assym.s param.c
144	sh /usr/bin/mkdep -DLOAD_ADDRESS=0x${LOAD_ADDRESS} ${COPTS} ${CFILES} ioconf.c param.c ${I386}/i386/conf.c
145	sh /usr/bin/mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${I386}/i386/genassym.c
146
147links:
148	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
149	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
150	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
151	  sort -u | comm -23 - dontlink | \
152	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
153	sh makelinks && rm -f dontlink
154
155tags:
156	@echo "see $S/kern/Makefile for tags"
157
158ioconf.o: ioconf.c $S/sys/param.h machine/pte.h $S/sys/buf.h \
159    ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h
160	${CC} -c ${CFLAGS} ioconf.c
161
162conf.o: ${I386}/i386/conf.c $S/sys/conf.h
163	${CC} -c ${CFLAGS} ${I386}/i386/conf.c
164
165param.c: $S/conf/param.c
166	-rm -f param.c
167	cp $S/conf/param.c .
168
169param.o: param.c Makefile
170	${CC} -c ${CFLAGS} ${PARAM} param.c
171
172vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
173	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
174	${CC} ${CFLAGS} -c vers.c
175
176%RULES
177
178# DO NOT DELETE THIS LINE -- make depend uses it
179
180