Makefile.i386 revision 4
1# Copyright 1990 W. Jolitz
2# @(#)Makefile.i386	7.1 5/10/91
3# Makefile for 4.3 BSD-Reno
4#
5# This makefile is constructed from a machine description:
6#	config machineid
7# Most changes should be made in the machine description
8#	/sys/i386/conf/``machineid''
9# after which you should do
10#	 config machineid
11# Generic makefile changes should be made in
12#	/sys/i386/conf/Makefile.i386
13# after which config should be rerun for all machines.
14#
15# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE INVISIBLE TO MAKEFILE
16#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
17#
18# -DTRACE	compile in kernel tracing hooks
19# -DQUOTA	compile in file system quotas
20#
21# PATCHES MAGIC                LEVEL   PATCH THAT GOT US HERE
22# --------------------         -----   ----------------------
23# CURRENT PATCH LEVEL:         3       00158
24# --------------------         -----   ----------------------
25#
26# 29 Jun 92	Chris G. Demetriou	Fix vers.o for kernel profiling and
27#						plain old link
28# 25 Mar 93	Sean Eric Fagan		Add support for assembler source
29# 25 Apr 93	Bruce Evans		Support for intr-0.0, and some fixes
30#		Rodney W. Grimes	Added depedencies for conf.o due to
31#					all the new drivers. And to param.c
32#					because there were missing.
33# 26 May 97	Rodney W. Grimes	Remove extra SYSTEM_LD_TAIL
34#					Redirect stderr from dbsym to null,
35#					this is bad, but atleast I won't get
36#					100's of bug reports about the silly
37#					warning from dbsym.
38#
39TOUCH=	touch -f -c
40LD=	/usr/bin/ld
41CC=	cc 
42CPP=	cpp
43
44S=	../..
45I386=	../../i386
46
47INCLUDES= -I. -I$S -I$S/sys
48COPTS=	${INCLUDES} ${IDENT} -DKERNEL -Di386 -DNPX
49ASFLAGS=
50CFLAGS=	-O ${COPTS}
51
52NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
53NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
54NORMAL_S= ${CPP} -I. -DLOCORE ${COPTS} $< | ${AS} ${ASFLAGS} -o $*.o
55DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
56DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
57SYSTEM_OBJS=locore.o ${OBJS} param.o ioconf.o conf.o
58SYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS}
59SYSTEM_LD_HEAD= 	@echo loading $@; rm -f $@
60SYSTEM_LD= @${LD} -z -T FE000000 -o $@ -X vers.o ${SYSTEM_OBJS}
61SYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; \
62		dbsym $@ 2>/dev/null || true; size $@; chmod 755 $@
63
64GPROF.EX=	/usr/src/lib/csu.i386/gprof.ex
65PROFILE_C=	${CC} -S -c ${CFLAGS} $< ; \
66		ex - $*.s < ${GPROF.EX} ; \
67		${AS} -o $@ $*.s ; \
68		rm -f $*.s
69
70%OBJS
71
72%CFILES
73
74%LOAD
75
76clean:
77	rm -f eddep *386bsd tags *.o locore.i [a-uw-z]*.s \
78		errs linterrs makelinks genassym
79
80lint: /tmp param.c
81	@lint -hbxn -I. -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
82	  ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \
83	    grep -v 'struct/union .* never defined' | \
84	    grep -v 'possible pointer alignment problem'
85
86symbols.sort: ${I386}/i386/symbols.raw
87	grep -v '^#' ${I386}/i386/symbols.raw \
88	    | sed 's/^	//' | sort -u > symbols.sort
89
90locore.o: assym.s ${I386}/i386/locore.s machine/trap.h machine/psl.h \
91	machine/pte.h ${I386}/isa/vector.s ${I386}/isa/icu.s \
92	$S/sys/errno.h machine/specialreg.h ${I386}/isa/debug.h \
93	${I386}/isa/icu.h ${I386}/isa/isa.h vector.h $S/net/netisr.h
94	${CPP} -I. -DLOCORE ${COPTS} ${I386}/i386/locore.s | \
95		${AS} ${ASFLAGS} -o locore.o
96
97# the following is necessary because autoconf.o depends on #if GENERIC
98autoconf.o: Makefile
99
100# depend on network configuration
101af.o uipc_proto.o locore.o: Makefile
102
103# depend on maxusers
104assym.s machdep.o: Makefile
105
106# depends on KDB (cons.o also depends on GENERIC)
107trap.o cons.o: Makefile
108
109assym.s: $S/sys/param.h machine/pte.h $S/sys/buf.h \
110    $S/sys/vmmeter.h \
111    $S/sys/proc.h $S/sys/msgbuf.h machine/vmparam.h
112
113assym.s: genassym
114	./genassym >assym.s
115
116genassym:
117	${CC} ${INCLUDES} -DKERNEL ${IDENT} ${PARAM} \
118		 ${I386}/i386/genassym.c -o genassym
119
120depend: assym.s param.c
121	sh /usr/bin/mkdep ${COPTS} ${CFILES} ioconf.c
122	sh /usr/bin/mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${I386}/i386/genassym.c
123
124links:
125	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
126	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
127	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
128	  sort -u | comm -23 - dontlink | \
129	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
130	sh makelinks && rm -f dontlink
131
132tags:
133	@echo "see $S/kern/Makefile for tags"
134
135ioconf.o: ioconf.c $S/sys/param.h machine/pte.h $S/sys/buf.h \
136    ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h
137	${CC} -c ${CFLAGS} ioconf.c
138
139conf.o: $S/sys/param.h $S/sys/systm.h $S/sys/buf.h $S/sys/ioctl.h \
140	$S/sys/tty.h $S/sys/conf.h \
141	as.h bpfilter.h cd.h ch.h com.h dcfclk.h fd.h lpa.h \
142	lpt.h pty.h sd.h speaker.h st.h wd.h wt.h \
143	${I386}/i386/conf.c
144	${CC} -traditional -c ${CFLAGS} ${I386}/i386/conf.c
145
146param.c: $S/conf/param.c \
147	$S/sys/param.h $S/sys/systm.h $S/sys/socket.h $S/sys/proc.h \
148	$S/sys/vnode.h $S/sys/file.h $S/sys/callout.h $S/sys/clist.h \
149	$S/sys/mbuf.h $S/ufs/quota.h $S/sys/kernel.h machine/vmparam.h \
150	$S/sys/shm.h
151	-rm -f param.c
152	cp $S/conf/param.c .
153
154param.o: param.c Makefile
155	${CC} -c ${CFLAGS} ${PARAM} param.c
156
157newvers:
158	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
159	${CC} ${CFLAGS} -c vers.c
160
161%RULES
162
163# DO NOT DELETE THIS LINE -- make depend uses it
164
165