0

I am using some shell commands in the Android.mk, like

$(shell rm -rfv $(TARGET_OUT)/xxx)

And I want to see the command out put during the building process. However, the out put is always single line when I use either

$(info $(shell rm -frv $(TARGET_OUT)/www))

or

$(info "$(shell rm -frv $(TARGET_OUT)/www)")

The result is like

removed `out/target/product/xxx/system/xxx/xxx.xxx' removed directory: `out/target/product/xxx/system/xxx/xxx'

instead of

removed `out/target/product/xxx/system/xxx/xxx.xxx' 
removed directory: `out/target/product/xxx/system/xxx/xxx'

Does anyone know how to fix this?

Robin
  • 10,052
  • 6
  • 31
  • 52
  • What are you actually trying to accomplish? I very much doubt `$(shell rm ...)` in the makefile is the best choice. – Magnus Bäck Jul 08 '14 at 06:10
  • It is simple to copy/remove a folder, at least simpler than writing a large file list and call something like LOCAL_COPY_FILES – Robin Jul 08 '14 at 06:48
  • Yes, it's probably simpler, but it's not correct and will sooner or later get you in trouble. – Magnus Bäck Jul 08 '14 at 07:35
  • Understand the risk, however, is there any simple method to copy a large folder with thousands of files to the target? – Robin Jul 08 '14 at 08:16
  • Sure, you can e.g. use `PRODUCT_COPY_FILES` and generate the list of files to copy with the help of `$(wildcard ...)` or `$(shell find ...)`. – Magnus Bäck Jul 08 '14 at 10:37

1 Answers1

2

That simply isn't possible with GNU Make, because the output of $(shell ) is always expanded in a way that replaces newlines with spaces. This is intentional by the way.

Generally speaking, doing any kind of changes on the filesystem with $(shell ...) commands is a bad idea, because some of these changes will not be visible to GNU Make when it later tries to compute dependencies / which actions to run. This can result in unpredictable behaviour in certain cases.

Digit
  • 2,073
  • 1
  • 13
  • 10
  • Thanks for the comment, I fully agree with you, although my problem/question cannot be solved. Up vote for you. – Robin Jul 08 '14 at 08:15