forked from openkylin/platform_build
Use dependency files generated by llvm-rs-cc for Java
This is a reland of 4c474617d4
This time, we use awk instead of sed, and the script works
on Mac.
For C++ code llvm-rs-cc defines two targets but it defines
three targets for Java. The sed script was updated to handle
both cases appropriately.
Bug: 26839129
Change-Id: I1bca7d253764554d552950e03deedabaa9b7f17e
This commit is contained in:
parent
d6184e1da9
commit
52a1d6c666
|
@ -967,6 +967,24 @@ endef
|
|||
## Commands to compile RenderScript to Java
|
||||
###########################################################
|
||||
|
||||
## Merge multiple .d files generated by llvm-rs-cc. This is necessary
|
||||
## because ninja can handle only a single depfile per build target.
|
||||
## .d files generated by llvm-rs-cc define .stamp, .bc, and optionally
|
||||
## .java as build targets. However, there's no way to let ninja know
|
||||
## dependencies to .bc files and .java files, so we give up build
|
||||
## targets for them. As we write the .stamp file as the target by
|
||||
## ourselves, the awk script removes the first lines before the colon
|
||||
## and append a backslash to the last line to concatenate contents of
|
||||
## multiple files.
|
||||
# $(1): .d files to be merged
|
||||
# $(2): merged .d file
|
||||
define _merge-renderscript-d
|
||||
$(hide) echo '$@: $(backslash)' > $2
|
||||
$(foreach d,$1, \
|
||||
$(hide) awk 'start { sub(/( \\)?$$/, " \\"); print } /:/ { start=1 }' < $d >> $2$(newline))
|
||||
$(hide) echo >> $2
|
||||
endef
|
||||
|
||||
define transform-renderscripts-to-java-and-bc
|
||||
@echo "RenderScript: $(PRIVATE_MODULE) <= $(PRIVATE_RS_SOURCE_FILES)"
|
||||
$(hide) rm -rf $(PRIVATE_RS_OUTPUT_DIR)
|
||||
|
@ -981,8 +999,8 @@ $(hide) $(PRIVATE_RS_CC) \
|
|||
$(PRIVATE_RS_FLAGS) \
|
||||
$(foreach inc,$(PRIVATE_RS_INCLUDES),$(addprefix -I , $(inc))) \
|
||||
$(PRIVATE_RS_SOURCE_FILES)
|
||||
$(foreach d,$(PRIVATE_DEP_FILES),\
|
||||
$(call transform-d-to-p-args,$(d),$(d:%.d=%.P))$(newline))
|
||||
$(call _merge-renderscript-d,$(PRIVATE_DEP_FILES),$@.d)
|
||||
$(call transform-d-to-p-args,$@.d,$@.P)
|
||||
$(hide) mkdir -p $(dir $@)
|
||||
$(hide) touch $@
|
||||
endef
|
||||
|
@ -1005,24 +1023,6 @@ endef
|
|||
## Commands to compile RenderScript to C++
|
||||
###########################################################
|
||||
|
||||
## Merge multiple .d files generated by llvm-rs-cc. This is necessary
|
||||
## because ninja can handle only a single depfile per build target.
|
||||
## We assume .d files start with two targets and their prerequisites
|
||||
## follow. The first line is for the stamp file and the second line is
|
||||
## for .bc file. There's no way to let ninja know dependencies to .bc
|
||||
## files, so we give up build targets for .bc files. As we write the
|
||||
## .stamp file as the target by ourselves, the sed script removes the
|
||||
## first two lines and append a backslash to the last line to
|
||||
## concatenate contents of multiple files.
|
||||
# $(1): .d files to be merged
|
||||
# $(2): merged .d file
|
||||
define _merge-renderscript-d
|
||||
$(hide) echo '$@: $(backslash)' > $2
|
||||
$(foreach d,$1, \
|
||||
$(hide) sed '1d; 2d; s/\( \\\)\?$$/ \\/' $d >> $2$(newline))
|
||||
$(hide) echo >> $2
|
||||
endef
|
||||
|
||||
define transform-renderscripts-to-cpp-and-bc
|
||||
@echo "RenderScript: $(PRIVATE_MODULE) <= $(PRIVATE_RS_SOURCE_FILES)"
|
||||
$(hide) rm -rf $(PRIVATE_RS_OUTPUT_DIR)
|
||||
|
|
|
@ -215,7 +215,7 @@ $(RenderScript_file_stamp): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIP
|
|||
$(transform-renderscripts-to-java-and-bc)
|
||||
|
||||
# include the dependency files (.d/.P) generated by llvm-rs-cc.
|
||||
-include $(bc_dep_files:%.d=%.P)
|
||||
$(call include-depfile,$(RenderScript_file_stamp).P,$(RenderScript_file_stamp))
|
||||
|
||||
ifneq ($(LOCAL_RENDERSCRIPT_COMPATIBILITY),)
|
||||
|
||||
|
|
Loading…
Reference in New Issue