This one has to be quick folks. The family needs my support this evening ;)
In the last episode, we created a simple configure.ac and defined a variable, CSC. We didn’t change the Makefile other than re-naming it to Makefile.am. In this article, we’ll simply show how to consume the variable which was defined in configure.ac.
Return to our workplace
$ cd ~/src/greeting
Alter Makefile.am to use the C# compiler defined in configure.ac
$ sed -e 's/gmcs/\$\(CSC\)/' Makefile.am
$ cat Makefile.am
# the first target is the one executed when no target is named
all: Greeting.exe
#don't do anything
# running 'make clean' will execute this target
clean:
rm Greeting.exe
# running 'make Greeting.exe' will execute this target
Greeting.exe: Greeting.cs NDesk.Options.cs
# the same as $(CSC) -out:Greeting.exe Greeting.cs
$(CSC) -out:$@ $^
Prove that it didn’t break things
$ automake && ./configure
$ make clean
cd . && /bin/sh /home/cjac/src/greeting/missing --run automake-1.10 --gnu Makefile
cd . && /bin/sh ./config.status Makefile
config.status: creating Makefile
rm Greeting.exe
$ make
/usr/bin/gmcs -out:Greeting.exe Greeting.cs NDesk.Options.cs
$ ./Greeting.exe ––number 9
Greetings, Pluto!
Conclusion
That’s all I’ve got time for right now. Zelda’s crying for daddy!