For example, I have a variable that holds a list of dependencies
BOARDS:=lance.mcm light.mcm sac.mcm
I need another variable named NET such that
NET:=lance.net light.net sac.net
It should be set such that when I change the BOARDS variable, NET should change as well. For example, if I add a new zor.mcm into the BOARDS variable, it should automatically add zor.net into the NET variable.
Well on a Linux machine it usually doesn't have an extension at all - it's just "makefile" or "Makefile". You can call it anything you want and use the -f option to tell "make" which to use. If your text editor can't save a file called Makefile , use a better text editor.
NOTE: The term "Makefile" typically refers to a file named Makefile, which is used to build source code into an executable program. This type of file does not have a file extension.
A variable is a name defined in a makefile to represent a string of text, called the variable's value. These values are substituted by explicit request into targets, prerequisites, commands, and other parts of the makefile. (In some other versions of make , variables are called macros.)
As an alternative:
BOARDS:=lance.mcm light.mcm sac.mcm
NET:= $(addsuffix .net, $(basename $(BOARDS)))
This will preserve contents inside the file pathnames should they match pattern
The best solution I have found is to use this syntax:
NET:=$(BOARDS:.mcm=.net)
This will look at BOARDS and change the .mcm into .net
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With