Makefile.cesfic revision 1.2 1 # $NetBSD: Makefile.cesfic,v 1.2 2001/05/29 02:20:22 mrg Exp $
2
3 # Makefile for NetBSD
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/arch/hp300/conf/``machineid''
9 # after which you should do
10 # config machineid
11 # Machine generic makefile changes should be made in
12 # /sys/arch/hp300/conf/Makefile.hp300
13 # after which config should be rerun for all machines of that type.
14 #
15 # N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
16 # IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
17 #
18
19 # DEBUG is set to -g if debugging.
20 # PROF is set to -pg if profiling.
21
22 CC?= cc
23 LD?= ld
24 MKDEP?= mkdep
25 STRIP?= strip
26 SIZE?= size
27 COPTS?= -O2
28
29 # source tree is located via $S relative to the compilation directory
30 .ifndef S
31 S!= cd ../../../..; pwd
32 .endif
33 CESFIC= $S/arch/cesfic
34
35 HAVE_GCC28!= ${CC} --version | egrep "^(2\.8|egcs)" ; echo
36 INCLUDES= -I. -I$S/arch -I$S -nostdinc
37 CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT
38 CWARNFLAGS= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-format
39 .if (${HAVE_GCC28} != "")
40 CWARNFLAGS+= -Wno-main
41 .endif
42 CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float #-Wa,-mwarn-no-reg-prefixes
43 AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE -Wa,-m68030 -Wa,-m68851 -Wa,-m68040 -Wa,-mwarn-no-reg-prefixes
44 LINKFLAGS= -n -Ttext 2000 -e start
45 STRIPFLAGS?= -d
46
47 HOSTED_CC= ${CC}
48 HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
49 HOSTED_CFLAGS= ${CFLAGS}
50
51 ### find out what to use for libkern
52 KERN_AS= obj
53 .include "$S/lib/libkern/Makefile.inc"
54 .ifndef PROF
55 LIBKERN= ${KERNLIB}
56 .else
57 LIBKERN= ${KERNLIB_PROF}
58 .endif
59
60 ### find out what to use for libcompat
61 .include "$S/compat/common/Makefile.inc"
62 .ifndef PROF
63 LIBCOMPAT= ${COMPATLIB}
64 .else
65 LIBCOMPAT= ${COMPATLIB_PROF}
66 .endif
67
68 ### for the Motorola 68040 Floating Point Software Product
69 .include "$S/arch/m68k/fpsp/Makefile.inc"
70
71 # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
72 # HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
73
74 NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
75 NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $<
76
77 HOSTED_C= ${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
78
79 %OBJS
80
81 %CFILES
82
83 #%SFILES
84
85 # load lines for config "xxx" will be emitted as:
86 # xxx: ${SYSTEM_DEP} swapxxx.o
87 # ${SYSTEM_LD_HEAD}
88 # ${SYSTEM_LD} swapxxx.o
89 # ${SYSTEM_LD_TAIL}
90 SYSTEM_OBJ= locore.o ${FPSP} \
91 param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
92 SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
93 SYSTEM_LD_HEAD= @rm -f $@
94 SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
95 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
96 SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@
97
98 DEBUG?=
99 .if ${DEBUG} == "-g"
100 LINKFLAGS+= -X
101 SYSTEM_LD_TAIL+=; \
102 echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
103 echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
104 .else
105 LINKFLAGS+= -S
106 .endif
107
108 %LOAD
109
110 assym.h: $S/kern/genassym.sh ${CESFIC}/cesfic/genassym.cf
111 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
112 < ${CESFIC}/cesfic/genassym.cf > assym.h.tmp && \
113 mv -f assym.h.tmp assym.h
114
115 param.c: $S/conf/param.c
116 rm -f param.c
117 cp $S/conf/param.c .
118
119 param.o: param.c Makefile
120 ${NORMAL_C}
121
122 ioconf.o: ioconf.c
123 ${NORMAL_C}
124
125 newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
126 sh $S/conf/newvers.sh
127 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
128
129 clean: cleankernel
130 cleankernel:
131 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
132 [Ee]rrs linterrs makelinks assym.h.tmp assym.h
133
134 lint:
135 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
136 ioconf.c param.c | \
137 grep -v 'static function .* unused'
138
139 tags:
140 @echo "see $S/kern/Makefile for tags"
141
142 links:
143 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
144 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
145 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
146 sort -u | comm -23 - dontlink | \
147 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
148 sh makelinks && rm -f dontlink
149
150 SRCS= ${CESFIC}/cesfic/locore.s \
151 param.c ioconf.c ${CFILES} ${SFILES}
152 depend: .depend
153 .depend: ${SRCS} assym.h param.c
154 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${CESFIC}/cesfic/locore.s
155 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
156 -if test -n "${SFILES}"; then \
157 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}; \
158 fi
159
160
161 # depend on root or device configuration
162 autoconf.o conf.o: Makefile
163
164 # depend on network or filesystem configuration
165 uipc_proto.o vfs_conf.o: Makefile
166
167 # depend on maxusers
168 machdep.o: Makefile
169
170 # depend on CPU configuration
171 dma.o hpux_machdep.o locore.o machdep.o pmap.o pmap_boostrap.o sys_machdep.o trap.o: Makefile
172
173
174 locore.o: ${CESFIC}/cesfic/locore.s assym.h
175 ${NORMAL_S}
176
177 %RULES
178