[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 110/132] meson: cpu-emu
From: |
Paolo Bonzini |
Subject: |
[PATCH 110/132] meson: cpu-emu |
Date: |
Thu, 19 Dec 2019 13:23:30 +0100 |
From: Marc-André Lureau <address@hidden>
Signed-off-by: Marc-André Lureau <address@hidden>
---
Makefile.target | 12 ------------
configure | 6 ++++++
meson.build | 28 ++++++++++++++++++++++++++++
scripts/feature_to_c.sh | 24 ++++++++----------------
4 files changed, 42 insertions(+), 28 deletions(-)
diff --git a/Makefile.target b/Makefile.target
index 0eca5f8..7b5b254 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -108,15 +108,6 @@ obj-y += $(LIBQEMU)
obj-y += trace/
#########################################################
-# cpu emulator library
-obj-y += exec.o
-obj-$(CONFIG_TCG) += tcg/tcg.o tcg/tcg-op.o tcg/tcg-op-vec.o tcg/tcg-op-gvec.o
-obj-$(CONFIG_TCG) += tcg/tcg-common.o tcg/optimize.o
-obj-$(CONFIG_TCG_INTERPRETER) += tcg/tci.o
-obj-$(CONFIG_TCG_INTERPRETER) += disas/tci.o
-obj-$(CONFIG_TCG) += fpu/softfloat.o
-obj-y += disas.o
-obj-$(call notempty,$(TARGET_XML_FILES)) += gdbstub-xml.o
LIBS := $(libs_cpu) $(LIBS)
#########################################################
@@ -199,9 +190,6 @@ ifdef CONFIG_DARWIN
$(call quiet-command,SetFile -a C $@,"SETFILE","$(TARGET_DIR)$@")
endif
-gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
- $(call quiet-command,rm -f $@ && $(SHELL)
$(SRC_PATH)/scripts/feature_to_c.sh $@
$(TARGET_XML_FILES),"GEN","$(TARGET_DIR)$@")
-
clean: clean-target
rm -f *.a *~ $(PROGS)
rm -f $(shell find . -name '*.[od]')
diff --git a/configure b/configure
index c53df48..ad36082 100755
--- a/configure
+++ b/configure
@@ -5034,9 +5034,13 @@ case "$capstone" in
LIBCAPSTONE=libcapstone.a
fi
libs_cpu="-L$PWD/capstone -lcapstone $libs_cpu"
+ capstone_libs="-L$PWD/capstone -lcapstone"
+ capstone_cflags="-I${source_path}/capstone/include"
;;
system)
+ capstone_libs="$($pkg_config --libs capstone)"
+ capstone_cflags="$($pkg_config --cflags capstone)"
QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags capstone)"
libs_cpu="$($pkg_config --libs capstone) $libs_cpu"
;;
@@ -7230,6 +7234,8 @@ if test "$ivshmem" = "yes" ; then
fi
if test "$capstone" != "no" ; then
echo "CONFIG_CAPSTONE=y" >> $config_host_mak
+ echo "CAPSTONE_CFLAGS=$capstone_cflags" >> $config_host_mak
+ echo "CAPSTONE_LIBS=$capstone_libs" >> $config_host_mak
fi
if test "$debug_mutex" = "yes" ; then
echo "CONFIG_DEBUG_MUTEX=y" >> $config_host_mak
diff --git a/meson.build b/meson.build
index 31c9591..6f2c838 100644
--- a/meson.build
+++ b/meson.build
@@ -319,6 +319,11 @@ if 'CONFIG_USB_LIBUSB' in config_host
libusb = declare_dependency(compile_args:
config_host['LIBUSB_CFLAGS'].split(),
link_args: config_host['LIBUSB_LIBS'].split())
endif
+capstone = declare_dependency()
+if 'CONFIG_CAPSTONE' in config_host
+ capstone = declare_dependency(compile_args:
config_host['CAPSTONE_CFLAGS'].split(),
+ link_args:
config_host['CAPSTONE_LIBS'].split())
+endif
create_config = find_program('scripts/create_config')
minikconf = find_program('scripts/minikconf.py')
@@ -481,6 +486,18 @@ hw_arch = {}
target_arch = {}
target_softmmu_arch = {}
+specific_ss.add(files('disas.c', 'exec.c'), capstone)
+specific_ss.add(when: 'CONFIG_TCG', if_true: files(
+ 'fpu/softfloat.c',
+ 'tcg/optimize.c',
+ 'tcg/tcg-common.c',
+ 'tcg/tcg-op-gvec.c',
+ 'tcg/tcg-op-vec.c',
+ 'tcg/tcg-op.c',
+ 'tcg/tcg.c',
+))
+specific_ss.add(when: 'CONFIG_TCG_INTERPRETER', if_true: files('disas/tci.c',
'tcg/tci.c'))
+
# TODO: add each directory to the subdirs from its own meson.build, once
# we have those
trace_events_subdirs = [
@@ -717,6 +734,8 @@ common_all = static_library('common',
dependencies: common_all.dependencies(),
name_suffix: 'fa')
+feature_to_c = find_program('scripts/feature_to_c.sh')
+
foreach target : target_dirs
config_target = target_config[target]
target_name = config_target['TARGET_NAME']
@@ -762,6 +781,15 @@ foreach target : target_dirs
endif
endif
+ if 'TARGET_XML_FILES' in config_target
+ gdbstub_xml = custom_target(target + '-gdbstub-xml.c',
+ output: target + '-gdbstub-xml.c',
+ input:
files(config_target['TARGET_XML_FILES'].split()),
+ command: [feature_to_c, '@INPUT@'],
+ capture: true)
+ arch_srcs += gdbstub_xml
+ endif
+
t = target_arch[arch].apply(config_target, strict: false)
arch_srcs += t.sources()
arch_deps += t.dependencies()
diff --git a/scripts/feature_to_c.sh b/scripts/feature_to_c.sh
index c8ce9b8..b116989 100644
--- a/scripts/feature_to_c.sh
+++ b/scripts/feature_to_c.sh
@@ -19,16 +19,8 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
-output=$1
-shift
-
-if test -z "$output" || test -z "$1"; then
- echo "Usage: $0 OUTPUTFILE INPUTFILE..."
- exit 1
-fi
-
-if test -e "$output"; then
- echo "Output file \"$output\" already exists; refusing to overwrite."
+if test -z "$1"; then
+ echo "Usage: $0 INPUTFILE..."
exit 1
fi
@@ -60,17 +52,17 @@ for input; do
printf "'\''\\n'\'', \n"
} END {
print " 0 };"
- }' < $input >> $output
+ }' < $input
done
-echo >> $output
-echo "const char *const xml_builtin[][2] = {" >> $output
+echo
+echo "const char *const xml_builtin[][2] = {"
for input; do
basename=$(echo $input | sed 's,.*/,,')
arrayname=xml_feature_$(echo $input | sed 's,.*/,,; s/[-.]/_/g')
- echo " { \"$basename\", $arrayname }," >> $output
+ echo " { \"$basename\", $arrayname },"
done
-echo " { (char *)0, (char *)0 }" >> $output
-echo "};" >> $output
+echo " { (char *)0, (char *)0 }"
+echo "};"
--
1.8.3.1
- [PATCH 099/132] meson: convert hw/block, (continued)
- [PATCH 099/132] meson: convert hw/block, Paolo Bonzini, 2019/12/19
- [PATCH 100/132] meson: convert hw/audio, Paolo Bonzini, 2019/12/19
- [PATCH 101/132] meson: convert hw/adc, Paolo Bonzini, 2019/12/19
- [PATCH 102/132] meson: convert hw/acpi, Paolo Bonzini, 2019/12/19
- [PATCH 103/132] meson: convert hw/9pfs, Paolo Bonzini, 2019/12/19
- [PATCH 104/132] meson: convert target/s390x/gen-features.h, Paolo Bonzini, 2019/12/19
- [PATCH 107/132] meson: accel, Paolo Bonzini, 2019/12/19
- [PATCH 105/132] meson: convert hw/arch*, Paolo Bonzini, 2019/12/19
- [PATCH 109/132] meson: bsd-user, Paolo Bonzini, 2019/12/19
- [PATCH 106/132] meson: target, Paolo Bonzini, 2019/12/19
- [PATCH 110/132] meson: cpu-emu,
Paolo Bonzini <=
- [PATCH 111/132] meson: softmmu, Paolo Bonzini, 2019/12/19
- [PATCH 108/132] meson: linux-user, Paolo Bonzini, 2019/12/19
- [PATCH 114/132] build-sys/rules.mak: remove version.o, Paolo Bonzini, 2019/12/19
- [PATCH 113/132] systemtap, Paolo Bonzini, 2019/12/19
- [PATCH 112/132] Aaaaallelujah!, Paolo Bonzini, 2019/12/19
- [PATCH 115/132] remove Makefile.target, Paolo Bonzini, 2019/12/19
- [PATCH 116/132] meson: sphinx-build, Paolo Bonzini, 2019/12/19
- [PATCH 117/132] meson: generate version.texi, Paolo Bonzini, 2019/12/19
- [PATCH 120/132] meson: install some scripts, Paolo Bonzini, 2019/12/19