diff mbox series

[4/7] configure: move tests/tcg/Makefile.prereqs to root build directory

Message ID 20220607094031.1227714-5-pbonzini@redhat.com
State New
Headers show
Series More tests/tcg cleanups | expand

Commit Message

Paolo Bonzini June 7, 2022, 9:40 a.m. UTC
It will not be specific to tests/tcg anymore once it will be possible to
build firmware using container-based cross compilers too.  Prepare for that
already, after all Makefile.prereqs is not _used_ by tests/tcg.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 Makefile               |  5 ++++-
 configure              | 15 +++++++--------
 tests/Makefile.include |  3 ---
 3 files changed, 11 insertions(+), 12 deletions(-)
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index ec4445db9a..9fc750ee70 100644
--- a/Makefile
+++ b/Makefile
@@ -42,6 +42,9 @@  configure: ;
 ifneq ($(wildcard config-host.mak),)
 include config-host.mak
 
+include Makefile.prereqs
+Makefile.prereqs: config-host.mak
+
 git-submodule-update:
 .git-submodule-status: git-submodule-update config-host.mak
 Makefile: .git-submodule-status
@@ -216,7 +219,7 @@  qemu-%.tar.bz2:
 
 distclean: clean
 	-$(quiet-@)test -f build.ninja && $(NINJA) $(NINJAFLAGS) -t clean -g || :
-	rm -f config-host.mak
+	rm -f config-host.mak Makefile.prereqs
 	rm -f tests/tcg/config-*.mak
 	rm -f config.status
 	rm -f roms/seabios/config.mak
diff --git a/configure b/configure
index 28f8c6188b..6b38b0815c 100755
--- a/configure
+++ b/configure
@@ -2126,6 +2126,7 @@  write_target_makefile() {
 }
 
 write_container_target_makefile() {
+  echo "$1: docker-image-$container_image" >> Makefile.prereqs
   if test -n "$container_cross_cc"; then
     echo "CC=\$(DOCKER_SCRIPT) cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --"
     echo "CCAS=\$(DOCKER_SCRIPT) cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --"
@@ -2234,6 +2235,8 @@  for f in $LINKS ; do
     fi
 done
 
+echo "# Automatically generated by configure - do not modify" > Makefile.prereqs
+
 # Mac OS X ships with a broken assembler
 roms=
 probe_target_compilers i386 x86_64
@@ -2471,10 +2474,7 @@  if test "$safe_stack" = "yes"; then
 fi
 
 # tests/tcg configuration
-(makefile=tests/tcg/Makefile.prereqs
-echo "# Automatically generated by configure - do not modify" > $makefile
-
-config_host_mak=tests/tcg/config-host.mak
+(config_host_mak=tests/tcg/config-host.mak
 echo "# Automatically generated by configure - do not modify" > $config_host_mak
 echo "SRC_PATH=$source_path" >> $config_host_mak
 echo "HOST_CC=$host_cc" >> $config_host_mak
@@ -2570,9 +2570,8 @@  for target in $target_list; do
               ;;
       esac
   elif test -n "$container_image"; then
-      echo "build-tcg-tests-$target: docker-image-$container_image" >> $makefile
       echo "BUILD_STATIC=y" >> $config_target_mak
-      write_container_target_makefile >> $config_target_mak
+      write_container_target_makefile build-tcg-tests-$target >> $config_target_mak
       case $target in
           aarch64-*)
               echo "CROSS_CC_HAS_SVE=y" >> $config_target_mak
@@ -2595,11 +2594,11 @@  for target in $target_list; do
       mkdir -p tests/tcg/$target
       echo "QEMU=$PWD/$qemu" >> $config_target_mak
       echo "EXTRA_CFLAGS=$target_cflags" >> $config_target_mak
-      echo "run-tcg-tests-$target: $qemu\$(EXESUF)" >> $makefile
+      echo "run-tcg-tests-$target: $qemu\$(EXESUF)" >> Makefile.prereqs
       tcg_tests_targets="$tcg_tests_targets $target"
   fi
 done
-echo "TCG_TESTS_TARGETS=$tcg_tests_targets" >> $makefile)
+echo "TCG_TESTS_TARGETS=$tcg_tests_targets" >> config-host.mak)
 
 if test "$skip_meson" = no; then
   cross="config-meson.cross.new"
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 3accb83b13..f4ba4027ea 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -36,9 +36,6 @@  export SRC_PATH
 
 SPEED = quick
 
--include tests/tcg/Makefile.prereqs
-tests/tcg/Makefile.prereqs: config-host.mak
-
 # Per guest TCG tests
 BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TCG_TESTS_TARGETS))
 CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(TCG_TESTS_TARGETS))