Copy rules.mk files from external/rust/crates.

Bug: 339424309
Test: treehugger
Change-Id: I86571127cca620cb6e5335e9583721897547a3f0
diff --git a/crates/async-trait/rules.mk b/crates/async-trait/rules.mk
new file mode 100644
index 0000000..c82a8de
--- /dev/null
+++ b/crates/async-trait/rules.mk
@@ -0,0 +1,17 @@
+# This file is generated by cargo2rulesmk.py --run.
+# Do not modify this file as changes will be overridden on upgrade.
+
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := $(LOCAL_DIR)
+MODULE_CRATE_NAME := async_trait
+MODULE_RUST_CRATE_TYPES := proc-macro
+MODULE_SRCS := \
+	$(LOCAL_DIR)/src/lib.rs \
+
+MODULE_RUST_EDITION := 2021
+MODULE_LIBRARY_DEPS := \
+	external/rust/crates/proc-macro2 \
+	external/rust/crates/quote \
+	external/rust/crates/syn \
+
+include make/library.mk
diff --git a/crates/byteorder/rules.mk b/crates/byteorder/rules.mk
new file mode 100644
index 0000000..3eba575
--- /dev/null
+++ b/crates/byteorder/rules.mk
@@ -0,0 +1,21 @@
+# This file is generated by cargo2rulesmk.py --run --config cargo2rulesmk.json.
+# Do not modify this file as changes will be overridden on upgrade.
+
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := $(LOCAL_DIR)
+MODULE_CRATE_NAME := byteorder
+MODULE_SRCS := \
+	$(LOCAL_DIR)/src/lib.rs \
+
+MODULE_RUST_EDITION := 2018
+MODULE_RUSTFLAGS += \
+	--cfg 'feature="default"' \
+
+ifeq ($(call TOBOOL,$(TRUSTY_USERSPACE)),true)
+
+MODULE_RUSTFLAGS += \
+	--cfg 'feature="std"' \
+
+endif
+
+include make/library.mk
diff --git a/crates/cfg-if/rules.mk b/crates/cfg-if/rules.mk
new file mode 100644
index 0000000..05bd4dd
--- /dev/null
+++ b/crates/cfg-if/rules.mk
@@ -0,0 +1,19 @@
+# This file is generated by cargo2rulesmk.py --run --config cargo2rulesmk.json --features .
+# Do not modify this file as changes will be overridden on upgrade.
+
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := $(LOCAL_DIR)
+MODULE_CRATE_NAME := cfg_if
+MODULE_SRCS := \
+	$(LOCAL_DIR)/src/lib.rs \
+
+# NOTE: This crate is a dependency of libstd, so we can't implicitly depend on
+# libstd as we would normally. The dependencies listed above are the ones
+# declared in the `Cargo.toml` when the `rustc-dep-of-std` feature is enabled.
+MODULE_ADD_IMPLICIT_DEPS := false
+MODULE_RUST_EDITION := 2018
+MODULE_LIBRARY_DEPS := \
+	trusty/user/base/lib/libcompiler_builtins-rust \
+	trusty/user/base/lib/libcore-rust \
+
+include make/library.mk
diff --git a/crates/ciborium-io/rules.mk b/crates/ciborium-io/rules.mk
new file mode 100644
index 0000000..6b68138
--- /dev/null
+++ b/crates/ciborium-io/rules.mk
@@ -0,0 +1,17 @@
+# This file is generated by cargo2rulesmk.py --run --config cargo2rulesmk.json.
+# Do not modify this file as changes will be overridden on upgrade.
+
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := $(LOCAL_DIR)
+MODULE_CRATE_NAME := ciborium_io
+MODULE_SRCS := \
+	$(LOCAL_DIR)/src/lib.rs \
+
+MODULE_RUST_EDITION := 2021
+MODULE_RUSTFLAGS += \
+	--cfg 'feature="alloc"' \
+
+MODULE_LIBRARY_DEPS := \
+	trusty/user/base/lib/liballoc-rust \
+
+include make/library.mk
diff --git a/crates/ciborium-ll/rules.mk b/crates/ciborium-ll/rules.mk
new file mode 100644
index 0000000..766aeee
--- /dev/null
+++ b/crates/ciborium-ll/rules.mk
@@ -0,0 +1,15 @@
+# This file is generated by cargo2rulesmk.py --run --features .
+# Do not modify this file as changes will be overridden on upgrade.
+
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := $(LOCAL_DIR)
+MODULE_CRATE_NAME := ciborium_ll
+MODULE_SRCS := \
+	$(LOCAL_DIR)/src/lib.rs \
+
+MODULE_RUST_EDITION := 2021
+MODULE_LIBRARY_DEPS := \
+	external/rust/crates/ciborium-io \
+	external/rust/crates/half \
+
+include make/library.mk
diff --git a/crates/ciborium/rules.mk b/crates/ciborium/rules.mk
new file mode 100644
index 0000000..9efa203
--- /dev/null
+++ b/crates/ciborium/rules.mk
@@ -0,0 +1,20 @@
+# This file is generated by cargo2rulesmk.py --run.
+# Do not modify this file as changes will be overridden on upgrade.
+
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := $(LOCAL_DIR)
+MODULE_CRATE_NAME := ciborium
+MODULE_SRCS := \
+	$(LOCAL_DIR)/src/lib.rs \
+
+MODULE_RUST_EDITION := 2021
+MODULE_RUSTFLAGS += \
+	--cfg 'feature="default"' \
+	--cfg 'feature="std"' \
+
+MODULE_LIBRARY_DEPS := \
+	external/rust/crates/ciborium-io \
+	external/rust/crates/ciborium-ll \
+	external/rust/crates/serde \
+
+include make/library.mk
diff --git a/crates/const-oid/rules.mk b/crates/const-oid/rules.mk
new file mode 100644
index 0000000..3443250
--- /dev/null
+++ b/crates/const-oid/rules.mk
@@ -0,0 +1,16 @@
+# This file is generated by cargo2rulesmk.py --run --config cargo2rulesmk.json --features .
+# Do not modify this file as changes will be overridden on upgrade.
+
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := $(LOCAL_DIR)
+MODULE_CRATE_NAME := const_oid
+MODULE_SRCS := \
+	$(LOCAL_DIR)/src/lib.rs \
+
+MODULE_RUST_EDITION := 2021
+MODULE_RUSTFLAGS += \
+	--cfg 'feature="db"' \
+
+MODULE_LIBRARY_DEPS := \
+
+include make/library.mk
diff --git a/crates/coset/rules.mk b/crates/coset/rules.mk
new file mode 100644
index 0000000..a41ac8f
--- /dev/null
+++ b/crates/coset/rules.mk
@@ -0,0 +1,18 @@
+# This file is generated by cargo2rulesmk.py --run.
+# Do not modify this file as changes will be overridden on upgrade.
+
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := $(LOCAL_DIR)
+MODULE_CRATE_NAME := coset
+MODULE_SRCS := \
+	$(LOCAL_DIR)/src/lib.rs \
+
+MODULE_RUST_EDITION := 2018
+MODULE_RUSTFLAGS += \
+	--cfg 'feature="default"' \
+
+MODULE_LIBRARY_DEPS := \
+	external/rust/crates/ciborium \
+	external/rust/crates/ciborium-io \
+
+include make/library.mk
diff --git a/crates/der/rules.mk b/crates/der/rules.mk
new file mode 100644
index 0000000..f5d264e
--- /dev/null
+++ b/crates/der/rules.mk
@@ -0,0 +1,24 @@
+# This file is generated by cargo2rulesmk.py --run --config cargo2rulesmk.json.
+# Do not modify this file as changes will be overridden on upgrade.
+
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := $(LOCAL_DIR)
+MODULE_CRATE_NAME := der
+MODULE_SRCS := \
+	$(LOCAL_DIR)/src/lib.rs \
+
+MODULE_RUST_EDITION := 2021
+MODULE_RUSTFLAGS += \
+	--cfg 'feature="alloc"' \
+	--cfg 'feature="derive"' \
+	--cfg 'feature="flagset"' \
+	--cfg 'feature="oid"' \
+	--cfg 'feature="zeroize"' \
+
+MODULE_LIBRARY_DEPS := \
+	external/rust/crates/const-oid \
+	external/rust/crates/der_derive \
+	external/rust/crates/flagset \
+	external/rust/crates/zeroize \
+
+include make/library.mk
diff --git a/crates/der_derive/rules.mk b/crates/der_derive/rules.mk
new file mode 100644
index 0000000..ec3d49c
--- /dev/null
+++ b/crates/der_derive/rules.mk
@@ -0,0 +1,17 @@
+# This file is generated by cargo2rulesmk.py --run --config cargo2rulesmk.json.
+# Do not modify this file as changes will be overridden on upgrade.
+
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := $(LOCAL_DIR)
+MODULE_CRATE_NAME := der_derive
+MODULE_RUST_CRATE_TYPES := proc-macro
+MODULE_SRCS := \
+	$(LOCAL_DIR)/src/lib.rs \
+
+MODULE_RUST_EDITION := 2021
+MODULE_LIBRARY_DEPS := \
+	external/rust/crates/proc-macro2 \
+	external/rust/crates/quote \
+	external/rust/crates/syn \
+
+include make/library.mk
diff --git a/crates/downcast-rs/rules.mk b/crates/downcast-rs/rules.mk
new file mode 100644
index 0000000..7404137
--- /dev/null
+++ b/crates/downcast-rs/rules.mk
@@ -0,0 +1,15 @@
+# This file is generated by cargo2rulesmk.py --run.
+# Do not modify this file as changes will be overridden on upgrade.
+
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := $(LOCAL_DIR)
+MODULE_CRATE_NAME := downcast_rs
+MODULE_SRCS := \
+	$(LOCAL_DIR)/src/lib.rs \
+
+MODULE_RUST_EDITION := 2015
+MODULE_RUSTFLAGS += \
+	--cfg 'feature="default"' \
+	--cfg 'feature="std"' \
+
+include make/library.mk
diff --git a/crates/enumn/rules.mk b/crates/enumn/rules.mk
new file mode 100644
index 0000000..e6bee36
--- /dev/null
+++ b/crates/enumn/rules.mk
@@ -0,0 +1,17 @@
+# This file is generated by cargo2rulesmk.py --run --features .
+# Do not modify this file as changes will be overridden on upgrade.
+
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := $(LOCAL_DIR)
+MODULE_CRATE_NAME := enumn
+MODULE_RUST_CRATE_TYPES := proc-macro
+MODULE_SRCS := \
+	$(LOCAL_DIR)/src/lib.rs \
+
+MODULE_RUST_EDITION := 2018
+MODULE_LIBRARY_DEPS := \
+	external/rust/crates/proc-macro2 \
+	external/rust/crates/quote \
+	external/rust/crates/syn \
+
+include make/library.mk
diff --git a/crates/flagset/rules.mk b/crates/flagset/rules.mk
new file mode 100644
index 0000000..3dc41e6
--- /dev/null
+++ b/crates/flagset/rules.mk
@@ -0,0 +1,14 @@
+# This file is generated by cargo2rulesmk.py --run --features .
+# Do not modify this file as changes will be overridden on upgrade.
+
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := $(LOCAL_DIR)
+MODULE_CRATE_NAME := flagset
+MODULE_SRCS := \
+	$(LOCAL_DIR)/src/lib.rs \
+
+MODULE_RUST_EDITION := 2018
+MODULE_LIBRARY_DEPS := \
+	external/rust/crates/serde \
+
+include make/library.mk
diff --git a/crates/lazy_static/rules.mk b/crates/lazy_static/rules.mk
index f4866ab..89de36e 100644
--- a/crates/lazy_static/rules.mk
+++ b/crates/lazy_static/rules.mk
@@ -2,7 +2,7 @@
 # Do not modify this file after the LOCAL_DIR line
 # because the changes will be overridden on upgrade.
 # Content before the first line starting with LOCAL_DIR is preserved.
-// DO NOT SUBMIT: Add license before submitting.
+
 LOCAL_DIR := $(GET_LOCAL_DIR)
 MODULE := $(LOCAL_DIR)
 MODULE_CRATE_NAME := lazy_static
diff --git a/crates/libc/rules.mk b/crates/libc/rules.mk
new file mode 100644
index 0000000..0cd0939
--- /dev/null
+++ b/crates/libc/rules.mk
@@ -0,0 +1,44 @@
+# This file is generated by cargo2rulesmk.py --run --config cargo2rulesmk.json.
+# Do not modify this file as changes will be overridden on upgrade.
+
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := $(LOCAL_DIR)
+MODULE_CRATE_NAME := libc
+MODULE_SRCS := \
+	$(LOCAL_DIR)/src/lib.rs \
+
+MODULE_ADD_IMPLICIT_DEPS := false
+MODULE_RUST_EDITION := 2015
+MODULE_RUSTFLAGS += \
+	--cfg 'freebsd11' \
+	--cfg 'libc_align' \
+	--cfg 'libc_cfg_target_vendor' \
+	--cfg 'libc_const_extern_fn' \
+	--cfg 'libc_const_size_of' \
+	--cfg 'libc_core_cvoid' \
+	--cfg 'libc_int128' \
+	--cfg 'libc_long_array' \
+	--cfg 'libc_non_exhaustive' \
+	--cfg 'libc_packedN' \
+	--cfg 'libc_priv_mod_use' \
+	--cfg 'libc_ptr_addr_of' \
+	--cfg 'libc_underscore_const_names' \
+	--cfg 'libc_union' \
+	-A unknown-lints \
+
+MODULE_LIBRARY_DEPS := \
+	trusty/user/base/lib/libcompiler_builtins-rust \
+	trusty/user/base/lib/libcore-rust \
+
+ifeq ($(call TOBOOL,$(TRUSTY_USERSPACE)),true)
+
+MODULE_RUSTFLAGS += \
+	--cfg 'feature="trusty_sys"' \
+
+MODULE_LIBRARY_DEPS += \
+	trusty/user/base/lib/libc-trusty \
+	trusty/user/base/lib/trusty-sys \
+
+endif
+
+include make/library.mk
diff --git a/crates/log/CleanSpec.mk b/crates/log/CleanSpec.mk
new file mode 100644
index 0000000..03e4adc
--- /dev/null
+++ b/crates/log/CleanSpec.mk
@@ -0,0 +1,51 @@
+# Copyright (C) 2023 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# If you don't need to do a full clean build but would like to touch
+# a file or delete some intermediate files, add a clean step to the end
+# of the list.  These steps will only be run once, if they haven't been
+# run before.
+#
+# E.g.:
+#     $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
+#     $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
+#
+# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
+# files that are missing or have been moved.
+#
+# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
+# Use $(OUT_DIR) to refer to the "out" directory.
+#
+# If you need to re-do something that's already mentioned, just copy
+# the command and add it to the bottom of the list.  E.g., if a change
+# that you made last week required touching a file and a change you
+# made today requires touching the same file, just copy the old
+# touch step and add it to the end of the list.
+#
+# ************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
+# ************************************************
+
+# For example:
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
+#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
+#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
+
+$(call add-clean-step, rm -rf $(OUT_DIR)/soong/.intermediates/external/rust/crates/log)
+
+# ************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
+# ************************************************
diff --git a/crates/log/rules.mk b/crates/log/rules.mk
new file mode 100644
index 0000000..139dca3
--- /dev/null
+++ b/crates/log/rules.mk
@@ -0,0 +1,19 @@
+# This file is generated by cargo2rulesmk.py --run --config cargo2rulesmk.json --features .
+# Do not modify this file as changes will be overridden on upgrade.
+
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := $(LOCAL_DIR)
+MODULE_CRATE_NAME := log
+MODULE_SRCS := \
+	$(LOCAL_DIR)/src/lib.rs \
+
+MODULE_RUST_EDITION := 2015
+MODULE_RUSTFLAGS += \
+	--cfg 'atomic_cas' \
+	--cfg 'has_atomics' \
+
+MODULE_LIBRARY_DEPS := \
+	external/rust/crates/cfg-if \
+	external/rust/crates/serde \
+
+include make/library.mk
diff --git a/crates/num-traits/rules.mk b/crates/num-traits/rules.mk
index b97e519..a39eb25 100644
--- a/crates/num-traits/rules.mk
+++ b/crates/num-traits/rules.mk
@@ -2,7 +2,7 @@
 # Do not modify this file after the LOCAL_DIR line
 # because the changes will be overridden on upgrade.
 # Content before the first line starting with LOCAL_DIR is preserved.
-// DO NOT SUBMIT: Add license before submitting.
+
 LOCAL_DIR := $(GET_LOCAL_DIR)
 MODULE := $(LOCAL_DIR)
 MODULE_CRATE_NAME := num_traits
diff --git a/crates/pkcs1/rules.mk b/crates/pkcs1/rules.mk
new file mode 100644
index 0000000..6b9ef75
--- /dev/null
+++ b/crates/pkcs1/rules.mk
@@ -0,0 +1,22 @@
+# This file is generated by cargo2rulesmk.py --run --config cargo2rulesmk.json.
+# Do not modify this file as changes will be overridden on upgrade.
+
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := $(LOCAL_DIR)
+MODULE_CRATE_NAME := pkcs1
+MODULE_SRCS := \
+	$(LOCAL_DIR)/src/lib.rs \
+
+MODULE_RUST_EDITION := 2021
+MODULE_RUSTFLAGS += \
+	--cfg 'feature="alloc"' \
+	--cfg 'feature="pkcs8"' \
+	--cfg 'feature="zeroize"' \
+
+MODULE_LIBRARY_DEPS := \
+	external/rust/crates/der \
+	external/rust/crates/pkcs8 \
+	external/rust/crates/spki \
+	external/rust/crates/zeroize \
+
+include make/library.mk
diff --git a/crates/pkcs8/rules.mk b/crates/pkcs8/rules.mk
new file mode 100644
index 0000000..0257d05
--- /dev/null
+++ b/crates/pkcs8/rules.mk
@@ -0,0 +1,18 @@
+# This file is generated by cargo2rulesmk.py --run --config cargo2rulesmk.json --features .
+# Do not modify this file as changes will be overridden on upgrade.
+
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := $(LOCAL_DIR)
+MODULE_CRATE_NAME := pkcs8
+MODULE_SRCS := \
+	$(LOCAL_DIR)/src/lib.rs \
+
+MODULE_RUST_EDITION := 2021
+MODULE_RUSTFLAGS += \
+	--cfg 'feature="alloc"' \
+
+MODULE_LIBRARY_DEPS := \
+	external/rust/crates/der \
+	external/rust/crates/spki \
+
+include make/library.mk
diff --git a/crates/proc-macro2/rules.mk b/crates/proc-macro2/rules.mk
new file mode 100644
index 0000000..39075a8
--- /dev/null
+++ b/crates/proc-macro2/rules.mk
@@ -0,0 +1,22 @@
+# This file is generated by cargo2rulesmk.py --run --config cargo2rulesmk.json.
+# Do not modify this file as changes will be overridden on upgrade.
+
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := $(LOCAL_DIR)
+MODULE_CRATE_NAME := proc_macro2
+MODULE_SRCS := \
+	$(LOCAL_DIR)/src/lib.rs \
+
+MODULE_RUST_EDITION := 2021
+MODULE_RUSTFLAGS += \
+	--cfg 'feature="default"' \
+	--cfg 'feature="proc-macro"' \
+	--cfg 'feature="span-locations"' \
+	--cfg 'proc_macro_span' \
+	--cfg 'span_locations' \
+	--cfg 'wrap_proc_macro' \
+
+MODULE_LIBRARY_DEPS := \
+	external/rust/crates/unicode-ident \
+
+include make/library.mk
diff --git a/crates/sec1/rules.mk b/crates/sec1/rules.mk
new file mode 100644
index 0000000..17355aa
--- /dev/null
+++ b/crates/sec1/rules.mk
@@ -0,0 +1,22 @@
+# This file is generated by cargo2rulesmk.py --run --config cargo2rulesmk.json --features .
+# Do not modify this file as changes will be overridden on upgrade.
+
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := $(LOCAL_DIR)
+MODULE_CRATE_NAME := sec1
+MODULE_SRCS := \
+	$(LOCAL_DIR)/src/lib.rs \
+
+MODULE_RUST_EDITION := 2021
+MODULE_RUSTFLAGS += \
+	--cfg 'feature="alloc"' \
+	--cfg 'feature="der"' \
+	--cfg 'feature="pkcs8"' \
+	--cfg 'feature="zeroize"' \
+
+MODULE_LIBRARY_DEPS := \
+	external/rust/crates/der \
+	external/rust/crates/pkcs8 \
+	external/rust/crates/zeroize \
+
+include make/library.mk
diff --git a/crates/serde_derive/rules.mk b/crates/serde_derive/rules.mk
new file mode 100644
index 0000000..413d378
--- /dev/null
+++ b/crates/serde_derive/rules.mk
@@ -0,0 +1,20 @@
+# This file is generated by cargo2rulesmk.py --run.
+# Do not modify this file as changes will be overridden on upgrade.
+
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := $(LOCAL_DIR)
+MODULE_CRATE_NAME := serde_derive
+MODULE_RUST_CRATE_TYPES := proc-macro
+MODULE_SRCS := \
+	$(LOCAL_DIR)/src/lib.rs \
+
+MODULE_RUST_EDITION := 2015
+MODULE_RUSTFLAGS += \
+	--cfg 'feature="default"' \
+
+MODULE_LIBRARY_DEPS := \
+	external/rust/crates/proc-macro2 \
+	external/rust/crates/quote \
+	external/rust/crates/syn \
+
+include make/library.mk
diff --git a/crates/smccc/rules.mk b/crates/smccc/rules.mk
new file mode 100644
index 0000000..cc22918
--- /dev/null
+++ b/crates/smccc/rules.mk
@@ -0,0 +1,17 @@
+# This file is generated by cargo_embargo.
+# Do not modify this file after the LOCAL_DIR line
+# because the changes will be overridden on upgrade.
+# Content before the first line starting with LOCAL_DIR is preserved.
+// DO NOT SUBMIT: Add license before submitting.
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := $(LOCAL_DIR)
+MODULE_CRATE_NAME := smccc
+MODULE_RUST_CRATE_TYPES := rlib
+MODULE_SRCS := $(LOCAL_DIR)/src/lib.rs
+MODULE_ADD_IMPLICIT_DEPS := false
+MODULE_RUST_EDITION := 2021
+MODULE_LIBRARY_DEPS := \
+	trusty/user/base/lib/libcompiler_builtins-rust \
+	trusty/user/base/lib/libcore-rust
+
+include make/library.mk
diff --git a/crates/spin/rules.mk b/crates/spin/rules.mk
index 31e0128..15d9af6 100644
--- a/crates/spin/rules.mk
+++ b/crates/spin/rules.mk
@@ -2,7 +2,7 @@
 # Do not modify this file after the LOCAL_DIR line
 # because the changes will be overridden on upgrade.
 # Content before the first line starting with LOCAL_DIR is preserved.
-// DO NOT SUBMIT: Add license before submitting.
+
 LOCAL_DIR := $(GET_LOCAL_DIR)
 MODULE := $(LOCAL_DIR)
 MODULE_CRATE_NAME := spin
@@ -10,6 +10,11 @@
 MODULE_SRCS := $(LOCAL_DIR)/src/lib.rs
 MODULE_ADD_IMPLICIT_DEPS := false
 MODULE_RUST_EDITION := 2015
+MODULE_RUSTFLAGS += \
+	--cfg 'feature="mutex"' \
+	--cfg 'feature="once"' \
+	--cfg 'feature="spin_mutex"'
+
 MODULE_LIBRARY_DEPS := \
 	trusty/user/base/lib/libcompiler_builtins-rust \
 	trusty/user/base/lib/libcore-rust
diff --git a/crates/spki/rules.mk b/crates/spki/rules.mk
new file mode 100644
index 0000000..bd3edb9
--- /dev/null
+++ b/crates/spki/rules.mk
@@ -0,0 +1,17 @@
+# This file is generated by cargo2rulesmk.py --run --config cargo2rulesmk.json --features .
+# Do not modify this file as changes will be overridden on upgrade.
+
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := $(LOCAL_DIR)
+MODULE_CRATE_NAME := spki
+MODULE_SRCS := \
+	$(LOCAL_DIR)/src/lib.rs \
+
+MODULE_RUST_EDITION := 2021
+MODULE_RUSTFLAGS += \
+	--cfg 'feature="alloc"' \
+
+MODULE_LIBRARY_DEPS := \
+	external/rust/crates/der \
+
+include make/library.mk
diff --git a/crates/synstructure/rules.mk b/crates/synstructure/rules.mk
new file mode 100644
index 0000000..0926ba0
--- /dev/null
+++ b/crates/synstructure/rules.mk
@@ -0,0 +1,20 @@
+# This file is generated by cargo2rulesmk.py --run --config cargo2rulesmk.json --features .
+# Do not modify this file as changes will be overridden on upgrade.
+
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := $(LOCAL_DIR)
+MODULE_CRATE_NAME := synstructure
+MODULE_SRCS := \
+	$(LOCAL_DIR)/src/lib.rs \
+
+MODULE_RUST_EDITION := 2018
+MODULE_RUSTFLAGS += \
+	--cfg 'feature="proc-macro"' \
+
+MODULE_LIBRARY_DEPS := \
+	external/rust/crates/proc-macro2 \
+	external/rust/crates/quote \
+	external/rust/crates/syn \
+	external/rust/crates/unicode-xid \
+
+include make/library.mk
diff --git a/crates/thiserror/rules.mk b/crates/thiserror/rules.mk
new file mode 100644
index 0000000..54fe88e
--- /dev/null
+++ b/crates/thiserror/rules.mk
@@ -0,0 +1,17 @@
+# This file is generated by cargo2rulesmk.py --run.
+# Do not modify this file as changes will be overridden on upgrade.
+
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := $(LOCAL_DIR)
+MODULE_CRATE_NAME := thiserror
+MODULE_SRCS := \
+	$(LOCAL_DIR)/src/lib.rs \
+
+MODULE_RUST_EDITION := 2018
+MODULE_RUSTFLAGS += \
+	--cfg 'provide_any' \
+
+MODULE_LIBRARY_DEPS := \
+	external/rust/crates/thiserror-impl \
+
+include make/library.mk