Makefile.i386 revision 1169
1# Copyright 1990 W. Jolitz
2#	from: @(#)Makefile.i386	7.1 5/10/91
3#	$Id: Makefile.i386,v 1.21 1994/02/13 20:37:32 jkh 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=-W -Wreturn-type -Wcomment
34#
35# The following flags are next up for working on:
36# -Wredundant-decls -Wnested-externs 
37#
38# When working on removing warnings from code, the `-Werror' flag should be
39# of material assistance.
40#
41COPTFLAGS=-O
42COPTFLAGS+=-D__FreeBSD__
43INCLUDES= -I. -I$S -I$S/sys
44COPTS=	${INCLUDES} ${IDENT} -DKERNEL -Di386 -DNPX
45ASFLAGS=
46CFLAGS=	${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS}
47LOAD_ADDRESS?=	F0100000
48
49NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
50NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
51NORMAL_S= ${CPP} -I. -DLOCORE ${COPTS} $< | ${AS} ${ASFLAGS} -o $*.o
52DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
53DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
54SYSTEM_OBJS=locore.o exception.o swtch.o support.o ${OBJS} param.o \
55	ioconf.o conf.o machdep.o
56SYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS}
57SYSTEM_LD_HEAD= 	@echo loading $@; rm -f $@
58SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X vers.o ${SYSTEM_OBJS}
59SYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; \
60	${DBSYM} -fT ${LOAD_ADDRESS} $@; ${STRIP} -x $@; size $@; chmod 755 $@
61
62# (XXX) ok, this is weird.  but we've got a working ed, and a broken ex, and
63# the script is identical for either... -- cgd
64#
65GPROF.EX=	/usr/src/lib/csu.i386/gprof.ex
66PROFILE_C=	${CC} -S -c ${CFLAGS} $< ; \
67		ed - $*.s < ${GPROF.EX} ; \
68		${AS} -o $@ $*.s ; \
69		rm -f $*.s
70
71%OBJS
72
73%CFILES
74
75%LOAD
76
77clean:
78	rm -f eddep *386bsd tags *.o locore.i [a-uw-z]*.s \
79		errs linterrs makelinks genassym ,assym.s stamp-assym
80
81#lint: /tmp param.c
82#	@lint -hbxn -I. -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
83#	  ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \
84#	    grep -v 'struct/union .* never defined' | \
85#	    grep -v 'possible pointer alignment problem'
86
87symbols.sort: ${I386}/i386/symbols.raw
88	grep -v '^#' ${I386}/i386/symbols.raw \
89	    | sed 's/^	//' | sort -u > symbols.sort
90
91locore.o: assym.s ${I386}/i386/locore.s machine/trap.h machine/psl.h \
92	machine/pte.h ${I386}/isa/vector.s ${I386}/isa/icu.s \
93	$S/sys/errno.h machine/specialreg.h ${I386}/isa/debug.h \
94	${I386}/isa/icu.h ${I386}/isa/isa.h vector.h $S/net/netisr.h \
95	machine/asmacros.h
96	${CPP} -I. -DLOCORE ${COPTS} ${I386}/i386/locore.s | \
97		${AS} ${ASFLAGS} -o locore.o
98
99exception.o: assym.s ${I386}/i386/exception.s machine/trap.h \
100	${I386}/isa/vector.s ${I386}/isa/icu.s \
101	$S/sys/errno.h ${I386}/isa/icu.h ${I386}/isa/isa.h vector.h \
102	$S/net/netisr.h machine/asmacros.h
103	${CPP} -I. -DLOCORE ${COPTS} ${I386}/i386/exception.s | \
104		${AS} ${ASFLAGS} -o exception.o
105
106swtch.o: assym.s ${I386}/i386/swtch.s \
107	$S/sys/errno.h ${I386}/isa/debug.h machine/asmacros.h
108	${CPP} -I. ${COPTS} ${I386}/i386/swtch.s | \
109		${AS} ${ASFLAGS} -o swtch.o
110
111support.o: assym.s ${I386}/i386/support.s \
112	$S/sys/errno.h machine/asmacros.h
113	${CPP} -I. ${COPTS} ${I386}/i386/support.s | \
114		${AS} ${ASFLAGS} -o support.o
115
116machdep.o: ${I386}/i386/machdep.c Makefile
117	${CC} -c ${CFLAGS} -DLOAD_ADDRESS=0x${LOAD_ADDRESS} ${PROF} $<
118
119# the following is necessary because autoconf.o depends on #if GENERIC
120autoconf.o: Makefile
121
122# depend on network configuration
123af.o uipc_proto.o locore.o: Makefile
124
125# depends on KDB (cons.o also depends on GENERIC)
126trap.o cons.o: Makefile
127
128assym.s: genassym
129	./genassym >,assym.s
130	if cmp -s assym.s ,assym.s; then \
131		rm -f ,assym.s; \
132	else \
133		rm -f assym.s; \
134		mv ,assym.s assym.s; \
135	fi
136
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