help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Search string pattern in make


From: John Graham-Cumming
Subject: Re: Search string pattern in make
Date: Tue, 10 Jul 2007 16:57:20 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040208 Thunderbird/0.5 Mnenhy/0.6.0.104

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

micron_make wrote:
> I have the following directory structure
> 
> C:\My_Modules\Module_Test1\source\src         (*.c)
>                                     \mak              (make file)     
> 
> I shall have similar directory structure with Module_Test2, Module_Test3
> etc.
> 
> In my make file I use $(abspath) to get the directory path of a particular
> type of file, whose relative path is known.
> files_path=$(abspath $(wildcard ../src/*.c))
> 
>>From the files_path variable I would like to filter out the pattern
> “/Module_ /”. (i.e the string beginning with a backslash, followed by the
> string “Module_” followed by any number of characters until the next
> backslash)
>  I need this because I would like to automatically fill some definitions in
> the make file. 

GNU Make does not have a function for doing this sort of regexp-based
modifications, so you are left with using patsubst to get what you want.

You could do:

    files_path := $(patsubst /Module_%,%,$(files_path))

that will eliminate the /Module_ part, and then you'd be forced to do:

   files_path := $(patsubst Test1/%,%,$(files_path))

to remove the Test1/ part, and so on.

John.



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGk55QLphrp73n/hARAjIrAKCWkTCW0OFDF3gKOkwUAjDZdd0vyACcCg/1
ezZz4+lm5JDtGZtmMhWlQUc=
=ragA
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]