Dan Willemsen | fa32e29 | 2017-10-19 22:18:23 -0700 | [diff] [blame] | 1 | # Usage: make -f path/to/Android.sources.bp.mk NAMES=<> >Android.sources.bp |
| 2 | # |
| 3 | # It will read the Makefile.sources in the current directory, and |
| 4 | # write <NAME>_FILES to stdout as an Android.bp cc_defaults module. |
| 5 | |
| 6 | .PHONY: all |
| 7 | all: |
| 8 | @# Do nothing |
| 9 | |
| 10 | include Makefile.sources |
| 11 | |
| 12 | empty := |
| 13 | indent := $(empty) $(empty) |
| 14 | |
| 15 | $(info // Autogenerated with Android.sources.bp.mk) |
| 16 | $(foreach NAME,$(NAMES), \ |
| 17 | $(eval lower_name := $(shell echo $(PREFIX)$(NAME) | tr 'A-Z' 'a-z')) \ |
| 18 | $(info ) \ |
| 19 | $(info cc_defaults {) \ |
| 20 | $(info $(indent)name: "$(lower_name)_sources",) \ |
| 21 | $(info $(indent)srcs: [) \ |
| 22 | $(foreach f,$(filter %.c,$($(NAME)_FILES)), \ |
| 23 | $(info $(indent)$(indent)"$(f)",)) \ |
| 24 | $(info $(indent)],) \ |
| 25 | $(info })) |