🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Michael Joosten Sat, 05 Sep 1992 18:49
Lazy archiving with GNU make
#737
Author: Michael Joosten
Date: Sat, 05 Sep 1992 18:49
74 lines
3371 bytes
Hello,

I've stumbled now for days to teach make-3.62 a "lazy archiving" style. I know
that the default rule "(%): %" works like a charm, but....

The situation is as follows: sources are on a (normally overloaded) NFS
server, source type is C++ for cfront -> HUGE objects with -g and I want to
avoid letting unused ".o" files lying around. The problem with the default
rule is that it runs "ar" after every compilation instead of waiting until all
objects are made and "ranlib" is triggered. The library is ca. 2MB large and
each ".o" has 100-200KB. Especially with the SGI Irix "ar" (System V, bah!)
the archiving of last files takes three times as much as the compilation
proper!

What I've in mind can easily achieved with a System V make:

.c.a:
        $(CC) -c $(CFLAGS) $<

libtest.a       : libtest.a(stacks.o) libtest.a(fifos.o) libtest.a(adt.o)
        ar rv $@ $?
        rm $?

libtest.a(fifos.o):     fifos.c
libtest.a(adt.o):       adt.c adt.h
libtest.a(stacks.o): stacks.c adt.h

An equivalent GNUmakefile looks like this:
(%.o): %.c
        $(CC) -c $(CFLAGS) $<

libtest.a       : libtest.a(stacks.o) libtest.a(fifos.o) libtest.a(adt.o)
        ar rv $@ $?
        rm $?


libtest.a(fifos.o):     fifos.c
libtest.a(adt.o):       adt.c adt.h
libtest.a(stacks.o): stacks.c adt.h

But this does not work due to two reasons:
1) $? is evaluated to "libtest.a(adt.o) libtest.a(stacks.o)" instead of
   "adt.o stacks.o". Furthermore, this violates POSIX .2 and XPG4.

2) Even if I would fix this bug, GNU make apparently tries to be very fussy
   because the second rule is not run at all! Seems that make checks if the
   library has been modified (mtime?) - a "make -n" at least *prints* the
   "ar" command.

While the first bug seems to be easy to fix (set_file_variables() in
commands.c), I'm not sure if the latter is deliberate decision or a glitch.

I don't want to use SysV-make, because the subsystem is supposed to run on a
variety of platforms and I need some other features like a working VPATH (hear
me, Sun? 8-). 

Or does anybody have a good workaround (except keeping the objects lying
around?) Help !!

Michael




--
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Michael Joosten   |       Tel.  : (+49) (+) 5251-284 120                 |
| CADLAB            |       Fax   : (+49) (+) 5251-284 140                 |
| Bahnhofstr. 32    |       E-Mail: joost@cadlab.de                        |
| D-4790 Paderborn  |        	    ...!uunet!unido!cadlab!joost           | 
| FRG               | Mass mail to: joost@pbinfo.uni-paderborn.de          |
|--------------------------------------------------------------------------|
| CADLAB is a cooperation between Uni-GH Paderborn & SNI AG                |
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads