On Sat, May 03, 2014 at 10:23:58AM +0200, Roberto E. Vargas Caballero wrote:
> Hi,
> 
> I have the following simple Makefile:
> 
>       CPPFLAGS = -I../inc
> 
>       all: libcc.a
> 
>       libcc.a: libcc.a(die.o) libcc.a(xcalloc.o) libcc.a(xmalloc.o)
> 
>       clean:
>               rm -f *.o *.a
> 
> which should generate a static library using a default rule. This Makefile
> works in another systems, and it is accepted by POSIX standards [1]. The
> rule in /usr/share/mk/sys.mk is:
> 
>       .c.a:
>               ${COMPILE.c} ${.IMPSRC}
>               ${AR} ${ARFLAGS} $@ $*.o
>               rm -f $*.o
> 
> but when I run make I get this output:
> 
>       $ make
>       cc -O2 -pipe  -I../inc -c die.c
>       cc -O2 -pipe  -I../inc -c xcalloc.c
>       cc -O2 -pipe  -I../inc -c xmalloc.c
> 
> Anyone could point me what is the problem?

We don't have any rules that actually handles archive members in the
default setup.

The rule you quote would only work for creating an archive based on a
single c file.

There is nothing in the posix description that says anything about default
rules to recreate archives.

Your "posix system" is using an extended set of rules to create libraries.

(note that the rule above is fairly useless obviously, but it's what's
mandated by posix...)

Reply via email to