Wednesday, December 24, 2014

MAKEFILE built-in function

How to implement built-in function as below

Text-processing function

https://www.gnu.org/software/make/manual/html_node/Text-Functions.html#Text-Functions

$(patsubst %.c,%.o,x.c.c bar.c)

Result: ‘x.c.o bar.o’

$(sort foo bar lose)

Result:‘bar foo lose’

$(word 2, foo bar baz)

Result:‘bar’

Filename manipulate function

https://www.gnu.org/software/make/manual/html_node/File-Name-Functions.html

$(dir src/foo.c hacks)

Result:‘src/ ./’

$(notdir src/foo.c hacks)

Result:‘foo.c hacks’

$(suffix src/foo.c src-1.0/bar.c hacks)

Result:‘.c .c’

$(addprefix src/,foo bar)

Result:‘src/foo src/bar’

No comments:

Post a Comment

Register Transfer Level Design with Verilog (1) [ebook]

設計程式之所以有趣不外乎是它的千變萬化,同樣的結果卻有不同的寫法。 但這些不同寫法當中也並沒有分誰對誰錯,也沒有制定標準來規範何事該用何解。 這也就是我們設計者的珍貴!! [1] Primitive Instantiations 在Verilog中最基本的邏輯...