Noeud:Linking, Noeud « Next »:And Finally..., Noeud « Previous »:Assembling, Noeud « Up »:Pulling it Together
Finally, we're ready to link the files together to produce a final
binary. This involves taking the object files and glueing them together
with the M4 library, libm4.so
to produce a binary that we
can run. To make sure that your M4 libraries are visible, point
them to your lib
directory:
export LD_LIBRARY_PATH
LD_LIBRARY_PATH=$HOME/gnu-src/m4-1.5/m4/.libs:$LD_LIBRARY_PATH
Finally, run the object files through gcc
:
gcc -DHAVE_CONFIG_H -I. -I.. -I../m4 main.o freeze.o stackovf.o
temp.o -L`cd ../m4/.libs && pwd` -lm4
which produces the executable a.out
. Let's just test it:
$ ./a.out --version GNU (null) (null) Written by Rene' Seindal and Gary V. Vaughan. Copyright 1989-1994, 1999, 2000 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $