Alex Bennée <alex.ben...@linaro.org> writes:
> Yeqi Fu <fufuyqqq...@gmail.com> writes: > >> Signed-off-by: Yeqi Fu <fufuyqqq...@gmail.com> >> --- >> Makefile | 4 +++ >> common-user/native/Makefile.include | 9 ++++++ >> common-user/native/Makefile.target | 22 +++++++++++++ >> configure | 50 +++++++++++++++++++++++++++++ >> docs/devel/build-system.rst | 4 +++ >> meson.build | 8 +++++ >> meson_options.txt | 2 ++ >> scripts/meson-buildoptions.sh | 4 +++ >> 8 files changed, 103 insertions(+) >> create mode 100644 common-user/native/Makefile.include >> create mode 100644 common-user/native/Makefile.target >> >> diff --git a/Makefile b/Makefile >> index 3c7d67142f..923da109bf 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -185,6 +185,10 @@ SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory >> --quiet) >> >> include $(SRC_PATH)/tests/Makefile.include >> >> +ifeq ($(CONFIG_USER_NATIVE),y) >> + include $(SRC_PATH)/common-user/native/Makefile.include >> +endif >> + >> all: recurse-all >> >> ROMS_RULES=$(foreach t, all clean distclean, $(addsuffix /$(t), $(ROMS))) >> diff --git a/common-user/native/Makefile.include >> b/common-user/native/Makefile.include >> new file mode 100644 >> index 0000000000..40d20bcd4c >> --- /dev/null >> +++ b/common-user/native/Makefile.include >> @@ -0,0 +1,9 @@ >> +.PHONY: build-native >> +build-native: $(NATIVE_TARGETS:%=build-native-library-%) >> +$(NATIVE_TARGETS:%=build-native-library-%): build-native-library-%: >> + $(call quiet-command, \ >> + $(MAKE) -C common-user/native/$* $(SUBDIR_MAKEFLAGS), \ >> + "BUILD","$* native library") >> +# endif >> + >> +all: build-native > > I think it would be better if we could add the targets via meson and let > it deal with the multiple versions. I will defer to Paolo on how to do > this though. OK Paolo said we won't expose cross compilers to meson so we are stuck with pure makefiles for now... however: <snip> >> + >> +(config_host_mak=common-user/native/config-host.mak >> +mkdir -p common-user/native >> +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 >> + >> +native_targets= >> +for target in $target_list; do >> + arch=${target%%-*} >> + >> + case $target in >> + *-linux-user|*-bsd-user) >> + if probe_target_compiler $target || test -n "$container_image"; then >> + mkdir -p "common-user/native/$target" >> + config_target_mak=common-user/native/$target/config-target.mak >> + ln -sf "$source_path/common-user/native/Makefile.target" >> "common-user/native/$target/Makefile" >> + echo "# Automatically generated by configure - do not modify" > >> "$config_target_mak" >> + echo "TARGET_NAME=$arch" >> "$config_target_mak" >> + echo "TARGET=$target" >> "$config_target_mak" >> + eval "target_native_flag=\${native_flag_$target_arch}" >> + target_cflags="$target_cflags $target_native_flag" >> + write_target_makefile "build-native-library-$target" >> >> "$config_target_mak" >> + native_targets="$native_targets $target" >> + fi >> + ;; >> + esac >> +done > > This is basically replicating what we already have in > tests/tcg/FOO-linux-user/config-target.mak. I would suggest moving those > into a common location ($BUILD/targets/foo/compiler.mak) and then fixing > up TCG tests to use the new location. When you add the native libs you > can use the same configs. This should be merged with the existing config_target code. -- Alex Bennée Virtualisation Tech Lead @ Linaro