Makefile.i386 revision 770
1# Copyright 1990 W. Jolitz
2#	from: @(#)Makefile.i386	7.1 5/10/91
3#	$Id: Makefile.i386,v 1.14 1993/11/15 21:06:08 paul Exp $
4#
5# Makefile for FreeBSD
6#
7# This makefile is constructed from a machine description:
8#	config machineid
9# Most changes should be made in the machine description
10#	/sys/i386/conf/``machineid''
11# after which you should do
12#	 config machineid
13# Generic makefile changes should be made in
14#	/sys/i386/conf/Makefile.i386
15# after which config should be rerun for all machines.
16#
17# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE INVISIBLE TO MAKEFILE
18#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
19#
20# -DTRACE	compile in kernel tracing hooks
21# -DQUOTA	compile in file system quotas
22#
23TOUCH=	touch -f -c
24LD=	/usr/bin/ld
25CC=	cc 
26CPP=	cpp
27STRIP=	strip
28DBSYM=	/usr/sbin/dbsym
29
30S=	../..
31I386=	../../i386
32
33CWARNFLAGS=
34COPTFLAGS=-O
35INCLUDES= -I. -I$S -I$S/sys
36COPTS=	${INCLUDES} ${IDENT} -DKERNEL -Di386 -DNPX
37ASFLAGS=
38CFLAGS=	${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS}
39LOAD_ADDRESS?=	FE000000
40
41NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
42NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
43NORMAL_S= ${CPP} -I. -DLOCORE ${COPTS} $< | ${AS} ${ASFLAGS} -o $*.o
44DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
45DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
46SYSTEM_OBJS=locore.o exception.o swtch.o support.o ${OBJS} param.o \
47	ioconf.o conf.o machdep.o
48SYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS}
49SYSTEM_LD_HEAD= 	@echo loading $@; rm -f $@
50SYSTEM_LD= @${LD} -z -T ${LOAD_ADDRESS} -o $@ -X vers.o ${SYSTEM_OBJS}
51SYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; \
52	${DBSYM} -fT ${LOAD_ADDRESS} $@; ${STRIP} -x $@; size $@; chmod 755 $@
53
54# (XXX) ok, this is weird.  but we've got a working ed, and a broken ex, and
55# the script is identical for either... -- cgd
56#
57GPROF.EX=	/usr/src/lib/csu.i386/gprof.ex
58PROFILE_C=	${CC} -S -c ${CFLAGS} $< ; \
59		ed - $*.s < ${GPROF.EX} ; \
60		${AS} -o $@ $*.s ; \
61		rm -f $*.s
62
63%OBJS
64
65%CFILES
66
67%LOAD
68
69clean:
70	rm -f eddep *386bsd tags *.o locore.i [a-uw-z]*.s \
71		errs linterrs makelinks genassym ,assym.s stamp-assym
72
73#lint: /tmp param.c
74#	@lint -hbxn -I. -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
75#	  ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \
76#	    grep -v 'struct/union .* never defined' | \
77#	    grep -v 'possible pointer alignment problem'
78
79symbols.sort: ${I386}/i386/symbols.raw
80	grep -v '^#' ${I386}/i386/symbols.raw \
81	    | sed 's/^	//' | sort -u > symbols.sort
82
83locore.o: assym.s ${I386}/i386/locore.s machine/trap.h machine/psl.h \
84	machine/pte.h ${I386}/isa/vector.s ${I386}/isa/icu.s \
85	$S/sys/errno.h machine/specialreg.h ${I386}/isa/debug.h \
86	${I386}/isa/icu.h ${I386}/isa/isa.h vector.h $S/net/netisr.h \
87	machine/asmacros.h
88	${CPP} -I. -DLOCORE ${COPTS} ${I386}/i386/locore.s | \
89		${AS} ${ASFLAGS} -o locore.o
90
91exception.o: assym.s ${I386}/i386/exception.s machine/trap.h \
92	${I386}/isa/vector.s ${I386}/isa/icu.s \
93	$S/sys/errno.h ${I386}/isa/icu.h ${I386}/isa/isa.h vector.h \
94	$S/net/netisr.h machine/asmacros.h
95	${CPP} -I. -DLOCORE ${COPTS} ${I386}/i386/exception.s | \
96		${AS} ${ASFLAGS} -o exception.o
97
98swtch.o: assym.s ${I386}/i386/swtch.s \
99	$S/sys/errno.h ${I386}/isa/debug.h machine/asmacros.h
100	${CPP} -I. ${COPTS} ${I386}/i386/swtch.s | \
101		${AS} ${ASFLAGS} -o swtch.o
102
103support.o: assym.s ${I386}/i386/support.s \
104	$S/sys/errno.h machine/asmacros.h
105	${CPP} -I. ${COPTS} ${I386}/i386/support.s | \
106		${AS} ${ASFLAGS} -o support.o
107
108machdep.o: ${I386}/i386/machdep.c Makefile
109	${CC} -c ${CFLAGS} -DLOAD_ADDRESS=0x${LOAD_ADDRESS} ${PROF} $<
110
111# the following is necessary because autoconf.o depends on #if GENERIC
112autoconf.o: Makefile
113
114# depend on network configuration
115af.o uipc_proto.o locore.o: Makefile
116
117# depends on KDB (cons.o also depends on GENERIC)
118trap.o cons.o: Makefile
119
120assym.s: genassym
121	./genassym >,assym.s
122	if cmp -s assym.s ,assym.s; then \
123		rm -f ,assym.s; \
124	else \
125		rm -f assym.s; \
126		mv ,assym.s assym.s; \
127	fi
128
129# Some of the defines that genassym outputs may well depend on the 
130# value of kernel options.
131genassym:	Makefile
132	${CC} ${INCLUDES} -DKERNEL ${IDENT} ${PARAM} \
133		 ${I386}/i386/genassym.c -o genassym
134
135depend: assym.s param.c
136	sh /usr/bin/mkdep -DLOAD_ADDRESS=0x${LOAD_ADDRESS} ${COPTS} ${CFILES} ioconf.c param.c ${I386}/i386/conf.c
137	sh /usr/bin/mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${I386}/i386/genassym.c
138
139links:
140	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
141	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
142	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
143	  sort -u | comm -23 - dontlink | \
144	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
145	sh makelinks && rm -f dontlink
146
147tags:
148	@echo "see $S/kern/Makefile for tags"
149
150ioconf.o: ioconf.c $S/sys/param.h machine/pte.h $S/sys/buf.h \
151    ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h
152	${CC} -c ${CFLAGS} ioconf.c
153
154conf.o: ${I386}/i386/conf.c
155	${CC} -traditional -c ${CFLAGS} ${I386}/i386/conf.c
156
157param.c: $S/conf/param.c
158	-rm -f param.c
159	cp $S/conf/param.c .
160
161param.o: param.c Makefile
162	${CC} -c ${CFLAGS} ${PARAM} param.c
163
164vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
165	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
166	${CC} ${CFLAGS} -c vers.c
167
168%RULES
169
170# DO NOT DELETE THIS LINE -- make depend uses it
171
172