Makefile.i386 revision 1.5
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:         1       00001
24# --------------------         -----   ----------------------
25#
26# 29 Jun 92	Chris G. Demetriou	Fix vers.o for kernel profiling and
27#						plain old link
28#
29TOUCH=	touch -f -c
30LD=	/usr/bin/ld
31CC=	cc 
32CPP=	cpp
33
34S=	../..
35I386=	../../i386
36
37INCLUDES= -I. -I$S -I$S/sys
38COPTS=	${INCLUDES} ${IDENT} -DKERNEL -Di386 -DNPX
39ASFLAGS=
40CFLAGS=	-O ${COPTS}
41
42NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
43NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
44NORMAL_S= ${CPP} -I. -DLOCORE ${COPTS} $< | ${AS} ${ASFLAGS} -o $*.o
45DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
46DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
47SYSTEM_OBJS=locore.o ${OBJS} param.o ioconf.o conf.o
48SYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS}
49SYSTEM_LD_HEAD= 	@echo loading $@; rm -f $@
50SYSTEM_LD= @${LD} -z -T FE000000 -o $@ -X vers.o ${SYSTEM_OBJS}
51SYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; /usr/sbin/dbsym $@ || true; size $@; chmod 755 $@
52
53GPROF.EX=	/usr/src/lib/csu.i386/gprof.ex
54PROFILE_C=	${CC} -S -c ${CFLAGS} $< ; \
55		ex - $*.s < ${GPROF.EX} ; \
56		${AS} -o $@ $*.s ; \
57		rm -f $*.s
58
59%OBJS
60
61%CFILES
62
63%LOAD
64
65clean:
66	rm -f eddep *386bsd tags *.o locore.i [a-uw-z]*.s \
67		errs linterrs makelinks
68
69lint: /tmp param.c
70	@lint -hbxn -I. -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
71	  ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \
72	    grep -v 'struct/union .* never defined' | \
73	    grep -v 'possible pointer alignment problem'
74
75symbols.sort: ${I386}/i386/symbols.raw
76	grep -v '^#' ${I386}/i386/symbols.raw \
77	    | sed 's/^	//' | sort -u > symbols.sort
78
79locore.o: assym.s ${I386}/i386/locore.s machine/trap.h machine/psl.h \
80	machine/pte.h vector.s ${I386}/isa/icu.s ${I386}/isa/isa.h \
81	${I386}/isa/icu.h
82	${CPP} -I. -DLOCORE ${COPTS} ${I386}/i386/locore.s | \
83		${AS} ${ASFLAGS} -o locore.o
84
85# the following is necessary because autoconf.o depends on #if GENERIC
86autoconf.o: Makefile
87
88# depend on network configuration
89af.o uipc_proto.o locore.o: Makefile
90
91# depend on maxusers
92assym.s machdep.o: Makefile
93
94# depends on KDB (cons.o also depends on GENERIC)
95trap.o cons.o: Makefile
96
97assym.s: $S/sys/param.h machine/pte.h $S/sys/buf.h \
98    $S/sys/vmmeter.h \
99    $S/sys/proc.h $S/sys/msgbuf.h machine/vmparam.h
100
101assym.s: genassym
102	./genassym >assym.s
103
104genassym:
105	${CC} ${INCLUDES} -DKERNEL ${IDENT} ${PARAM} \
106		 ${I386}/i386/genassym.c -o genassym
107
108depend: assym.s param.c
109	sh /usr/bin/mkdep ${COPTS} ${CFILES} ioconf.c
110	sh /usr/bin/mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${I386}/i386/genassym.c
111
112links:
113	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
114	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
115	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
116	  sort -u | comm -23 - dontlink | \
117	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
118	sh makelinks && rm -f dontlink
119
120tags:
121	@echo "see $S/kern/Makefile for tags"
122
123ioconf.o: ioconf.c $S/sys/param.h machine/pte.h $S/sys/buf.h \
124    ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h
125	${CC} -c ${CFLAGS} ioconf.c
126
127conf.o: $S/sys/param.h $S/sys/systm.h $S/sys/buf.h $S/sys/ioctl.h \
128	$S/sys/tty.h $S/sys/conf.h ${I386}/i386/conf.c
129	${CC} -traditional -c ${CFLAGS} ${I386}/i386/conf.c
130
131param.c: $S/conf/param.c
132	-rm -f param.c
133	cp $S/conf/param.c .
134
135param.o: param.c Makefile
136	${CC} -c ${CFLAGS} ${PARAM} param.c
137
138newvers:
139	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
140	cc ${CFLAGS} -c vers.c
141
142%RULES
143
144# DO NOT DELETE THIS LINE -- make depend uses it
145
146