Noeud:And Finally..., Noeud « Previous »:Linking, Noeud « Up »:Pulling it Together



And Finally...

That all seemed like a lot more work than we really needed. In fact, it was a lot more work; we could have simply called

gcc -DHAVE_CONFIG_H -I. -I.. -I../m4 main.c freeze.c stackovf.c temp.c -L`cd ../m4/.libs && pwd` -lm4

which would have given us the same results, quicker than having to produce assembler sources, and then passing these on to the assembler, and so on.

In fact, we cheated from the start. M4 had to be built (so that the libraries were all in place, produced from the m4/m4 and m4/ltdl directories). All we did is go in and compile a few sources and link them with these libraries. A few things to note:

Is there an easier way?

Actually, there is, and it ties in to GNU Make, Autoconf, Automake and Libtool. GNU Make enables us to place all the information we need to build sources into neatly modularised make files. It saves us the hassle of typing in long-winded commands. Autoconf and automake enable us to configure and manage make files in a very simple fashion. Libtool makes library creation and management much simpler as well.