blob: c258d556ec3c8c6e8ff3b43507652768aa36dbe4 [file] [log] [blame]
# This script is sourced from the top-level Android emulator
# configuration script, and relies on the following macro
# definitions:
#
# QEMU2_TOP_DIR: top-level QEMU2 source directory.
# OUT_DIR: top-level build output directory.
QEMU2_AUTOGENERATED_DIR=$OUT_DIR/build/qemu2-qapi-auto-generated
probe_prebuilts_dir "QEMU2 Dependencies" \
QEMU2_DEPS_PREBUILTS_DIR \
qemu-android-deps
echo "QEMU2_DEPS_PREBUILTS_DIR := $QEMU2_DEPS_PREBUILTS_DIR" >> $config_mk
python $QEMU2_TOP_DIR/scripts/qapi-types.py \
--builtins \
-i $QEMU2_TOP_DIR/qapi-schema.json \
-o $QEMU2_AUTOGENERATED_DIR
python $QEMU2_TOP_DIR/scripts/qapi-visit.py \
--builtins \
-i $QEMU2_TOP_DIR/qapi-schema.json \
-o $QEMU2_AUTOGENERATED_DIR
python $QEMU2_TOP_DIR/scripts/qapi-event.py \
--builtins \
-i $QEMU2_TOP_DIR/qapi-schema.json \
-o $QEMU2_AUTOGENERATED_DIR
python $QEMU2_TOP_DIR/scripts/qapi-commands.py \
--middle \
-i $QEMU2_TOP_DIR/qapi-schema.json \
-o $QEMU2_AUTOGENERATED_DIR
mkdir -p "$QEMU2_AUTOGENERATED_DIR"/trace
python $QEMU2_TOP_DIR/scripts/tracetool.py \
--backends=nop \
--format=h \
--target-type system \
< $QEMU2_TOP_DIR/trace-events \
> $QEMU2_AUTOGENERATED_DIR/trace/generated-tracers.h
python $QEMU2_TOP_DIR/scripts/tracetool.py \
--backends=nop \
--format=c \
--target-type system \
< $QEMU2_TOP_DIR/trace-events \
> $QEMU2_AUTOGENERATED_DIR/trace/generated-tracers.c
python $QEMU2_TOP_DIR/scripts/tracetool.py \
--backends=nop \
--format=events-h \
--target-type system \
< $QEMU2_TOP_DIR/trace-events \
> $QEMU2_AUTOGENERATED_DIR/trace/generated-events.h
python $QEMU2_TOP_DIR/scripts/tracetool.py \
--backends=nop \
--format=events-c \
--target-type system \
< $QEMU2_TOP_DIR/trace-events \
> $QEMU2_AUTOGENERATED_DIR/trace/generated-events.c
python $QEMU2_TOP_DIR/scripts/tracetool.py \
--backends=nop \
--format=tcg-helper-h \
--target-type system \
< $QEMU2_TOP_DIR/trace-events \
> $QEMU2_AUTOGENERATED_DIR/trace/generated-helpers.h
python $QEMU2_TOP_DIR/scripts/tracetool.py \
--backends=nop \
--format=tcg-helper-wrapper-h \
--target-type system \
< $QEMU2_TOP_DIR/trace-events \
> $QEMU2_AUTOGENERATED_DIR/trace/generated-helpers-wrappers.h
python $QEMU2_TOP_DIR/scripts/tracetool.py \
--backends=nop \
--format=tcg-h \
--target-type system \
< $QEMU2_TOP_DIR/trace-events \
> $QEMU2_AUTOGENERATED_DIR/trace/generated-tcg-tracers.h
bash $QEMU2_TOP_DIR/scripts/hxtool -h \
< $QEMU2_TOP_DIR/qemu-options.hx \
> $QEMU2_AUTOGENERATED_DIR/qemu-options.def
bash $QEMU2_TOP_DIR/scripts/hxtool -h \
< $QEMU2_TOP_DIR/hmp-commands.hx \
> $QEMU2_AUTOGENERATED_DIR/hmp-commands.h
bash $QEMU2_TOP_DIR/scripts/hxtool -h \
< $QEMU2_TOP_DIR/qmp-commands.hx \
> $QEMU2_AUTOGENERATED_DIR/qmp-commands-old.h
bash $QEMU2_TOP_DIR/scripts/hxtool -h \
< $QEMU2_TOP_DIR/qemu-img-cmds.hx \
> $QEMU2_AUTOGENERATED_DIR/qemu-img-cmds.h
HEX_FILES=$(find $QEMU2_TOP_DIR/hw/i386/ -name "*.hex.generated" | \
sed -e 's|'$QEMU2_TOP_DIR/'||g')
mkdir -p $QEMU2_AUTOGENERATED_DIR/hw/i386
for HEX_FILES in $HEX_FILES; do
cp "$QEMU2_TOP_DIR/$HEX_FILES" "$QEMU2_AUTOGENERATED_DIR/${HEX_FILES%.generated}"
done
rm -f $QEMU2_AUTOGENERATED_DIR/gdbstub-xml-arm64.c
bash $QEMU2_TOP_DIR/scripts/feature_to_c.sh \
$QEMU2_AUTOGENERATED_DIR/gdbstub-xml-arm64.c \
$QEMU2_TOP_DIR/gdb-xml/aarch64-core.xml \
$QEMU2_TOP_DIR/gdb-xml/aarch64-fpu.xml \
$QEMU2_TOP_DIR/gdb-xml/arm-core.xml \
$QEMU2_TOP_DIR/gdb-xml/arm-vfp.xml \
$QEMU2_TOP_DIR/gdb-xml/arm-vfp3.xml \
$QEMU2_TOP_DIR/gdb-xml/arm-neon.xml
rm -f $QEMU2_AUTOGENERATED_DIR/gdbstub-xml-arm.c
bash $QEMU2_TOP_DIR/scripts/feature_to_c.sh \
$QEMU2_AUTOGENERATED_DIR/gdbstub-xml-arm.c \
$QEMU2_TOP_DIR/gdb-xml/arm-core.xml \
$QEMU2_TOP_DIR/gdb-xml/arm-vfp.xml \
$QEMU2_TOP_DIR/gdb-xml/arm-vfp3.xml \
$QEMU2_TOP_DIR/gdb-xml/arm-neon.xml
if [ "$OPT_MINGW" ]; then
$OUT_DIR/objs/build/toolchain/x86_64-mingw32-windres \
-o $QEMU2_AUTOGENERATED_DIR/version.o \
$QEMU2_TOP_DIR/version.rc
fi
# Work-around for a QEMU2 bug:
# $QEMU2/linux-headers/linux/kvm.h includes <asm/kvm.h>
# but $QEMU2/linux-headers/asm/ doesn't exist. It is supposed
# to be a symlink to $QEMU2/linux-headers/asm-x86/
#
# The end result is that the <asm/kvm.h> from the host system
# or toolchain sysroot is being included, which ends up in a
# conflict. Work around it by creating a symlink here
ln -sf $QEMU2_TOP_DIR/linux-headers/asm-x86 $QEMU2_AUTOGENERATED_DIR/asm