blob: 63c4d94af719615f7effbf5fdb30529102f5b291 [file] [log] [blame]
Dan Cashman36ee91d2017-07-07 14:59:51 -07001# Command to turn collection of policy files into a policy.conf file to be
2# processed by checkpolicy
3define transform-policy-to-conf
4@mkdir -p $(dir $@)
Dan Willemsen3c3e59b2019-06-19 10:52:50 -07005$(hide) $(M4) --fatal-warnings $(PRIVATE_ADDITIONAL_M4DEFS) \
Dan Cashman36ee91d2017-07-07 14:59:51 -07006 -D mls_num_sens=$(PRIVATE_MLS_SENS) -D mls_num_cats=$(PRIVATE_MLS_CATS) \
Joel Galenson8c72eea2018-03-07 15:36:29 -08007 -D target_build_variant=$(PRIVATE_TARGET_BUILD_VARIANT) \
Dan Cashman36ee91d2017-07-07 14:59:51 -07008 -D target_with_dexpreopt=$(WITH_DEXPREOPT) \
9 -D target_arch=$(PRIVATE_TGT_ARCH) \
10 -D target_with_asan=$(PRIVATE_TGT_WITH_ASAN) \
Pirama Arumuga Nainarce9c0c52019-06-13 15:05:15 -070011 -D target_with_native_coverage=$(PRIVATE_TGT_WITH_NATIVE_COVERAGE) \
Steven Moreland763697d2017-11-09 11:24:56 -080012 -D target_full_treble=$(PRIVATE_SEPOLICY_SPLIT) \
Jaekyun Seoke4971452017-10-19 16:54:49 +090013 -D target_compatible_property=$(PRIVATE_COMPATIBLE_PROPERTY) \
Inseob Kimed59c222019-09-26 15:14:55 +090014 -D target_treble_sysprop_neverallow=$(PRIVATE_TREBLE_SYSPROP_NEVERALLOW) \
Inseob Kimafc09932020-09-28 13:32:43 +090015 -D target_enforce_sysprop_owner=$(PRIVATE_ENFORCE_SYSPROP_OWNER) \
Tri Vo77c44fc2018-06-05 14:11:08 -070016 -D target_exclude_build_test=$(PRIVATE_EXCLUDE_BUILD_TEST) \
Peter Collingbourne330ee2c2019-10-15 18:10:38 -070017 -D target_requires_insecure_execmem_for_swiftshader=$(PRODUCT_REQUIRES_INSECURE_EXECMEM_FOR_SWIFTSHADER) \
Hridya Valsarajua885dd82021-04-26 16:32:17 -070018 -D target_enforce_debugfs_restriction=$(PRIVATE_ENFORCE_DEBUGFS_RESTRICTION) \
Dan Cashman36ee91d2017-07-07 14:59:51 -070019 $(PRIVATE_TGT_RECOVERY) \
Dan Willemsen3c3e59b2019-06-19 10:52:50 -070020 -s $(PRIVATE_POLICY_FILES) > $@
Dan Cashman36ee91d2017-07-07 14:59:51 -070021endef
22.KATI_READONLY := transform-policy-to-conf
Jooyung Han0606ce72020-09-23 19:16:10 +090023
24###########################################################
25## Collect file_contexts files into a single tmp file with m4
26##
27## $(1): list of file_contexts files
28## $(2): filename into which file_contexts files are merged
29###########################################################
30
31define _merge-fc-files
32$(2): $(1) $(M4)
33 $(hide) mkdir -p $$(dir $$@)
34 $(hide) $(M4) --fatal-warnings -s $(1) > $$@
35endef
36
37define merge-fc-files
38$(eval $(call _merge-fc-files,$(1),$(2)))
39endef