help-make
[Top][All Lists]
Advanced

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

RE: serial vs parallel for ar


From: Paul D. Smith
Subject: RE: serial vs parallel for ar
Date: Thu, 18 May 2006 11:11:37 -0400

%% "PATTON, BILLY \(SBCSI\)" <address@hidden> writes:

  pb> Here is the skeleton of what I'm doing
  pb> # create a .a file  empty
  pb> AR_CREATE = if [ ! -f $(PRD_TREE)/$(1)/$(2)/lib/lib$(2).a ] ; then \
  pb>                 $(AR) $(AR_CREATE_OPT)
  pb> $(PRD_TREE)/$(1)/$(2)/lib/lib$(2).a ; \
  pb>                 $$(CHMOD) $(PRD_TREE)/$(1)/$(2)/lib/lib$(2).a ; \
  pb>             fi

  pb> # add a file to a archive
  pb> AR_ADD = $(NM) $@ | grep "main.*extern|entry.*CODE" > /dev/null ; \
  pb>         if [ $$? -ne 0 ] ; then $(AR) $(AR_OPT) $(LIB) $@ > /dev/null ;
  pb> fi

  pb> # short hand to create dependencies
  pb> MKDEP = $(MAKEDEPEND) -proj $(1) -bb $(2) -ifile $$< $$(INCLUDE)

  pb> # compile .c files to .o
  pb> COMP_CC = @$$(CC) $$(CCFLAGS) $$(INCLUDE) -o $$@ -c $$< ; \
  pb>         $(MKDEP) ; $(AR_CREATE); $$(AR_ADD)

I don't understand why you want to put .o's into the archive one at a
time.  Why not do it the same way the linker does, and have only one
invocation of "ar"?  That is the easy way to make sure you don't have
conflicts even with -j, and it will even be more efficient since you
have only one invocation of ar instead of one per .o.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

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