diff options
author | David 'Digit' Turner <digit@google.com> | 2011-09-15 17:07:59 +0200 |
---|---|---|
committer | David 'Digit' Turner <digit@google.com> | 2011-09-21 17:14:26 +0200 |
commit | 8d06600aad07ddf7b6f80c0242269e0e44b3d99a (patch) | |
tree | 9029a01f118d6b98a3236907349e27b9417739e7 | |
parent | 533591775b30ed76d9f1b1aaa12f9b330e1d0318 (diff) | |
download | ndk-8d06600aad07ddf7b6f80c0242269e0e44b3d99a.tar.gz |
Simplify non-Cygwin source compiles.
We don't need to rename the auto-generated dependency file when
we're not running inside Cygwin, so simplify operations.
In other words, before this patch, we would compile a source file
on Unix with something like:
gcc -c -MF foo.d.org -o foo.o foo.c &&
mv foo.d.org foo.d
Now we will simply do:
gcc -c -MF foo.d -o foo.o foo.c
Compilation on Cygwin isn't changed.
This makes the build commands dumped with V=1 easier to read.
Change-Id: Ic6f256ecb779de6c75ff940a1f14680bfd87127b
-rw-r--r-- | build/core/definitions.mk | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/build/core/definitions.mk b/build/core/definitions.mk index 9b9e16ca4..8e23e3725 100644 --- a/build/core/definitions.mk +++ b/build/core/definitions.mk @@ -928,29 +928,35 @@ endif # cmd-convert-deps # -# Commands used to copy/convert the .d.org depency file generated by the -# compiler into its final .d version. +# On Cygwin, we need to convert the .d dependency file generated by +# the gcc toolchain by transforming any WIndows paths inside it into +# Cygwin paths that GNU Make can understand (i.e. C:/Foo => /cygdrive/c/Foo) # -# On windows, this myst convert the Windows paths to a format that our -# Cygwin-based GNU Make can understand (i.e. C:/Foo => /cygdrive/c/Foo) +# To do that, we will force the compiler to write the dependency file to +# <foo>.d.org, which will will later convert through a clever Awk script. # -# On other platforms, this simply renames the file. +# The result will be written to <foo>.d and <foo>.d.org erased. +# Note that it is important to use different file names here. +# +# +# On other systems, we simply tell the compiler to write to the .d file directly. # # NOTE: In certain cases, no dependency file will be generated by the # compiler (e.g. when compiling an assembly file as foo.s) # +# convert-deps is used to compute the name of the compiler-generated dependency file +# cmd-convert-deps is a command used to convert it to a Cygwin-specific path +# ifeq ($(HOST_OS),windows) +convert-deps = $1.org cmd-convert-deps = \ - ( if [ -f "$1.org" ]; then \ + && ( if [ -f "$1.org" ]; then \ $(HOST_AWK) -f $(BUILD_AWK)/convert-deps-to-cygwin.awk $1.org > $1 && \ rm -f $1.org; \ fi ) else -cmd-convert-deps = \ - ( if [ -f "$1.org" ]; then \ - rm -f $1 && \ - mv $1.org $1; \ - fi ) +convert-deps = $1 +cmd-convert-deps = endif # This assumes that many variables have been pre-defined: @@ -971,7 +977,7 @@ $$(_OBJ): PRIVATE_CFLAGS := $$(_FLAGS) $$(_OBJ): $$(_SRC) $$(LOCAL_MAKEFILE) $$(NDK_APP_APPLICATION_MK) @mkdir -p $$(dir $$(PRIVATE_OBJ)) @echo "$$(PRIVATE_TEXT) : $$(PRIVATE_MODULE) <= $$(notdir $$(PRIVATE_SRC))" - $(hide) $$(PRIVATE_CC) -MMD -MP -MF $$(PRIVATE_DEPS).org $$(PRIVATE_CFLAGS) $$(call host-path,$$(PRIVATE_SRC)) -o $$(call host-path,$$(PRIVATE_OBJ)) && \ + $(hide) $$(PRIVATE_CC) -MMD -MP -MF $$(call convert-deps,$$(PRIVATE_DEPS)) $$(PRIVATE_CFLAGS) $$(call host-path,$$(PRIVATE_SRC)) -o $$(call host-path,$$(PRIVATE_OBJ)) \ $$(call cmd-convert-deps,$$(PRIVATE_DEPS)) endef |