tags:

views:

130

answers:

1

Hi, How to write make file in c. what is advantage of using rcv & ranlib attribute. Please describe it.

LIBTARGET= myfile.a 

$(LIBTARGET): $(LIBOBJS)
    $(AR) rcv $(LIBTARGET) $?
    ranlib $(LIBTARGET)

Can any body describe why we use rcv & ranlib.

thanks in advance.

A: 

To one of your previous attempts to ask this question I already wrote about ar and ranlib.

ar creates an archive (library in C is an archive), as $(AR) variable usually points to ar.

rcv are ar parameters (see man ar for details).

ranlib creates index on the archive. You cannot use unindexed archive as a library.

qrdl