build c2str.exe with the host compiler; default it to gcc if cross prefix given

This commit is contained in:
Urja Rannikko
2026-01-17 20:47:00 +02:00
parent b39cbc70c4
commit 41fa74fc84
2 changed files with 5 additions and 2 deletions

View File

@@ -256,7 +256,7 @@ endif
$S./c2str.exe $< $@ $S./c2str.exe $< $@
c2str.exe : conftest.c c2str.exe : conftest.c
$S$(CC) -DC2STR $< -o $@ $S$(HOST_CC) -DC2STR $< -o $@
# target specific object rule # target specific object rule
$(X)%.o : %.c $(LIBTCC_INC) $(X)%.o : %.c $(LIBTCC_INC)

5
configure vendored
View File

@@ -58,6 +58,8 @@ build_cross=
test -n "$CC" && cc="$CC" test -n "$CC" && cc="$CC"
test -n "$AR" && ar="$AR" test -n "$AR" && ar="$AR"
host_cc="$CC"
# set default CFLAGS if unset in environment # set default CFLAGS if unset in environment
test -z "$CFLAGS" && CFLAGS="-Wall -O2" test -z "$CFLAGS" && CFLAGS="-Wall -O2"
@@ -122,7 +124,7 @@ for opt do
;; ;;
--source-path=*) assign_opt "$opt" source_path --source-path=*) assign_opt "$opt" source_path
;; ;;
--cross-prefix=*) assign_opt "$opt" cross_prefix --cross-prefix=*) assign_opt "$opt" cross_prefix; assign_opt "gcc" host_cc
;; ;;
--os-release=*) assign_opt "$opt" os_release --os-release=*) assign_opt "$opt" os_release
;; ;;
@@ -584,6 +586,7 @@ mandir=\$(DESTDIR)$mandir
infodir=\$(DESTDIR)$infodir infodir=\$(DESTDIR)$infodir
docdir=\$(DESTDIR)$docdir docdir=\$(DESTDIR)$docdir
CC=$cc CC=$cc
HOST_CC=$host_cc
CC_NAME=$cc_name CC_NAME=$cc_name
GCC_MAJOR=$gcc_major GCC_MAJOR=$gcc_major
GCC_MINOR=$gcc_minor GCC_MINOR=$gcc_minor