1#!/bin/bash -e 2 3echo "// Autogenerated by aosp-gen-bp.sh" >Android.gen.bp 4echo 'cc_defaults { name: "mesa_version_defaults", cflags: ["-DPACKAGE_VERSION=\"'$(cat VERSION)'\""] }' >>Android.gen.bp 5bpfmt -w Android.gen.bp 6 7 8echo ' 9nothing: 10 @true 11include $(DIR)/Makefile.sources 12comma := , 13$(file >$(DIR)/Android.sources.bp,// Generated by aosp-gen-bp.sh) 14$(foreach extract,$(EXTRACT),\ 15 $(eval kv := $(subst :, ,$(extract)))\ 16 $(eval fgname := $(word 1,$(kv)))\ 17 $(eval sym := $(word 2,$(kv)))\ 18 $(file >>$(DIR)/Android.sources.bp,filegroup{name:"$(fgname)",\ 19 visibility: [":__subpackages__"],\ 20 srcs:[$(foreach f,$(filter %.c,$($(sym))),"$(f)"$(comma))]})) 21 22output := $(shell bpfmt -w $(DIR)/Android.sources.bp 2>&1 || echo "Failed") 23ifneq ($(output),) 24 $(error bpfmt returned: $(output)) 25endif 26' >android_extract.mk 27 28make -f android_extract.mk DIR=src/mesa \ 29 EXTRACT="\ 30 mesa_x86_sse41_srcs:X86_SSE41_FILES \ 31 " 32 33rm android_extract.mk 34