This is an old post. However, I recently discovered the same problem, and I found an alternative based on @HEKTO's answer.
I use PETSc, a library for solving large sparse matrix systems. Their build system requires that you use "include" in your makefile, which depends on two environment variables: PETSC_DIR and PETSC_ARCH, which must be set in your environment .... or you can pass them as parameters to your make command! this is what i did.
I took the makefile generated by NetBeans and at the very end I added that include:
include ${PETSC_DIR}/conf/variables
Note how this depends on the definition of PETSC_DIR. In addition, this includes massive use of this and PETSC_ARCH throughout.
So now in NetBeans I am setting it up to pass these variables: Tools-> Options: On the Project Settings tab, I fill out the Make Settings text box: PETSC_DIR = / path / to / petsc PETSC_ARCH = some-arch
In addition, now you can start using these environment variables (and others defined in $ {PETSC_DIR} / conf / variables in your project options. For example, for my included files I do (right-click on the project, then "Properties" )): In the section "Compiler C", "Include Directories" I put: $ {PETSC_DIR} / include
And under "Linker", "Libraries" I put: $ {PETSC_LIB} (defined in the include file above).
Now I can create and run my project from NetBeans. If my version of PETSc changes, I only need to change the definition of the variables passed to make, and everything else will be allowed.
Hope this can help someone. It definitely worked for me. And the nice part is that I can pass my code to other people, and they can be compiled from the command line using "make" as usual (without NetBeans) and defining the above environment variables. Compilation now has no hard-coded paths.