Makefile (2185242faddd12a1ba1060be5caf584fe5aba93a) | Makefile (c83b16cefd78f55071840e1159ead9fe62747769) |
---|---|
1# SPDX-License-Identifier: GPL-2.0 2 | 1# SPDX-License-Identifier: GPL-2.0 2 |
3always-$(CONFIG_RUST) += target.json 4no-clean-files += target.json 5 | |
6obj-$(CONFIG_RUST) += core.o compiler_builtins.o 7always-$(CONFIG_RUST) += exports_core_generated.h 8 9# Missing prototypes are expected in the helpers since these are exported 10# for Rust only, thus there is no header nor prototypes. 11obj-$(CONFIG_RUST) += helpers.o 12CFLAGS_REMOVE_helpers.o = -Wmissing-prototypes -Wmissing-declarations 13 --- 212 unchanged lines hidden (view full) --- 226 227rusttest-kernel: private rustc_target_flags = --extern alloc \ 228 --extern build_error --extern macros --extern bindings 229rusttest-kernel: $(src)/kernel/lib.rs rusttest-prepare \ 230 rusttestlib-build_error rusttestlib-macros rusttestlib-bindings FORCE 231 $(call if_changed,rustc_test) 232 $(call if_changed,rustc_test_library) 233 | 3obj-$(CONFIG_RUST) += core.o compiler_builtins.o 4always-$(CONFIG_RUST) += exports_core_generated.h 5 6# Missing prototypes are expected in the helpers since these are exported 7# for Rust only, thus there is no header nor prototypes. 8obj-$(CONFIG_RUST) += helpers.o 9CFLAGS_REMOVE_helpers.o = -Wmissing-prototypes -Wmissing-declarations 10 --- 212 unchanged lines hidden (view full) --- 223 224rusttest-kernel: private rustc_target_flags = --extern alloc \ 225 --extern build_error --extern macros --extern bindings 226rusttest-kernel: $(src)/kernel/lib.rs rusttest-prepare \ 227 rusttestlib-build_error rusttestlib-macros rusttestlib-bindings FORCE 228 $(call if_changed,rustc_test) 229 $(call if_changed,rustc_test_library) 230 |
234filechk_rust_target = $(objtree)/scripts/generate_rust_target < $< 235 236$(obj)/target.json: $(objtree)/include/config/auto.conf FORCE 237 $(call filechk,rust_target) 238 | |
239ifdef CONFIG_CC_IS_CLANG 240bindgen_c_flags = $(c_flags) 241else 242# bindgen relies on libclang to parse C. Ideally, bindgen would support a GCC 243# plugin backend and/or the Clang driver would be perfectly compatible with GCC. 244# 245# For the moment, here we are tweaking the flags on the fly. This is a hack, 246# and some kernel configurations may not work (e.g. `GCC_PLUGIN_RANDSTRUCT` --- 107 unchanged lines hidden (view full) --- 354 355rust-analyzer: 356 $(Q)$(srctree)/scripts/generate_rust_analyzer.py $(srctree) $(objtree) \ 357 $(RUST_LIB_SRC) > $(objtree)/rust-project.json 358 359$(obj)/core.o: private skip_clippy = 1 360$(obj)/core.o: private skip_flags = -Dunreachable_pub 361$(obj)/core.o: private rustc_target_flags = $(core-cfgs) | 231ifdef CONFIG_CC_IS_CLANG 232bindgen_c_flags = $(c_flags) 233else 234# bindgen relies on libclang to parse C. Ideally, bindgen would support a GCC 235# plugin backend and/or the Clang driver would be perfectly compatible with GCC. 236# 237# For the moment, here we are tweaking the flags on the fly. This is a hack, 238# and some kernel configurations may not work (e.g. `GCC_PLUGIN_RANDSTRUCT` --- 107 unchanged lines hidden (view full) --- 346 347rust-analyzer: 348 $(Q)$(srctree)/scripts/generate_rust_analyzer.py $(srctree) $(objtree) \ 349 $(RUST_LIB_SRC) > $(objtree)/rust-project.json 350 351$(obj)/core.o: private skip_clippy = 1 352$(obj)/core.o: private skip_flags = -Dunreachable_pub 353$(obj)/core.o: private rustc_target_flags = $(core-cfgs) |
362$(obj)/core.o: $(RUST_LIB_SRC)/core/src/lib.rs $(obj)/target.json FORCE | 354$(obj)/core.o: $(RUST_LIB_SRC)/core/src/lib.rs scripts/target.json FORCE |
363 $(call if_changed_dep,rustc_library) 364 365$(obj)/compiler_builtins.o: private rustc_objcopy = -w -W '__*' 366$(obj)/compiler_builtins.o: $(src)/compiler_builtins.rs $(obj)/core.o FORCE 367 $(call if_changed_dep,rustc_library) 368 369$(obj)/alloc.o: private skip_clippy = 1 370$(obj)/alloc.o: private skip_flags = -Dunreachable_pub --- 20 unchanged lines hidden --- | 355 $(call if_changed_dep,rustc_library) 356 357$(obj)/compiler_builtins.o: private rustc_objcopy = -w -W '__*' 358$(obj)/compiler_builtins.o: $(src)/compiler_builtins.rs $(obj)/core.o FORCE 359 $(call if_changed_dep,rustc_library) 360 361$(obj)/alloc.o: private skip_clippy = 1 362$(obj)/alloc.o: private skip_flags = -Dunreachable_pub --- 20 unchanged lines hidden --- |