Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove the last trailing (back)slash in gnu make file?

I want to write a make file to compile my source code. I have to put in my make file the includes paths but i have a lot of folders with source codes. In make file i have a list with all .c files like this :

__MDA_SRC = \
$(__VIEWPATH)\f_03\test\mda\src\mda.c

now i need to find out the path of this file.

I tried this one :

__PATHS_FEATURE = \
$(dir $(__MDA_SRC ))

__INCLUDE_PATHES := \
-I$(__PATHS_FEATURE)

but i have an error F100: cannot open ...bla bla..

i supposed that the problem is on the path, because the path is extructed with the last backslash like: ..\..\..\..\..\f_03\test\mda\src\

How could i have the path without the last backslash like this : ..\..\..\..\..\f_02\hydraulic\btc\src

like image 498
pop rock Avatar asked Oct 14 '15 13:10

pop rock


1 Answers

That seems unlikely to be the problem to me but you can remove it with

$(__PATHS_FEATURE:\=)

or

$(patsubst %\,%,$(__PATHS_FEATURE))
like image 82
Etan Reisner Avatar answered Sep 17 '22 13:09

Etan Reisner