help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

too many .o files in a directory


From: John Stoffel
Subject: too many .o files in a directory
Date: Tue, 2 May 2006 17:07:42 -0400

Hi,

I've got some users who do Simulations of chips using the Synopsys
tools.  It's pretty silly because they have a makefile which dumps
(in this example) 7900+ .o files into a single directory.  It then
tries to compile them all into a single binary.

It builds a single filelist file that's 760+ lines, 8300+ words in
size in the format:

  VCS_OBS =5NrI_d.o 5NrIB_d.o lOsn_1_d.o ... \
     .... \
     .... \

which just causes problems.

The compile and final link works sometimes, but fails other times
because the argument list passed by make is too long, it hits the
ARGS_MAX limit on linux.  This works just fine on Solaris since
they're limit is around 2mb, while on Linux it's just 128k.

The files are all in the form of [a-zA-Z0-9]*.o, so I figured I could
just write some intermedia rules to build some .a libs to hold
collections of files, and then just link them all together into the
final binary.

So I've been trying to write a rule like this:

    Alib(A*.o): A*.o
            ar cf Alib A*.o

or maybe something like this:

    AFlib([A-F]*.o): [A-F]*.o
            ar cf AFlib [A-F]*.o

so create a static library, which I could them link in later on.  I'd
like to modify (programatically and automatically somehow) the
following Makefile to split up the final link into smaller chunks,
ideally (I think) of smaller libraries that are linked as needed.

But I can't seem to make this work properly for some reason. 

Thanks for any hints,
John
    John Stoffel - Senior Staff Systems Administrator - System LSI Group
  Toshiba America Electronic Components, Inc. - http://www.toshiba.com/taec
             address@hidden - 508-486-1087


-----------------------------------------------------------------------

# Makefile generated by VCS to build your model
# This file may be modified; VCS will not overwrite it unless -Mupdate is used

# define default verilog source directory 
VSRC=/path/to/model

# Note: if make gives you errors about include, either get gmake, or
# replace the following line with the contents of the file filelist,
# EACH TIME IT CHANGES
# included file defines OBJS, and is automatically generated by vcs
include filelist

# Choose name of executable 
PRODUCTBASE=$(VSRC)/./vcs.exe

PRODUCT=$(PRODUCTBASE)

# Product timestamp file. If product is newer than this one,
# we will also re-link the product.
PRODUCT_TIMESTAMP=product_timestamp

# Path to runtime library
CMODLIB=
RUNTIME=/path/to/vcs7.2/linux/lib/libvcsnew$(VCS_LIBEXT).so

# Select your favorite compiler

# Linux:
VCS_CC=gcc

# User overrode default CC: 
VCS_CC=gcc
# Partial linking
LD_PARTIAL=ld -r -o
# Loader
LD=$(CC)
# Loader Flags
LDFLAGS= 

# C run time startup
CRT0=
# C run time startup
CRTN=
# Machine specific libraries
SYSLIBS=-ldl -lm -lm  -lc -ldl

# Default defines
SHELL=/bin/sh

VCSTMPSPECARG=
VCSTMPSPECENV=
# NOTE: if you have little space in /tmp, but plenty in /foo,
#and you are using gcc, uncomment the next line
#VCSTMPSPECENV=TMPDIR=/foo

TMPSPECARG=$(VCSTMPSPECARG)
TMPSPECENV=$(VCSTMPSPECENV)
CC=$(TMPSPECENV) $(VCS_CC) $(TMPSPECARG)

# C flags for compilation
CFLAGS= -pipe "-O3" -O -I/tools/synopsys/vcs7.2/include   

LIBS=/path/to/vcs7.2/gui/virsim/linux/vcdplus/vcs7_2/libvirsim.a 
/path/to/verdi_54v8/share/PLI/vcs/LINUX/pli.a 
/path/to/another/bin/vpi/Linux/seinevpi.so 
DOTLIBS=/path/to/vcs7.2/gui/virsim/linux/vcdplus/vcs7_2/libvirsim.a 
/path/to/verdi_54v8/share/PLI/vcs/LINUX/pli.a 
/path/to/another/bin/vpi/Linux/seinevpi.so 

product : $(PRODUCT_TIMESTAMP)
        @echo $(PRODUCT) up to date

objects : $(OBJS)

clean   :
        rm -f $(VCS_OBJS)

clobber : clean
        rm -f $(PRODUCT) $(PRODUCT_TIMESTAMP) 

$(PRODUCT_TIMESTAMP) : $(PRODUCT)
        -if [ -x $(PRODUCT) ]; then chmod -x $(PRODUCT); fi
        $(LD) $(CRT0) -o $(PRODUCT) $(LDFLAGS) $(OBJS) $(LIBS)   $(CMODLIB) 
$(RUNTIME)     $(SYSLIBS) $(CRTN)  
        @touch $(PRODUCT_TIMESTAMP)

$(PRODUCT) : $(OBJS) $(DOTLIBS) $(CMODLIB)  $(RUNTIME) 
        @touch $(PRODUCT)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]