Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move 'libformat_parser' build into the GCC build directory, and into libgrust #2947

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,3 @@ test.code-workspace

gcc/rust/test3-tiny/*
.clang-format.swap
libgrust/*/target/
1 change: 1 addition & 0 deletions contrib/gcc_update
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ libgomp/config.h.in: libgomp/configure.ac libgomp/aclocal.m4
libgrust/Makefile.in: libgrust/Makefile.am libgrust/aclocal.m4
libgrust/aclocal.m4: libgrust/configure.ac
libgrust/configure: libgrust/configure.ac libgrust/aclocal.m4
libgrust/libformat_parser/Makefile.in: libgrust/libformat_parser/Makefile.am libgrust/aclocal.m4
libgrust/libproc_macro_internal/Makefile.in: libgrust/libproc_macro_internal/Makefile.am libgrust/aclocal.m4
libitm/aclocal.m4: libitm/configure.ac libitm/acinclude.m4
libitm/Makefile.in: libitm/Makefile.am libitm/aclocal.m4
Expand Down
18 changes: 5 additions & 13 deletions gcc/rust/Make-lang.in
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,14 @@ RUST_ALL_OBJS = $(GRS_OBJS) $(RUST_TARGET_OBJS)

rust_OBJS = $(RUST_ALL_OBJS) rust/rustspec.o

RUST_LDFLAGS = $(LDFLAGS) -L./../libgrust/libproc_macro_internal -L./../libgrust/librustc_format_parser/
RUST_LIBDEPS = $(LIBDEPS) ../libgrust/libproc_macro_internal/libproc_macro_internal.a rust/libformat_parser.a
LIBPROC_MACRO_INTERNAL = ../libgrust/libproc_macro_internal/libproc_macro_internal.a
LIBFORMAT_PARSER = ../libgrust/libformat_parser/debug/liblibformat_parser.a

# The compiler itself is called crab1
crab1$(exeext): $(RUST_ALL_OBJS) attribs.o $(BACKEND) $(RUST_LIBDEPS) $(rust.prev)
crab1$(exeext): $(RUST_ALL_OBJS) attribs.o $(BACKEND) $(LIBDEPS) $(LIBPROC_MACRO_INTERNAL) $(LIBFORMAT_PARSER) $(rust.prev)
@$(call LINK_PROGRESS,$(INDEX.rust),start)
+$(LLINKER) $(ALL_LINKERFLAGS) $(RUST_LDFLAGS) -o $@ \
$(RUST_ALL_OBJS) attribs.o $(BACKEND) $(LIBS) ../libgrust/libproc_macro_internal/libproc_macro_internal.a rust/libformat_parser.a $(BACKENDLIBS)
+$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
$(RUST_ALL_OBJS) attribs.o $(BACKEND) $(LIBS) $(LIBPROC_MACRO_INTERNAL) $(LIBFORMAT_PARSER) $(BACKENDLIBS)
@$(call LINK_PROGRESS,$(INDEX.rust),end)

# Build hooks.
Expand Down Expand Up @@ -418,14 +418,6 @@ rust/%.o: rust/lex/%.cc
$(COMPILE) $(RUST_CXXFLAGS) $(RUST_INCLUDES) $<
$(POSTCOMPILE)

%.toml:
echo $@

# TODO: Improve `cargo` invocation with host specific flags, possibly creating a $(CARGO) variable?
rust/libformat_parser.a: $(srcdir)/../libgrust/libformat_parser/Cargo.toml $(wildcard $(srcdir)/../libgrust/libformat_parser/src/*.rs)
cd $(srcdir)/../libgrust/libformat_parser && cargo build --offline # FIXME: Not always release, right?
cp $(srcdir)/../libgrust/libformat_parser/target/debug/liblibformat_parser.a $@

# build all rust/parse files in rust folder, add cross-folder includes
rust/%.o: rust/parse/%.cc
$(COMPILE) $(RUST_CXXFLAGS) $(RUST_INCLUDES) $<
Expand Down
6 changes: 5 additions & 1 deletion libgrust/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ TOP_GCCDIR := $(shell cd $(top_srcdir) && cd .. && pwd)
GCC_DIR = $(TOP_GCCDIR)/gcc
RUST_SRC = $(GCC_DIR)/rust

SUBDIRS = libproc_macro_internal
SUBDIRS =
if !TARGET_LIBRARY
SUBDIRS += libformat_parser
endif
SUBDIRS += libproc_macro_internal

RUST_BUILDDIR := $(shell pwd)

Expand Down
5 changes: 3 additions & 2 deletions libgrust/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
@TARGET_LIBRARY_FALSE@am__append_1 = libformat_parser
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
Expand Down Expand Up @@ -165,7 +166,7 @@ am__define_uniq_tagged_files = \
ETAGS = etags
CTAGS = ctags
CSCOPE = cscope
DIST_SUBDIRS = $(SUBDIRS)
DIST_SUBDIRS = libformat_parser libproc_macro_internal
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
Expand Down Expand Up @@ -308,7 +309,7 @@ AM_CFLAGS = -I $(srcdir)/../libgcc -I $(MULTIBUILDTOP)../../gcc/include
TOP_GCCDIR := $(shell cd $(top_srcdir) && cd .. && pwd)
GCC_DIR = $(TOP_GCCDIR)/gcc
RUST_SRC = $(GCC_DIR)/rust
SUBDIRS = libproc_macro_internal
SUBDIRS = $(am__append_1) libproc_macro_internal
RUST_BUILDDIR := $(shell pwd)

# Work around what appears to be a GNU make bug handling MAKEFLAGS
Expand Down
22 changes: 20 additions & 2 deletions libgrust/configure
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,8 @@ am__EXEEXT_TRUE
LTLIBOBJS
LIBOBJS
get_gcc_base_ver
TARGET_LIBRARY_FALSE
TARGET_LIBRARY_TRUE
toolexeclibdir
toolexecdir
target_subdir
Expand Down Expand Up @@ -12655,7 +12657,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 12658 "configure"
#line 12660 "configure"
#include "confdefs.h"

#if HAVE_DLFCN_H
Expand Down Expand Up @@ -12761,7 +12763,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 12764 "configure"
#line 12766 "configure"
#include "confdefs.h"

#if HAVE_DLFCN_H
Expand Down Expand Up @@ -16192,6 +16194,17 @@ esac



if test -n "$with_target_subdir"; then
TARGET_LIBRARY_TRUE=
TARGET_LIBRARY_FALSE='#'
else
TARGET_LIBRARY_TRUE='#'
TARGET_LIBRARY_FALSE=
fi


ac_config_files="$ac_config_files libformat_parser/Makefile"


ac_config_files="$ac_config_files libproc_macro_internal/Makefile"

Expand Down Expand Up @@ -16398,6 +16411,10 @@ if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${TARGET_LIBRARY_TRUE}" && test -z "${TARGET_LIBRARY_FALSE}"; then
as_fn_error $? "conditional \"TARGET_LIBRARY\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi

: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
Expand Down Expand Up @@ -17348,6 +17365,7 @@ do
"default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
"depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
"libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
"libformat_parser/Makefile") CONFIG_FILES="$CONFIG_FILES libformat_parser/Makefile" ;;
"libproc_macro_internal/Makefile") CONFIG_FILES="$CONFIG_FILES libproc_macro_internal/Makefile" ;;

*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
Expand Down
3 changes: 3 additions & 0 deletions libgrust/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ esac
AC_SUBST(toolexecdir)
AC_SUBST(toolexeclibdir)

AM_CONDITIONAL(TARGET_LIBRARY, test -n "$with_target_subdir")

AC_CONFIG_FILES([libformat_parser/Makefile])

AC_CONFIG_FILES(AC_FOREACH([DIR], [libproc_macro_internal], [DIR/Makefile ]),
[ cat > vpsed$$ << \_EOF
Expand Down
13 changes: 13 additions & 0 deletions libgrust/libformat_parser/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
LIBFORMAT_PARSER = debug/liblibformat_parser.a

all-local: $(LIBFORMAT_PARSER)

# TODO: Improve `cargo` invocation with host specific flags, possibly creating a $(CARGO) variable?
$(LIBFORMAT_PARSER): $(srcdir)/Cargo.toml $(srcdir)/src/*.rs
cargo \
--config $(srcdir)/.cargo/config \
build \
--offline \
--target-dir . \
--manifest-path $(srcdir)/Cargo.toml \
# FIXME: Not always '--release', right?
Loading
Loading