3

Makefile function example

 1 year ago
source link: https://gist.github.com/weshouman/f44f330227972073371e1baa510c0d37
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Usage:

This is an example for a function myfn that:

  • Takes a local input file name FILE
  • Returns an abs_filename, created by using the global variable PATH

Notes:

  • We couldn't replace myfn with another make target as it wouldn't give us a clear return value
  • We had to use ($value ...) to avoid the unwanted expansion described in Eval Function and Value Function
  • When we miss the value function, we get "Missing Separator Stop error"
  • Commenting an ($eval ($call ... ) expression is not possible (even the syntax highlighting showed so -_-).
  • Use this way only if the function expression is complicated and needs multiple lines, otherwise, one could use filters and similar stuff

References:


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK