Search code examples
pythonmakefilecygwin

Calling python script in makefile run in Cygwin results in No Such File or Directory


I am executing a Makefile in CYGWIN on Windows. The rule in the makefile calls a python script in another directory and passes arguments.

Here is the rule in the makefile:

$(OUTDIR)/toolchain:
    $(NDK_PATH)/build/tools/make_standalone_toolchain.py  \
        --api=24    \
        --arch=arm64    \
        --install-dir=$@    \
        --verbose=2

The output when I run the makefile in Cygwin I get the following error:

C:/Android/Sdk/ndk/25.1.8937393/build/tools/make_standalone_toolchain.py  \
        --api=24    \
        --arch=arm64    \
        --install-dir=/c/Projects/master/thirdparty/builds/android-arm64-v8a-release/toolchain    \
        --verbose=2
python3: can't open file '/c/Projects/master/thirdparty/C:/Android/Sdk/ndk/25.1.8937393/build/tools/make_standalone_toolchain.py': [Errno 2] No such file or directory
make: *** [target-config/android-arm64-v8a.mk:11: /c/Projects/master/thirdparty/builds/android-arm64-v8a-release/toolchain] Error 2

It seems to be combining the current working directory with the path that contains the python script and trying to run that, but of course this isn't working. How do I fix this?


Solution

  • Try the conversion to cygwin path :

    $(OUTDIR)/toolchain:
        $$(cygpath $(NDK_PATH)/build/tools/make_standalone_toolchain.py)  \
            --api=24    \
            --arch=arm64    \
            --install-dir=$@    \
            --verbose=2