| 1 |
# Make-lang.in -- Top level -*- makefile -*- fragment for GCC Rust frontend. |
| 2 |
|
| 3 |
# Copyright (C) 2009-2025 Free Software Foundation, Inc. |
| 4 |
|
| 5 |
# This file is part of GCC. |
| 6 |
|
| 7 |
# GCC is free software; you can redistribute it and/or modify |
| 8 |
# it under the terms of the GNU General Public License as published by |
| 9 |
# the Free Software Foundation; either version 3, or (at your option) |
| 10 |
# any later version. |
| 11 |
|
| 12 |
# GCC is distributed in the hope that it will be useful, |
| 13 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
# GNU General Public License for more details. |
| 16 |
|
| 17 |
# You should have received a copy of the GNU General Public License |
| 18 |
# along with GCC; see the file COPYING3. If not see |
| 19 |
# <http://www.gnu.org/licenses/>. |
| 20 |
|
| 21 |
# This file provides the language dependent support in the main Makefile. |
| 22 |
|
| 23 |
#RUST_EXES = rust |
| 24 |
|
| 25 |
# Use strict warnings for this front end. |
| 26 |
rust-warn = $(STRICT_WARN) |
| 27 |
# ..., with the exception of '-Wunused-parameter'; waiting for |
| 28 |
# <https://github.com/Rust-GCC/gccrs/issues/1626> "bootstrap build failure". |
| 29 |
rust-warn += -Wno-unused-parameter |
| 30 |
|
| 31 |
# Installation name. Useful for cross compilers and used during install. |
| 32 |
GCCRS_INSTALL_NAME := $(shell echo gccrs|sed '$(program_transform_name)') |
| 33 |
GCCRS_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gccrs|sed '$(program_transform_name)') |
| 34 |
|
| 35 |
# Define the names for selecting rust in LANGUAGES. |
| 36 |
rust: crab1$(exeext) |
| 37 |
|
| 38 |
rust.serial = crab1$(exeext) |
| 39 |
|
| 40 |
# Tell GNU make to ignore files by these names if they exist. |
| 41 |
.PHONY: rust |
| 42 |
|
| 43 |
# removed GRS_CFLAGS from here |
| 44 |
|
| 45 |
CFLAGS-rust/rustspec.o += $(DRIVER_DEFINES) |
| 46 |
|
| 47 |
# Create the compiler driver gccrs. |
| 48 |
# A compiler driver is the program that interprets command argument and can be called from the command |
| 49 |
# line - e.g. gcc or g++, and not cc1, which is the actual compiler |
| 50 |
|
| 51 |
# Create driver objects |
| 52 |
GCCRS_D_OBJS = \ |
| 53 |
$(GCC_OBJS) \ |
| 54 |
rust/rustspec.o \ |
| 55 |
$(END) |
| 56 |
|
| 57 |
gccrs$(exeext): $(GCCRS_D_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBDEPS) |
| 58 |
+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ |
| 59 |
$(GCCRS_D_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \ |
| 60 |
$(EXTRA_GCC_LIBS) $(LIBS) |
| 61 |
|
| 62 |
# List of host object files used by the rust language - files for translation from the parse tree |
| 63 |
# to GENERIC |
| 64 |
# The compiler proper, not driver |
| 65 |
GRS_OBJS = \ |
| 66 |
rust/rust-lang.o \ |
| 67 |
rust/rust-attribs.o \ |
| 68 |
rust/rust-object-export.o \ |
| 69 |
rust/rust-linemap.o \ |
| 70 |
rust/rust-diagnostics.o \ |
| 71 |
rust/rust-gcc.o \ |
| 72 |
rust/rust-token.o \ |
| 73 |
rust/rust-lex.o \ |
| 74 |
rust/rust-cfg-parser.o \ |
| 75 |
rust/rust-parse.o \ |
| 76 |
rust/rust-ast.o \ |
| 77 |
rust/rust-ast-formatting.o \ |
| 78 |
rust/rust-path.o \ |
| 79 |
rust/rust-pattern.o \ |
| 80 |
rust/rust-ast-fragment.o \ |
| 81 |
rust/rust-ast-dump.o \ |
| 82 |
rust/rust-ast-collector.o \ |
| 83 |
rust/rust-ast-visitor.o \ |
| 84 |
rust/rust-hir-dump.o \ |
| 85 |
rust/rust-session-manager.o \ |
| 86 |
rust/rust-compile.o \ |
| 87 |
rust/rust-mangle.o \ |
| 88 |
rust/rust-mangle-v0.o \ |
| 89 |
rust/rust-mangle-legacy.o \ |
| 90 |
rust/rust-compile-resolve-path.o \ |
| 91 |
rust/rust-macro-expand.o \ |
| 92 |
rust/rust-cfg-strip.o \ |
| 93 |
rust/rust-expand-visitor.o \ |
| 94 |
rust/rust-ast-builder.o \ |
| 95 |
rust/rust-ast-builder-type.o \ |
| 96 |
rust/rust-derive.o \ |
| 97 |
rust/rust-derive-clone.o \ |
| 98 |
rust/rust-derive-copy.o \ |
| 99 |
rust/rust-derive-debug.o \ |
| 100 |
rust/rust-derive-default.o \ |
| 101 |
rust/rust-derive-partial-eq.o \ |
| 102 |
rust/rust-derive-eq.o \ |
| 103 |
rust/rust-derive-hash.o \ |
| 104 |
rust/rust-proc-macro.o \ |
| 105 |
rust/rust-macro-invoc-lexer.o \ |
| 106 |
rust/rust-proc-macro-invoc-lexer.o \ |
| 107 |
rust/rust-macro-substitute-ctx.o \ |
| 108 |
rust/rust-macro-builtins.o \ |
| 109 |
rust/rust-macro-builtins-helpers.o \ |
| 110 |
rust/rust-macro-builtins-asm.o \ |
| 111 |
rust/rust-macro-builtins-trait.o \ |
| 112 |
rust/rust-macro-builtins-utility.o \ |
| 113 |
rust/rust-macro-builtins-log-debug.o \ |
| 114 |
rust/rust-macro-builtins-test-bench.o \ |
| 115 |
rust/rust-macro-builtins-format-args.o \ |
| 116 |
rust/rust-macro-builtins-location.o \ |
| 117 |
rust/rust-macro-builtins-include.o \ |
| 118 |
rust/rust-token-tree-desugar.o \ |
| 119 |
rust/rust-fmt.o \ |
| 120 |
rust/rust-hir.o \ |
| 121 |
rust/rust-hir-map.o \ |
| 122 |
rust/rust-attributes.o \ |
| 123 |
rust/rust-keyword-values.o \ |
| 124 |
rust/rust-abi.o \ |
| 125 |
rust/rust-token-converter.o \ |
| 126 |
rust/rust-macro.o \ |
| 127 |
rust/rust-ast-lower.o \ |
| 128 |
rust/rust-ast-lower-base.o \ |
| 129 |
rust/rust-ast-lower-pattern.o \ |
| 130 |
rust/rust-ast-lower-item.o \ |
| 131 |
rust/rust-ast-lower-implitem.o \ |
| 132 |
rust/rust-ast-lower-expr.o \ |
| 133 |
rust/rust-ast-lower-type.o \ |
| 134 |
rust/rust-ast-lower-stmt.o \ |
| 135 |
rust/rust-ast-lower-format-args.o \ |
| 136 |
rust/rust-rib.o \ |
| 137 |
rust/rust-name-resolution-context.o \ |
| 138 |
rust/rust-default-resolver.o \ |
| 139 |
rust/rust-toplevel-name-resolver-2.0.o \ |
| 140 |
rust/rust-early-name-resolver-2.0.o \ |
| 141 |
rust/rust-finalize-imports-2.0.o \ |
| 142 |
rust/rust-ice-finalizer.o \ |
| 143 |
rust/rust-late-name-resolver-2.0.o \ |
| 144 |
rust/rust-immutable-name-resolution-context.o \ |
| 145 |
rust/rust-early-name-resolver.o \ |
| 146 |
rust/rust-name-resolver.o \ |
| 147 |
rust/rust-ast-resolve.o \ |
| 148 |
rust/rust-ast-resolve-base.o \ |
| 149 |
rust/rust-ast-resolve-item.o \ |
| 150 |
rust/rust-ast-resolve-pattern.o \ |
| 151 |
rust/rust-ast-resolve-expr.o \ |
| 152 |
rust/rust-ast-resolve-type.o \ |
| 153 |
rust/rust-ast-resolve-path.o \ |
| 154 |
rust/rust-ast-resolve-stmt.o \ |
| 155 |
rust/rust-ast-resolve-struct-expr-field.o \ |
| 156 |
rust/rust-forever-stack.o \ |
| 157 |
rust/rust-hir-type-check.o \ |
| 158 |
rust/rust-privacy-check.o \ |
| 159 |
rust/rust-privacy-ctx.o \ |
| 160 |
rust/rust-reachability.o \ |
| 161 |
rust/rust-visibility-resolver.o \ |
| 162 |
rust/rust-pub-restricted-visitor.o \ |
| 163 |
rust/rust-privacy-reporter.o \ |
| 164 |
rust/rust-tyty.o \ |
| 165 |
rust/rust-tyty-util.o \ |
| 166 |
rust/rust-tyty-call.o \ |
| 167 |
rust/rust-tyty-subst.o \ |
| 168 |
rust/rust-tyty-variance-analysis.o \ |
| 169 |
rust/rust-typecheck-context.o \ |
| 170 |
rust/rust-tyty-bounds.o \ |
| 171 |
rust/rust-hir-trait-resolve.o \ |
| 172 |
rust/rust-hir-trait-reference.o \ |
| 173 |
rust/rust-hir-type-check-item.o \ |
| 174 |
rust/rust-hir-type-check-type.o \ |
| 175 |
rust/rust-hir-type-check-struct.o \ |
| 176 |
rust/rust-hir-type-check-pattern.o \ |
| 177 |
rust/rust-hir-type-check-expr.o \ |
| 178 |
rust/rust-hir-type-check-stmt.o \ |
| 179 |
rust/rust-hir-type-check-enumitem.o \ |
| 180 |
rust/rust-hir-type-check-implitem.o \ |
| 181 |
rust/rust-borrow-checker.o \ |
| 182 |
rust/rust-borrow-checker-diagnostics.o\ |
| 183 |
rust/rust-bir-builder-expr-stmt.o \ |
| 184 |
rust/rust-bir-builder-pattern.o \ |
| 185 |
rust/rust-bir-dump.o \ |
| 186 |
rust/rust-polonius.o\ |
| 187 |
rust/rust-hir-dot-operator.o \ |
| 188 |
rust/rust-hir-path-probe.o \ |
| 189 |
rust/rust-hir-path.o \ |
| 190 |
rust/rust-hir-type.o \ |
| 191 |
rust/rust-hir-expr.o \ |
| 192 |
rust/rust-hir-type-abstract.o \ |
| 193 |
rust/rust-hir-item.o \ |
| 194 |
rust/rust-hir-stmt.o \ |
| 195 |
rust/rust-hir-generic-param.o \ |
| 196 |
rust/rust-type-util.o \ |
| 197 |
rust/rust-coercion.o \ |
| 198 |
rust/rust-casts.o \ |
| 199 |
rust/rust-unify.o \ |
| 200 |
rust/rust-hir-type-check-base.o \ |
| 201 |
rust/rust-autoderef.o \ |
| 202 |
rust/rust-substitution-mapper.o \ |
| 203 |
rust/rust-const-checker.o \ |
| 204 |
rust/rust-lint-marklive.o \ |
| 205 |
rust/rust-lint-unused-var.o \ |
| 206 |
rust/rust-readonly-check.o \ |
| 207 |
rust/rust-hir-type-check-path.o \ |
| 208 |
rust/rust-unsafe-checker.o \ |
| 209 |
rust/rust-hir-pattern-analysis.o \ |
| 210 |
rust/rust-compile-intrinsic.o \ |
| 211 |
rust/rust-compile-pattern.o \ |
| 212 |
rust/rust-compile-fnparam.o \ |
| 213 |
rust/rust-compile-proc-macro.o \ |
| 214 |
rust/rust-base62.o \ |
| 215 |
rust/rust-compile-item.o \ |
| 216 |
rust/rust-compile-implitem.o \ |
| 217 |
rust/rust-compile-stmt.o \ |
| 218 |
rust/rust-compile-asm.o \ |
| 219 |
rust/rust-compile-expr.o \ |
| 220 |
rust/rust-compile-type.o \ |
| 221 |
rust/rust-compile-block.o \ |
| 222 |
rust/rust-compile-struct-field-expr.o \ |
| 223 |
rust/rust-constexpr.o \ |
| 224 |
rust/rust-compile-base.o \ |
| 225 |
rust/rust-tree.o \ |
| 226 |
rust/rust-compile-context.o \ |
| 227 |
rust/rust-export-metadata.o \ |
| 228 |
rust/rust-imports.o \ |
| 229 |
rust/rust-import-archive.o \ |
| 230 |
rust/rust-extern-crate.o \ |
| 231 |
rust/rust-builtins.o \ |
| 232 |
rust/rust-feature.o \ |
| 233 |
rust/rust-feature-gate.o \ |
| 234 |
rust/rust-ast-validation.o \ |
| 235 |
rust/rust-dir-owner.o \ |
| 236 |
rust/rust-unicode.o \ |
| 237 |
rust/rust-punycode.o \ |
| 238 |
rust/rust-unwrap-segment.o \ |
| 239 |
rust/rust-edition.o \ |
| 240 |
rust/rust-expand-format-args.o \ |
| 241 |
rust/rust-lang-item.o \ |
| 242 |
rust/rust-collect-lang-items.o \ |
| 243 |
rust/rust-desugar-for-loops.o \ |
| 244 |
rust/rust-desugar-question-mark.o \ |
| 245 |
$(END) |
| 246 |
# removed object files from here |
| 247 |
|
| 248 |
# All language-specific object files for Rust. |
| 249 |
RUST_ALL_OBJS = $(GRS_OBJS) $(RUST_TARGET_OBJS) |
| 250 |
|
| 251 |
rust_OBJS = $(RUST_ALL_OBJS) rust/rustspec.o |
| 252 |
|
| 253 |
LIBPROC_MACRO_INTERNAL = ../libgrust/libproc_macro_internal/libproc_macro_internal.a |
| 254 |
LIBFORMAT_PARSER = ../libgrust/libformat_parser/debug/liblibformat_parser.a |
| 255 |
LIBFFI_POLONIUS = rust/libffi_polonius.a |
| 256 |
|
| 257 |
# The compiler itself is called crab1 |
| 258 |
crab1$(exeext): $(RUST_ALL_OBJS) attribs.o $(BACKEND) $(LIBDEPS) $(LIBPROC_MACRO_INTERNAL) $(LIBFORMAT_PARSER) $(LIBFFI_POLONIUS) $(rust.prev) |
| 259 |
@$(call LINK_PROGRESS,$(INDEX.rust),start) |
| 260 |
+$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ |
| 261 |
$(RUST_ALL_OBJS) attribs.o $(BACKEND) \ |
| 262 |
$(LIBS) $(CRAB1_LIBS) $(LIBPROC_MACRO_INTERNAL) $(LIBFORMAT_PARSER) $(LIBFFI_POLONIUS) \ |
| 263 |
$(BACKENDLIBS) |
| 264 |
@$(call LINK_PROGRESS,$(INDEX.rust),end) |
| 265 |
|
| 266 |
# Build hooks. |
| 267 |
|
| 268 |
lang_checks += check-rust |
| 269 |
lang_checks_parallelized += check-rust |
| 270 |
check_rust_parallelize = 10 |
| 271 |
|
| 272 |
# Copies its dependencies into the source directory. This generally should be used for generated files |
| 273 |
# such as Bison output files which are not version-controlled, but should be included in any release |
| 274 |
# tarballs. This target will be executed during a bootstrap if ‘--enable-generated-files-in-srcdir’ |
| 275 |
# was specified as a configure option. |
| 276 |
rust.srcextra: |
| 277 |
|
| 278 |
rust.all.cross: gccrs$(exeext) |
| 279 |
|
| 280 |
# idk what this does but someone used it |
| 281 |
rust.start.encap: gccrs$(exeext) |
| 282 |
rust.rest.encap: |
| 283 |
|
| 284 |
# Build generated man pages for the front end from Texinfo manuals (see Man Page Generation), in the |
| 285 |
# build directory. This target is only called if the necessary tools are available, but should ignore |
| 286 |
# errors so as not to stop the build if errors occur; man pages are optional and the tools involved |
| 287 |
# may be installed in a broken way. |
| 288 |
rust.man: |
| 289 |
|
| 290 |
# Copies its dependencies into the source directory. These targets will be executed during a bootstrap |
| 291 |
# if ‘--enable-generated-files-in-srcdir’ was specified as a configure option. |
| 292 |
rust.srcman: |
| 293 |
|
| 294 |
# Clean hooks. |
| 295 |
|
| 296 |
rust.mostlyclean: |
| 297 |
rm -rf rust/ffi-polonius/release libffi_polonius.a |
| 298 |
# cd $(srcdir)/rust; rm -f *.o y.tab.h y.tab.c lex.yy.c |
| 299 |
|
| 300 |
rust.clean: rust.mostlyclean |
| 301 |
|
| 302 |
# Builds an etags TAGS file in the language subdirectory in the source tree. |
| 303 |
# TODO: add more directories if I add more |
| 304 |
rust.tags: force |
| 305 |
cd $(srcdir)/rust; \ |
| 306 |
etags -o TAGS.sub *.y *.l *.cc *.h ast/*.h ast/*.cc lex/*.h lex/*.cc parse/*.h parse/*.cc; \ |
| 307 |
etags --include TAGS.sub --include ../TAGS.sub |
| 308 |
|
| 309 |
# Build documentation hooks. |
| 310 |
|
| 311 |
# Build info documentation for the front end, in the build directory. This target is only called by |
| 312 |
# ‘make bootstrap’ if a suitable version of makeinfo is available, so does not need to check for this, |
| 313 |
# and should fail if an error occurs. |
| 314 |
rust.info: |
| 315 |
|
| 316 |
rust.srcinfo: |
| 317 |
|
| 318 |
# Build DVI documentation for the front end, in the build directory. This should be done using |
| 319 |
# $(TEXI2DVI), with appropriate -I arguments pointing to directories of included files. |
| 320 |
rust.dvi: |
| 321 |
|
| 322 |
# Build PDF documentation for the front end, in the build directory. This should be done using |
| 323 |
# $(TEXI2PDF), with appropriate -I arguments pointing to directories of included files. |
| 324 |
rust.pdf: |
| 325 |
|
| 326 |
doc/rust.info: |
| 327 |
doc/rust.dvi: |
| 328 |
doc/rust.pdf: |
| 329 |
|
| 330 |
# Build HTML documentation for the front end, in the build directory. |
| 331 |
rust.html: |
| 332 |
|
| 333 |
# Install hooks. |
| 334 |
|
| 335 |
# Install everything that is part of the front end, apart from the compiler executables listed in |
| 336 |
# compilers in config-lang.in. |
| 337 |
rust.install-common: installdirs |
| 338 |
# -rm -f $(DESTDIR)$(bindir)/$(GCCRS_INSTALL_NAME)$(exeext) |
| 339 |
# -rm -f $(DESTDIR)$(bindir)/$(GCCRS_TARGET_INSTALL_NAME)$(exeext) |
| 340 |
# $(INSTALL_PROGRAM) gccrs$(exeext) $(DESTDIR)$(bindir)/$(GCCRS_INSTALL_NAME)$(exeext) |
| 341 |
# if test -f $(DESTDIR)$(bindir)$(GCCRS_TARGET_INSTALL_NAME)$(exeext); then \ |
| 342 |
# :; \ |
| 343 |
# else \ |
| 344 |
# cd $(DESTDIR)$(bindir) && \ |
| 345 |
# $(LN) $(GCCRS_INSTALL_NAME)$(exeext) $(GCCRS_TARGET_INSTALL_NAME)$(exeext); \ |
| 346 |
# fi |
| 347 |
-rm -f $(DESTDIR)$(bindir)/$(GCCRS_INSTALL_NAME)$(exeext) |
| 348 |
$(INSTALL_PROGRAM) gccrs$(exeext) $(DESTDIR)$(bindir)/$(GCCRS_INSTALL_NAME)$(exeext) |
| 349 |
rm -f $(DESTDIR)$(bindir)/$(GCCRS_TARGET_INSTALL_NAME)$(exeext); \ |
| 350 |
( cd $(DESTDIR)$(bindir) && \ |
| 351 |
$(LN) $(GCCRS_INSTALL_NAME)$(exeext) $(GCCRS_TARGET_INSTALL_NAME)$(exeext) ); \ |
| 352 |
|
| 353 |
# Install headers needed for plugins. |
| 354 |
rust.install-plugin: |
| 355 |
|
| 356 |
# Uninstall files installed by installing the compiler. This is currently documented not to be |
| 357 |
# supported, so the hook need not do anything. |
| 358 |
rust.uninstall: |
| 359 |
# -rm -rf $(DESTDIR)/$(bindir)/$(GCCRS_INSTALL_NAME)$(exeext) |
| 360 |
-rm -f gccrs$(exeext) grs1$(exeext) |
| 361 |
-rm -f $(RUST_ALL_OBJS) |
| 362 |
# ^those two are a maybe |
| 363 |
|
| 364 |
# Enable selftests for the rust frontend |
| 365 |
selftest-rust: s-selftest-rust |
| 366 |
|
| 367 |
RUST_SELFTEST_FLAGS = -xrust -frust-incomplete-and-experimental-compiler-do-not-use $(SELFTEST_FLAGS) |
| 368 |
RUST_SELFTEST_DEPS = crab1$(exeext) $(SELFTEST_DEPS) |
| 369 |
|
| 370 |
# Run the rust selftests |
| 371 |
s-selftest-rust: $(RUST_SELFTEST_DEPS) |
| 372 |
$(GCC_FOR_SELFTESTS) $(RUST_SELFTEST_FLAGS) |
| 373 |
$(STAMP) $@ |
| 374 |
|
| 375 |
# Convenience methods for running rust selftests under gdb: |
| 376 |
.PHONY: selftest-rust-gdb |
| 377 |
selftest-rust-gdb: $(RUST_SELFTEST_DEPS) |
| 378 |
$(GCC_FOR_SELFTESTS) $(RUST_SELFTEST_FLAGS) \ |
| 379 |
-wrapper gdb,--args |
| 380 |
|
| 381 |
# Convenience methods for running rust selftests under valgrind: |
| 382 |
.PHONY: selftest-rust-valgrind |
| 383 |
selftest-rust-valgrind: $(RUST_SELFTEST_DEPS) |
| 384 |
$(GCC_FOR_SELFTESTS) $(RUST_SELFTEST_FLAGS) \ |
| 385 |
-wrapper valgrind,--leak-check=full |
| 386 |
|
| 387 |
# Install info documentation for the front end, if it is present in the source directory. This target |
| 388 |
# should have dependencies on info files that should be installed. |
| 389 |
rust.install-info: |
| 390 |
|
| 391 |
rust.install-dvi: |
| 392 |
rust.install-html: |
| 393 |
rust.install-pdf: |
| 394 |
|
| 395 |
# Install man pages for the front end. This target should ignore errors. |
| 396 |
rust.install-man: |
| 397 |
|
| 398 |
# Stage hooks: |
| 399 |
# The toplevel makefile has already created stage?/rust at this point. |
| 400 |
# Used for handling bootstrap |
| 401 |
|
| 402 |
rust.stage1: stage1-start |
| 403 |
-mv rust/*$(objext) stage1/rust |
| 404 |
rust.stage2: stage2-start |
| 405 |
-mv rust/*$(objext) stage2/rust |
| 406 |
rust.stage3: stage3-start |
| 407 |
-mv rust/*$(objext) stage3/rust |
| 408 |
rust.stage4: stage4-start |
| 409 |
-mv rust/*$(objext) stage4/rust |
| 410 |
rust.stageprofile: stageprofile-start |
| 411 |
-mv rust/*$(objext) stageprofile/rust |
| 412 |
rust.stagefeedback: stagefeedback-start |
| 413 |
-mv rust/*$(objext) stagefeedback/rust |
| 414 |
|
| 415 |
CFLAGS-rust/rust-lang.o += -DDEFAULT_TARGET_VERSION=\"$(version)\" \ |
| 416 |
-DDEFAULT_TARGET_MACHINE=\"$(target_noncanonical)\" |
| 417 |
|
| 418 |
# cross-folder includes - add new folders later |
| 419 |
RUST_INCLUDES = -I $(srcdir)/rust \ |
| 420 |
-I $(srcdir)/rust/lex \ |
| 421 |
-I $(srcdir)/rust/parse \ |
| 422 |
-I $(srcdir)/rust/ast \ |
| 423 |
-I $(srcdir)/rust/analysis \ |
| 424 |
-I $(srcdir)/rust/backend \ |
| 425 |
-I $(srcdir)/rust/expand \ |
| 426 |
-I $(srcdir)/rust/hir/tree \ |
| 427 |
-I $(srcdir)/rust/hir \ |
| 428 |
-I $(srcdir)/rust/resolve \ |
| 429 |
-I $(srcdir)/rust/util \ |
| 430 |
-I $(srcdir)/rust/typecheck \ |
| 431 |
-I $(srcdir)/rust/checks/lints \ |
| 432 |
-I $(srcdir)/rust/checks/errors \ |
| 433 |
-I $(srcdir)/rust/checks/errors/privacy \ |
| 434 |
-I $(srcdir)/rust/checks/errors/borrowck \ |
| 435 |
-I $(srcdir)/rust/util \ |
| 436 |
-I $(srcdir)/rust/metadata \ |
| 437 |
-I $(srcdir)/../libgrust |
| 438 |
|
| 439 |
# add files that require cross-folder includes - currently rust-lang.o, rust-lex.o |
| 440 |
CFLAGS-rust/rust-lang.o += $(RUST_INCLUDES) |
| 441 |
CFLAGS-rust/rust-lex.o += $(RUST_INCLUDES) |
| 442 |
CFLAGS-rust/rust-parse.o += $(RUST_INCLUDES) |
| 443 |
CFLAGS-rust/rust-session-manager.o += $(RUST_INCLUDES) |
| 444 |
|
| 445 |
RUST_CXXFLAGS = $(CXXFLAGS) |
| 446 |
|
| 447 |
# build all rust/lex files in rust folder, add cross-folder includes |
| 448 |
rust/%.o: rust/lex/%.cc |
| 449 |
$(COMPILE) $(RUST_CXXFLAGS) $(RUST_INCLUDES) $< |
| 450 |
$(POSTCOMPILE) |
| 451 |
|
| 452 |
# build all rust/parse files in rust folder, add cross-folder includes |
| 453 |
rust/%.o: rust/parse/%.cc |
| 454 |
$(COMPILE) $(RUST_CXXFLAGS) $(RUST_INCLUDES) $< |
| 455 |
$(POSTCOMPILE) |
| 456 |
|
| 457 |
# build rust/ast files in rust folder |
| 458 |
rust/%.o: rust/ast/%.cc |
| 459 |
$(COMPILE) $(RUST_CXXFLAGS) $(RUST_INCLUDES) $< |
| 460 |
$(POSTCOMPILE) |
| 461 |
|
| 462 |
# build rust/backend files in rust folder |
| 463 |
rust/%.o: rust/backend/%.cc |
| 464 |
$(COMPILE) $(RUST_CXXFLAGS) $(RUST_INCLUDES) $< |
| 465 |
$(POSTCOMPILE) |
| 466 |
|
| 467 |
# build rust/expand files in rust folder |
| 468 |
rust/%.o: rust/expand/%.cc |
| 469 |
$(COMPILE) $(RUST_CXXFLAGS) $(RUST_INCLUDES) $< |
| 470 |
$(POSTCOMPILE) |
| 471 |
|
| 472 |
# build rust/util files in rust folder |
| 473 |
rust/%.o: rust/util/%.cc |
| 474 |
$(COMPILE) $(RUST_CXXFLAGS) $(RUST_INCLUDES) $< |
| 475 |
$(POSTCOMPILE) |
| 476 |
|
| 477 |
# build rust/hir files in rust folder |
| 478 |
rust/%.o: rust/hir/%.cc |
| 479 |
$(COMPILE) $(RUST_CXXFLAGS) $(RUST_INCLUDES) $< |
| 480 |
$(POSTCOMPILE) |
| 481 |
|
| 482 |
# build rust/hir/tree files in rust folder |
| 483 |
rust/%.o: rust/hir/tree/%.cc |
| 484 |
$(COMPILE) $(RUST_CXXFLAGS) $(RUST_INCLUDES) $< |
| 485 |
$(POSTCOMPILE) |
| 486 |
|
| 487 |
# build rust/resolve files in rust folder |
| 488 |
rust/%.o: rust/resolve/%.cc |
| 489 |
$(COMPILE) $(RUST_CXXFLAGS) $(RUST_INCLUDES) $< |
| 490 |
$(POSTCOMPILE) |
| 491 |
|
| 492 |
# build rust/typecheck files in rust folder |
| 493 |
rust/%.o: rust/typecheck/%.cc |
| 494 |
$(COMPILE) $(RUST_CXXFLAGS) $(RUST_INCLUDES) $< |
| 495 |
$(POSTCOMPILE) |
| 496 |
|
| 497 |
# build rust/checks/lints files in rust folder |
| 498 |
rust/%.o: rust/checks/lints/%.cc |
| 499 |
$(COMPILE) $(RUST_CXXFLAGS) $(RUST_INCLUDES) $< |
| 500 |
$(POSTCOMPILE) |
| 501 |
|
| 502 |
# build rust/checks/errors files in rust folder |
| 503 |
rust/%.o: rust/checks/errors/%.cc |
| 504 |
$(COMPILE) $(RUST_CXXFLAGS) $(RUST_INCLUDES) $< |
| 505 |
$(POSTCOMPILE) |
| 506 |
|
| 507 |
# build privacy pass files in rust folder |
| 508 |
rust/%.o: rust/checks/errors/privacy/%.cc |
| 509 |
$(COMPILE) $(RUST_CXXFLAGS) $(RUST_INCLUDES) $< |
| 510 |
$(POSTCOMPILE) |
| 511 |
|
| 512 |
# build borrow checking pass files in rust folder |
| 513 |
rust/%.o: rust/checks/errors/borrowck/%.cc |
| 514 |
$(COMPILE) $(RUST_CXXFLAGS) $(RUST_INCLUDES) $< |
| 515 |
$(POSTCOMPILE) |
| 516 |
|
| 517 |
|
| 518 |
# build borrow checking pass polonius files in rust folder |
| 519 |
rust/%.o: rust/checks/errors/borrowck/polonius/%.cc |
| 520 |
$(COMPILE) $(RUST_CXXFLAGS) $(RUST_INCLUDES) $< |
| 521 |
$(POSTCOMPILE) |
| 522 |
|
| 523 |
# build rust/metadata files in rust folder |
| 524 |
rust/%.o: rust/metadata/%.cc |
| 525 |
$(COMPILE) $(RUST_CXXFLAGS) $(RUST_INCLUDES) $< |
| 526 |
$(POSTCOMPILE) |
| 527 |
|
| 528 |
rust/libffi_polonius.a: \ |
| 529 |
rust/checks/errors/borrowck/ffi-polonius/Cargo.toml \ |
| 530 |
$(wildcard $(srcdir)/rust/checks/errors/borrowck/ffi-polonius/src/*) |
| 531 |
cd $(srcdir)/rust/checks/errors/borrowck/ffi-polonius/ && cargo build --offline --release --target-dir $(objdir)/rust/ffi-polonius |
| 532 |
cp rust/ffi-polonius/release/libffi_polonius.a rust/libffi_polonius.a |