
November 9th, 2007, 11:14 PM
|
 |
Recovering Intellectual
|
|
Join Date: Jun 2006
Location: Orange County, CA
|
|
|
Other Language - GNU Make
If someone is familiar with GNU Make I could use some advice. Trying to develop our build process to include a great deal more automation is proving to be a challenge, but one area where we could use more of our potential is in the area of our Makefiles.
Unbeknownst to me, GNU Make gives you the ability to access string manipulation functions as part of their standard library. Trying to make them work however isnt so easy. In the following code, I call the $(basename 'filename') function, which takes a filename and returns, in place (much like variable substitution) the result of the filename without any extensions. That would be everything up to the last period in the filename.
This function works fine if its provided a string in this form: "string". However, in my example, where I am using an iterator as the filename, I get no luck. Whats returned from the function is the full filename itself, not the basename. Could anyone shed some light on this or perhaps a workaround?
The code:
Code:
BIN=$(HOME)/bin
clean clobber all:
for i in *.c; do \
gcc $$i ; \
mv a.out $(BIN)/$(basename $$i) ; \
done
__________________
Bugs that go away by themselves come back by themselves
Never take life seriously, Nobody gets out alive anyway.
|