Add sepolicy definitions.mk and create policy.conf function.

Bug: 36899958
Test: Builds 'n' boots.
Change-Id: I5836a18f9d0a9a976dda7304045e3b9e1e84565e
Merged-In: I5836a18f9d0a9a976dda7304045e3b9e1e84565e
(cherry picked from commit c0713e86790583dacbd8545d35ae476ff1f849bb)
diff --git a/definitions.mk b/definitions.mk
new file mode 100644
index 0000000..47d0004
--- /dev/null
+++ b/definitions.mk
@@ -0,0 +1,15 @@
+# Command to turn collection of policy files into a policy.conf file to be
+# processed by checkpolicy
+define transform-policy-to-conf
+@mkdir -p $(dir $@)
+$(hide) m4 $(PRIVATE_ADDITIONAL_M4DEFS) \
+	-D mls_num_sens=$(PRIVATE_MLS_SENS) -D mls_num_cats=$(PRIVATE_MLS_CATS) \
+	-D target_build_variant=$(TARGET_BUILD_VARIANT) \
+	-D target_with_dexpreopt=$(WITH_DEXPREOPT) \
+	-D target_arch=$(PRIVATE_TGT_ARCH) \
+	-D target_with_asan=$(PRIVATE_TGT_WITH_ASAN) \
+	-D target_full_treble=$(PRIVATE_FULL_TREBLE) \
+	$(PRIVATE_TGT_RECOVERY) \
+	-s $^ > $@
+endef
+.KATI_READONLY := transform-policy-to-conf