aosp12/external/mesa3d/aosp-gen-bp.sh

34 lines
956 B
Bash
Raw Permalink Normal View History

2023-01-09 17:11:35 +08:00
#!/bin/bash -e
echo "// Autogenerated by aosp-gen-bp.sh" >Android.gen.bp
echo 'cc_defaults { name: "mesa_version_defaults", cflags: ["-DPACKAGE_VERSION=\"'$(cat VERSION)'\""] }' >>Android.gen.bp
bpfmt -w Android.gen.bp
echo '
nothing:
@true
include $(DIR)/Makefile.sources
comma := ,
$(file >$(DIR)/Android.sources.bp,// Generated by aosp-gen-bp.sh)
$(foreach extract,$(EXTRACT),\
$(eval kv := $(subst :, ,$(extract)))\
$(eval fgname := $(word 1,$(kv)))\
$(eval sym := $(word 2,$(kv)))\
$(file >>$(DIR)/Android.sources.bp,filegroup{name:"$(fgname)",\
visibility: [":__subpackages__"],\
srcs:[$(foreach f,$(filter %.c,$($(sym))),"$(f)"$(comma))]}))
output := $(shell bpfmt -w $(DIR)/Android.sources.bp 2>&1 || echo "Failed")
ifneq ($(output),)
$(error bpfmt returned: $(output))
endif
' >android_extract.mk
make -f android_extract.mk DIR=src/mesa \
EXTRACT="\
mesa_x86_sse41_srcs:X86_SSE41_FILES \
"
rm android_extract.mk