1 # $NetBSD: Makefile,v 1.3 2008/05/03 14:48:31 lukem Exp $
8 TOP
= ${NETBSDSRCDIR}/gnu
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
24 -I
${DIST}/sim
/ppc
-I
${DIST}/include \
25 -I
${.CURDIR
}/..
/..
/arch
/${MACHINE_ARCH} \
26 -I
${.CURDIR
}/..
/..
/bfd
/arch
/${MACHINE_ARCH} \
28 -I
${.CURDIR
}/..
/..
/gdb \
30 -I
${DIST}/gdb
/config \
32 -I
${.CURDIR
}/..
/arch
/${MACHINE_ARCH} \
34 PSIM_DEFINES
= -DHAVE_CONFIG_H \
35 -DDEFAULT_INLINE
=PSIM_INLINE_LOCALS \
36 -DWITH_HOST_BYTE_ORDER
=BYTE_ORDER \
38 -DHAVE_TERMIOS_STRUCTURE \
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.
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}
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
90 ${HOST_LINK.c
} ${IGENOBJS} -o
${.TARGET
}
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
104 ${MIC} tmp-spreg.h spreg.h
105 ${MIC} tmp-spreg.c spreg.c
109 ${HOST_LINK.c
} ${DGENOBJS} -o
${.TARGET
}
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
127 .
/gentmap
-h
> tmp-vals.h
128 ${MIC} tmp-vals.h targ-vals.h
131 targ-map.c
: gentmap targ-vals.def
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
144 for i in
${HWSRCS}; do \
152 done |
${TOOL_SED} -e
's/^.*\(hw_.*\)\.c/\1/' \
153 -e
's/^/extern const device_descriptor /' \
154 -e
's/$$/_device_descriptor\[\];/' \
157 for i in
${HWSRCS}; do \
165 done |
${TOOL_SED} -e
's/^.*\(hw_.*\)\.c/\1/' \
167 -e
's/$$/_device_descriptor,/' > tmp-hw.c
174 PACKAGE_SRC
= pk_disklabel.c
178 run-pk
: $(PACKAGE_SRC
)
180 for i in
$(PACKAGE_SRC
) ; do \
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
197 ${DEFINES_H}: 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
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 \
234 targ-map.c targ-vals.def \
235 run-defines run-dgen run-hw run-igen run-pk
239 ${HOST_COMPILE.c
} -o
${.TARGET
} $<
241 .PATH
: ${DIST}/sim
/ppc
${DIST}/sim
/common
243 .
include <bsd.lib.mk
>
244 .
include "../../Makefile.inc"