Makefile help (libraries maintenance)

Makefile help (libraries maintenance)

Post by Max Heffl » Sat, 21 Apr 1990 06:22:44



We have been successfully using recursive Makefiles for many libraries and
executables from many different directories.  We enhanced the scheme to use
sublibraries to minimize the time spent archiving especially on slow CPU's
with 1000 module libraries.  The sublibrary enhancement reduced our time on
one platform from 24 hours to 8 hours.  We would like to avoid the sublibrary
scheme altogther; however, we keep running into make's limitations, or our
misunderstandings of make.  We now would like to build each object (source
and object in different directories) without archiving until the end of all
of the compilation for that library.  The .c.o rule seems to imply that the
source and objects are in the same directory, so we attempted to specify each
object on a separate dependency line (even those with no depencies) but could
not take advantage of a common compile line.  Is there a way to do this?

P.S. Where is the public domain source for Berkeley make kept for anonymous
      ftp?

Thanx in advance...
--

Landmark Graphics Corp.         uucp: ..!uunet!lgc!max
333 Cypress Run, Suite 100      phone: (713) 579-4751
Houston, Texas  77094

 
 
 

Makefile help (libraries maintenance)

Post by Edward Vielmet » Sun, 22 Apr 1990 00:25:08


   P.S. Where is the public domain source for Berkeley make kept for anonymous
         ftp?

Try uunet.uu.net:/bsd-sources/src/bin/make.tar.Z, with a date of March
24 1989.

Unfortunately there's very little of this make that's unentangled by AT&T
copyright, i.e.

ftp> get make.tar.Z "|zcat | tar vtf -"
200 PORT command successful.
150 Opening ASCII mode data connection for make.tar.Z (1778 bytes).
rwxrwxr-x  3/10      0 Jan 28 14:39 1989 make/
r--r--r--  3/10   1563 Jan 28 14:36 1989 make/files.c.diff
r--r--r--  3/10    803 Jan 28 14:39 1989 make/main.c.diff

The only free make that I know of is GNU make, from your local home of
GNU software (prep.ai.mit.edu or tut.cis.ohio-state.edu).  The
relevant newsgroup is gnu.utils.bug.

--Ed

Edward Vielmetti, U of Michigan math dept.


 
 
 

Makefile help (libraries maintenance)

Post by Leo de W » Sun, 29 Apr 1990 17:55:26


|We have been successfully using recursive Makefiles for many libraries and
|executables from many different directories.  We enhanced the scheme to use
|sublibraries to minimize the time spent archiving especially on slow CPU's
|with 1000 module libraries.  The sublibrary enhancement reduced our time on
|one platform from 24 hours to 8 hours.  We would like to avoid the sublibrary
|scheme altogther; however, we keep running into make's limitations, or our
|misunderstandings of make.  We now would like to build each object (source
|and object in different directories) without archiving until the end of all
|of the compilation for that library.  The .c.o rule seems to imply that the
|source and objects are in the same directory, so we attempted to specify each
|object on a separate dependency line (even those with no depencies) but could
|not take advantage of a common compile line.  Is there a way to do this?

I understand you want two things, that aren't directly related:
a) postpone archiving until each object of the library has been made.
b) separate source and object files in different directories.

Ad a): This is what we do here too, it saves considerable time & CPU
cost.  In a BSD environment you can do an 'ar q' to quickly build the
archive(s) (I think it works for System V too, at least on our Pyramid).
Say your target executable needs libraries $(LIB_a), $(LIB_b) etc.
which contain respectively $(OBJECTS_a), $(OBJECTS_b) etc., a rule to
build say $(LIB_a) would be

$(LIB_a) : $(OBJECTS_a)



The rule to build the final target would look something like:

$(TARGETPROG) : main.o $(LIB_a) $(LIB_b)

By always doing a complete rebuild of each library, one avoids the
quadratic behaviour that can result from 'ar'-ing each module
separately. In the complete rebuild case ar is started only once and
each module put at the end of the archive (without checking whether it
already exists). In the separate rebuild case the archive has to be
read and written (almost entirely) each time.

b) A solution for this could be to dynamically generate the Make
dependencies and rules, then pass them to Make, something like this:

CDIR = /usr/me/srcdir
ODIR = /usr/me/objdir
SOURCES = myfile1.c myfile2.c # or perhaps *.c
OBJECTS = `echo $(SOURCES)|sed "s^\([^ ]*\)\.c^$(ODIR)/\1.o^g"`

make_objects :
        (cd $(CDIR); ls $(SOURCES))|\

        (echo all : $(OBJECTS); cat)|\
        $(MAKE) $(MFLAGS) -f -

Note that the $(OBJECTS) are full pathnames in this case and generated
dynamically from the $(SOURCES) list.

    Leo.

 
 
 

1. Help on Makefiles and using/maintaining user libraries

I've tried to understand enough about Makefile(s).  Read everything I can
find.  But now I'm dazed and confused.  What Im trying to do is generate
a makefile that makes the necessary files / librarys as follows:

        ../dir1/libcommon.a    is used by and is created from files in

        ../dir1/dir_a
        ../dir1/dir_b
        ../dir1/dir_c
        ../dir1/dir_d   etc

In each of these directories is a program file that needs ../dir1/libcommon.a
and is a source file (C or Fortran) that is complied and include in the
libcommon.a    Also included in libcommon.a is ../dir1/xy.c

So.  A Makefile in ../dir1/dir_b to make the executable bx depends on the
file ../dir1/dir_b/bsx.c and on the librarys ../dir1/libcommon.a and on
additional user libraries that don't change, say, /usr/local/lib/libabcd.a

        ../dir1/libcommon.a   depends on;

        ../dir1/xy.c
        ../dir1/dir_a/as.c
        ../dir1/dir_b/bs.c
        ../dir1/dir_c/cs.f
        ../dir1/dir_d/ds.f

What Makefile would properly make bx when in ../dir1/dir_b?

I hope that clearly defined the problem.  Any help would be appreciated.

2. Where can I download Lynux from?

3. GNU Make: Makefile for a library

4. building modules on redhat 7.2 debug kernel

5. Makefile for libraries

6. Allow 2.5.48 IDE to compile w/o DMA

7. Non ar library support in makefiles

8. Any Suggestions for SCSI card and tape drive

9. library makefile problem ?

10. How to force Makefile to *NOT* link a library?

11. Shared library in makefile

12. Makefile keep rebuilding libraries even when nothing needs to be done!

13. Q: makefile with objects in library