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