Sync usage with man page.
[netbsd-mini2440.git] / gnu / usr.bin / gdb6 / sim / ppc / Makefile
blobfe105ac05a76a2d5e39ac8f90c976b1b85e03a45
1 # $NetBSD: Makefile,v 1.3 2008/05/03 14:48:31 lukem Exp $
3 LIBISPRIVATE= yes
4 NOGCCERROR=
6 .include <bsd.own.mk>
8 TOP= ${NETBSDSRCDIR}/gnu
9 DIST= ${TOP}/dist/gdb6
11 LIB= sim
12 SRCS= debug.c filter_filename.c bits.c sim-endian.c os_emul.c emul_generic.c \
13 emul_bugapi.c emul_chirp.c emul_netbsd.c emul_unix.c registers.c vm.c \
14 corefile.c model.c spreg.c cpu.c interrupts.c events.c cap.c device.c \
15 tree.c device_table.c itable.c mon.c icache.c semantics.c idecode.c \
16 support.c psim.c pk_disklabel.c hw_cpu.c hw_memory.c hw_nvram.c \
17 hw_iobus.c hw_htab.c hw_disk.c hw_trace.c hw_register.c hw_vm.c \
18 hw_init.c hw_core.c hw_pal.c hw_com.c hw_eeprom.c hw_opic.c hw_glue.c \
19 hw_phb.c hw_ide.c options.c sim_calls.c callback.c targ-map.c gdb-sim.c
21 MIC= ${HOST_SH} ${DIST}/move-if-change
23 HOST_CPPFLAGS+= -I. \
24 -I${DIST}/sim/ppc -I${DIST}/include \
25 -I${.CURDIR}/../../arch/${MACHINE_ARCH} \
26 -I${.CURDIR}/../../bfd/arch/${MACHINE_ARCH} \
27 -I${DIST}/bfd \
28 -I${.CURDIR}/../../gdb \
29 -I${DIST}/gdb \
30 -I${DIST}/gdb/config \
31 -DHAVE_COMMON_FPU \
32 -I${.CURDIR}/../arch/${MACHINE_ARCH} \
33 -I${DIST}/sim/common
34 PSIM_DEFINES= -DHAVE_CONFIG_H \
35 -DDEFAULT_INLINE=PSIM_INLINE_LOCALS \
36 -DWITH_HOST_BYTE_ORDER=BYTE_ORDER \
37 -DWITH_SMP=5 \
38 -DHAVE_TERMIOS_STRUCTURE \
39 -DHAVE_DEVZERO
41 # we need the same -I flags for host / target.
42 CPPFLAGS+= ${HOST_CPPFLAGS} ${PSIM_DEFINES}
45 # These portions run several programs to generate more code to compile.
48 # igen portion
49 IGEN_FLAGS= -E -F 32,f,o -CSRI 1024 -N 5 \
50 -o ${DIST}/sim/ppc/dc-complex \
51 -I ${DIST}/sim/ppc -i ${DIST}/sim/ppc/ppc-instructions \
52 -n icache.h -hc tmp-icache.h \
53 -n icache.c -c tmp-icache.c \
54 -n semantics.h -hs tmp-semantics.h \
55 -n semantics.c -s tmp-semantics.c \
56 -n idecode.h -hd tmp-idecode.h \
57 -n idecode.c -d tmp-idecode.c \
58 -n itable.h -ht tmp-itable.h \
59 -n itable.c -t tmp-itable.c \
60 -n model.h -hm tmp-model.h \
61 -n model.c -m tmp-model.c \
62 -n support.h -hf tmp-support.h \
63 -n support.c -f tmp-support.c
64 IGENED_FILES= icache.h icache.c idecode.h idecode.c semantics.h semantics.c \
65 itable.h itable.c model.h model.c support.h support.c
66 IGENSRCS= igen.c table.c lf.c misc.c filter_host.c ld-decode.c ld-cache.c filter.c ld-insn.c gen-model.c gen-itable.c gen-icache.c gen-semantics.c gen-idecode.c gen-support.c
67 IGENOBJS= ${IGENSRCS:S/.c/.lo/}
68 DPSRCS+= ${IGENED_FILES:M*.h}
70 ${IGENED_FILES}: run-igen
71 run-igen: igen ppc-instructions
72 ${_MKMSG_CREATE} ${IGENED_FILES}
73 rm -f ${.TARGET}
74 ./igen ${IGEN_FLAGS}
75 ${MIC} tmp-icache.h icache.h
76 ${MIC} tmp-icache.c icache.c
77 ${MIC} tmp-idecode.h idecode.h
78 ${MIC} tmp-idecode.c idecode.c
79 ${MIC} tmp-semantics.h semantics.h
80 ${MIC} tmp-semantics.c semantics.c
81 ${MIC} tmp-itable.h itable.h
82 ${MIC} tmp-itable.c itable.c
83 ${MIC} tmp-model.h model.h
84 ${MIC} tmp-model.c model.c
85 ${MIC} tmp-support.h support.h
86 ${MIC} tmp-support.c support.c
87 touch ${.TARGET}
89 igen: ${IGENOBJS}
90 ${HOST_LINK.c} ${IGENOBJS} -o ${.TARGET}
92 # dgen portion
93 DGEN_FLAGS= -r ${DIST}/sim/ppc/ppc-spr-table \
94 -n spreg.h -hp tmp-spreg.h \
95 -n spreg.c -p tmp-spreg.c
96 DGENED_FILES= spreg.h spreg.c
97 DGENSRCS= dgen.c table.c lf.c misc.c filter_host.c
98 DGENOBJS= ${DGENSRCS:S/.c/.lo/}
99 DPSRCS+= ${DGENED_FILES:M*.h}
101 ${DGENED_FILES}: run-dgen
102 run-dgen: dgen
103 ./dgen ${DGEN_FLAGS}
104 ${MIC} tmp-spreg.h spreg.h
105 ${MIC} tmp-spreg.c spreg.c
106 touch run-dgen
108 dgen: ${DGENOBJS}
109 ${HOST_LINK.c} ${DGENOBJS} -o ${.TARGET}
111 # gentmap portion
112 GENTMAPSRCS= gentmap.c
113 GENTMAPOBJS= ${GENTMAPSRCS:S/.c/.lo/}
115 gentmap: ${GENTMAPOBJS}
116 ${HOST_LINK.c} ${GENTMAPOBJS} -o ${.TARGET}
118 gentmap.c: targ-vals.def
120 targ-vals.def: ${DIST}/sim/ppc/../common/nltvals.def
121 rm -f targ-vals.def tmp-def
122 cat ${DIST}/sim/ppc/../common/nltvals.def > tmp-vals.def
123 ${MIC} tmp-vals.def targ-vals.def
125 targ-vals.h: gentmap targ-vals.def
126 rm -f tmp-vals.h
127 ./gentmap -h > tmp-vals.h
128 ${MIC} tmp-vals.h targ-vals.h
129 DPSRCS+= targ-vals.h
131 targ-map.c: gentmap targ-vals.def
132 rm -f tmp-map.c
133 ./gentmap -c > tmp-map.c
134 ${MIC} tmp-map.c targ-map.c
136 # hw.c / hw.h portion
137 HWSRCS= hw_cpu.c hw_memory.c hw_nvram.c hw_iobus.c hw_htab.c hw_disk.c \
138 hw_trace.c hw_register.c hw_vm.c hw_init.c hw_core.c hw_pal.c \
139 hw_com.c hw_eeprom.c hw_opic.c hw_glue.c hw_phb.c hw_ide.c
141 hw.h hw.c: run-hw
142 run-hw: Makefile
143 f=""; \
144 for i in ${HWSRCS}; do \
145 case " $$f " in \
146 *" $$i "*) ;; \
147 *) f="$$f $$i" ;; \
148 esac ; \
149 done ; \
150 for hw in $$f; do \
151 echo $$hw; \
152 done | ${TOOL_SED} -e 's/^.*\(hw_.*\)\.c/\1/' \
153 -e 's/^/extern const device_descriptor /' \
154 -e 's/$$/_device_descriptor\[\];/' \
155 > tmp-hw.h
156 f=""; \
157 for i in ${HWSRCS}; do \
158 case " $$f " in \
159 *" $$i "*) ;; \
160 *) f="$$f $$i" ;; \
161 esac ; \
162 done ; \
163 for hw in $$f; do \
164 echo $$hw; \
165 done | ${TOOL_SED} -e 's/^.*\(hw_.*\)\.c/\1/' \
166 -e 's/^/ /' \
167 -e 's/$$/_device_descriptor,/' > tmp-hw.c
168 ${MIC} tmp-hw.h hw.h
169 ${MIC} tmp-hw.c hw.c
170 touch run-hw
171 DPSRCS+= hw.h
173 # package portion
174 PACKAGE_SRC = pk_disklabel.c
175 PK_H = pk.h
177 ${PK_H}: run-pk
178 run-pk: $(PACKAGE_SRC)
179 f=""; \
180 for i in $(PACKAGE_SRC) ; do \
181 case " $$f " in \
182 *" $$i "*) ;; \
183 *) f="$$f $$i" ;; \
184 esac ; \
185 done ; \
186 for pk in $$f; do \
187 echo $$pk; \
188 done | ${TOOL_SED} -e 's/^.*pk_\(.*\)\.c/\1/' \
189 -e 's/^/extern package_create_instance_callback pk_/' \
190 -e 's/$$/_create_instance;/' > tmp-pk.h
191 ${MIC} tmp-pk.h pk.h
192 touch run-pk
193 DPSRCS+= ${PK_H}
195 # defines portion
196 DEFINES_H= defines.h
197 ${DEFINES_H}: run-defines
198 run-defines:
199 ${TOOL_SED} -n -e '/^#define HAVE_/s/ 1$$/",/' \
200 -e '/^#define HAVE_/s//"HAVE_/p' \
201 < ${.CURDIR}/../arch/${MACHINE_ARCH}/config.h > tmp-defines.h
202 ${MIC} tmp-defines.h defines.h
203 touch run-defines
204 DPSRCS+= ${DEFINES_H}
206 # misc. dependancies.
207 filter_host.c: ${DIST}/sim/ppc/filter_filename.c
208 cp ${.ALLSRC} ${.TARGET}
209 filter_host.lo: ppc-config.h
211 ppc-config.h: ${DIST}/sim/ppc/std-config.h
212 cp ${.ALLSRC} ${.TARGET}
213 DPSRCS+= ppc-config.h
215 CLEANFILES+= igen dgen gentmap *.lo \
216 ppc-config.h filter_host.c \
217 tmp-icache.h icache.h \
218 tmp-icache.c icache.c \
219 tmp-idecode.h idecode.h \
220 tmp-idecode.c idecode.c \
221 tmp-semantics.h semantics.h \
222 tmp-semantics.c semantics.c \
223 tmp-itable.h itable.h \
224 tmp-itable.c itable.c \
225 tmp-model.h model.h \
226 tmp-model.c model.c \
227 tmp-support.h support.h \
228 tmp-support.c support.c \
229 tmp-spreg.h spreg.h \
230 tmp-spreg.c spreg.c \
231 tmp-vals.h targ-vals.h \
232 hw.c hw.h \
233 defines.h pk.h \
234 targ-map.c targ-vals.def \
235 run-defines run-dgen run-hw run-igen run-pk
237 .SUFFIXES: .lo
238 .c.lo:
239 ${HOST_COMPILE.c} -o ${.TARGET} $<
241 .PATH: ${DIST}/sim/ppc ${DIST}/sim/common
243 .include <bsd.lib.mk>
244 .include "../../Makefile.inc"