Mail Archives: djgpp/1996/11/09/16:48:52
godzilla wrote:
>
> Hi everyone !
> I hope my question isn't too stupid, but how can i compile a library ?
> one more question: where can i find information about makefiles (or GNU-make
> and what it does) ?
Use the 'ar' program, documented in the DJGPP info docs. Basically,
compile your code into object (.o) files, use 'ar' to turn them into a
library, and then link the library when you compile your programs.
Example:
gcc -c myfunc1.c myfunc2.c myfunc3.c myfunc4.c
ar rvs libmylib.a myfunc1.o myfunc2.o myfunc3.o myfunc4.o
gcc -o myprog.exe myprog.c -lmylib
As for makefiles, the best way to learn is to get Make (in
v2gnu/mak375b.zip), and use it with a program that already has a
makefile. Watch what the output is, then look at the makefile to see
why it does what it does. Refer to the make documentation that comes
with the distribution to look up critical concepts - the docs are very
well written. If you like, I can send you an example makefile to build
a project, together with comments on what each part is for.
P.S.: To read the documentation, you must have installed the
v2gnu/txi390b.zip package which contains the 'info.exe' hypertext
documentation viewer.
--
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I | fighteer AT cs DOT com |
| * Proud user of DJGPP! * | http://www.cs.com/fighteer |
| ObJoke: If Bill Gates were a robber, not only would he |
| shoot you, but he'd send you a bill for the bullets. |
---------------------------------------------------------------------
- Raw text -