blob: e00d73d553f2d78634030264d58573fe061c080a [file] [log] [blame]
Dan Willemsend4ed1952020-01-24 17:30:49 -08001#!/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
Dan Willemsenf75e3af2020-01-24 18:57:46 -08005bpfmt -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