Makefile.powerpc revision 2112
1# Copyright 1990 W. Jolitz
2#	from: @(#)Makefile.i386	7.1 5/10/91
3#	$Id: Makefile.i386,v 1.28 1994/08/13 03:49:32 wollman 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
27DBSYM=	/usr/sbin/dbsym
28
29.if exists(./@/.)
30S=	./@
31.else
32S=	../..
33.endif
34I386=	${S}/i386
35
36CWARNFLAGS=-W -Wreturn-type -Wcomment -Wredundant-decls
37#
38# The following flags are next up for working on:
39# -Wredundant-decls -Wnested-externs 
40#
41# When working on removing warnings from code, the `-Werror' flag should be
42# of material assistance.
43#
44COPTFLAGS=-O
45INCLUDES= -I. -I$S -I$S/sys
46COPTS=	${INCLUDES} ${IDENT} -DKERNEL -Di386 -DNPX
47ASFLAGS=
48CFLAGS=	${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS}
49LOAD_ADDRESS?=	F0100000
50
51NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
52NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
53NORMAL_S= ${CPP} -I. -DLOCORE ${COPTS} $< | ${AS} ${ASFLAGS} -o $*.o
54DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
55DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
56SYSTEM_OBJS=locore.o exception.o swtch.o support.o ${OBJS} param.o \
57	ioconf.o conf.o machdep.o vnode_if.o
58SYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS} libkern.a
59SYSTEM_LD_HEAD= 	@echo loading $@; rm -f $@
60SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o libkern.a
61SYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; \
62	${DBSYM} -fT ${LOAD_ADDRESS} $@; size $@; chmod 755 $@
63
64# (XXX) ok, this is weird.  but we've got a working ed, and a broken ex, and
65# the script is identical for either... -- cgd
66#
67GPROF.EX=	/usr/src/lib/csu.i386/gprof.ex
68PROFILE_C=	${CC} -S -c ${CFLAGS} $< ; \
69		ed - $*.s < ${GPROF.EX} ; \
70		${AS} -o $@ $*.s ; \
71		rm -f $*.s
72
73%OBJS
74
75%CFILES
76
77%LOAD
78
79libkern.a:
80	-@if [ X${PROF} = X ]; \
81	then ln -s $S/libkern/obj/libkern.a libkern.a; \
82	else ln -s $S/libkern/obj/libkern_p.a libkern.a; \
83	fi; \
84	echo ln -s $S/libkern/obj/libkern.a libkern.a
85
86clean:
87	rm -f eddep *kernel tags *.o locore.i [a-uw-z]*.s \
88		errs linterrs makelinks genassym ,assym.s stamp-assym
89
90#lint: /tmp param.c
91#	@lint -hbxn -I. -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
92#	  ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \
93#	    grep -v 'struct/union .* never defined' | \
94#	    grep -v 'possible pointer alignment problem'
95
96symbols.sort: ${I386}/i386/symbols.raw
97	grep -v '^#' ${I386}/i386/symbols.raw \
98	    | sed 's/^	//' | sort -u > symbols.sort
99
100locore.o: assym.s ${I386}/i386/locore.s machine/trap.h machine/psl.h \
101	machine/pte.h ${I386}/isa/vector.s ${I386}/isa/icu.s \
102	$S/sys/errno.h machine/specialreg.h \
103	${I386}/isa/icu.h ${I386}/isa/isa.h vector.h $S/net/netisr.h \
104	machine/asmacros.h
105	${CPP} -I. -DLOCORE ${COPTS} ${I386}/i386/locore.s | \
106		${AS} ${ASFLAGS} -o locore.o
107
108exception.o: assym.s ${I386}/i386/exception.s machine/trap.h \
109	${I386}/isa/vector.s ${I386}/isa/icu.s \
110	$S/sys/errno.h ${I386}/isa/icu.h ${I386}/isa/isa.h vector.h \
111	$S/net/netisr.h machine/asmacros.h
112	${CPP} -I. -DLOCORE ${COPTS} ${I386}/i386/exception.s | \
113		${AS} ${ASFLAGS} -o exception.o
114
115swtch.o: assym.s ${I386}/i386/swtch.s \
116	$S/sys/errno.h machine/asmacros.h
117	${CPP} -I. ${COPTS} ${I386}/i386/swtch.s | \
118		${AS} ${ASFLAGS} -o swtch.o
119
120support.o: assym.s ${I386}/i386/support.s \
121	$S/sys/errno.h machine/asmacros.h
122	${CPP} -I. ${COPTS} ${I386}/i386/support.s | \
123		${AS} ${ASFLAGS} -o support.o
124
125machdep.o: ${I386}/i386/machdep.c Makefile
126	${CC} -c ${CFLAGS} -DLOAD_ADDRESS=0x${LOAD_ADDRESS} ${PROF} $<
127
128# the following is necessary because autoconf.o depends on #if GENERIC
129autoconf.o: Makefile
130
131# depend on network configuration
132af.o uipc_proto.o locore.o: Makefile
133
134# depends on KDB (cons.o also depends on GENERIC)
135trap.o cons.o: Makefile
136
137assym.s: genassym
138	./genassym >,assym.s
139	if cmp -s assym.s ,assym.s; then \
140		rm -f ,assym.s; \
141	else \
142		rm -f assym.s; \
143		mv ,assym.s assym.s; \
144	fi
145
146# Some of the defines that genassym outputs may well depend on the 
147# value of kernel options.
148genassym:	Makefile
149	${CC} ${INCLUDES} -DKERNEL ${IDENT} ${PARAM} \
150		 ${I386}/i386/genassym.c -static -o genassym
151
152depend: assym.s param.c vnode_if.h
153	sh /usr/bin/mkdep -DLOAD_ADDRESS=0x${LOAD_ADDRESS} ${COPTS} ${CFILES} ioconf.c param.c ${I386}/i386/conf.c
154	sh /usr/bin/mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${I386}/i386/genassym.c
155
156links:
157	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
158	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
159	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
160	  sort -u | comm -23 - dontlink | \
161	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
162	sh makelinks && rm -f dontlink
163
164tags:
165	@echo "see $S/kern/Makefile for tags"
166
167ioconf.o: ioconf.c $S/sys/param.h machine/pte.h $S/sys/buf.h \
168    ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h
169	${CC} -c ${CFLAGS} ioconf.c
170
171conf.o: ${I386}/i386/conf.c $S/sys/conf.h
172	${CC} -c ${CFLAGS} ${I386}/i386/conf.c
173
174param.c: $S/conf/param.c
175	-rm -f param.c
176	cp $S/conf/param.c .
177
178param.o: param.c Makefile
179	${CC} -c ${CFLAGS} ${PARAM} param.c
180
181vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
182	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
183	${CC} ${CFLAGS} -c vers.c
184
185vnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src
186	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
187vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
188	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
189
190%RULES
191
192# DO NOT DELETE THIS LINE -- make depend uses it
193
194