2010-06-14

Handling path with white-spaces in a makefile

Handling path with white-spaces in a makefile is a bit awkward. Here is an example of how to get the path to the makefile it self, independent of the path containing white-spaces or not.


#######################################
# Find the project root directory
#######################################
PWD                       := $(shell pwd)
nullstring :=               # creating a null string
space := $(nullstring) # end of the line

MAKEFILE_DIR := $(subst $(space),\ ,$(PWD))

1 comment:

  1. Its not working with the Makefile Script...:(
    Sad..:(

    ReplyDelete