I am trying to compile a static library. I followed the steps which were given in an answer to this question but it is not working. Following is my makefile.
PROJECT = lq.a
OBJECTS = dlmalloc.o queue.o.o
CFLAGS = -o -Wall -pedantic
all: $(PROJECT)
.c.o:
gcc -c $(CFLAGS) $<
$(PROJECT): $(OBJECTS)
libtool -o $(PROJECT) -static $(OBJECTS)
And I get the following error.
libtool: unrecognized option `-o'
What is the correct way of writing this makefile?
You can use the program
arto create static libraries using the following syntax:So, in your case:
You can find an explanation of the options on the man page, but basically:
rsays insert the given object files in to the archive (replacing any older versions of the same thing)csays create the archive if it isn’t already there (normally this happens anyway, but this option suppresses the warning).ssays to write an object-file index into the archive.