[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Faster build of librtemsall.a
- Date: 9 Dec 1999 01:29:25 -0500
- From: Ian Lance Taylor <ian@zembu.com>
- Subject: Faster build of librtemsall.a
The code which builds librtemsall.a turns out to be fairly slow. In
an environment like ours, where we rebuild RTEMS as part of routine
build of our code, this slows down our builds.
The main problem is that the current code rewrites the archive using
ar ru. That forces ar to copy the entire archive for each included
archive. In our case the archive is 19MB, so this is not an
inconsequential operation.
Here is a patch to build the library more quickly, by building it only
once. I had to include the odd handling of .o files because
rtems-ctor appears in SRCS, and it also stored in the archive for at
least the posix BSP. The old code did not notice the duplication. I
decided to simply permit the duplication rather than try to figure out
what the right thing to do is for that case.
Ian
Index: c/src/lib/wrapup/Makefile.in
===================================================================
RCS file: /home/cvsfiles/devo/rtems/c/src/lib/wrapup/Makefile.in,v
retrieving revision 1.1.1.3
diff -c -r1.1.1.3 Makefile.in
*** Makefile.in 1999/06/01 18:33:01 1.1.1.3
--- Makefile.in 1999/12/09 06:26:20
***************
*** 37,86 ****
$(wildcard $(PROJECT_RELEASE)/lib/rtems-ctor$(LIB_VARIANT).o) \
$(wildcard $(PROJECT_RELEASE)/lib/libno-ctor$(LIB_VARIANT).a)
! CLEAN_ADDITIONS += $(ARCH)/check
CLOBBER_ADDITIONS +=
all: $(ARCH) $(LIB)
install: all
! $(ARCH)/check:: $(SRCS)
! @$(RM) $@; touch $@;
! @for f in $(SRCS); do \
case $$f in \
! *.o) echo " `basename $$f`" >> $@ \
;; \
- *.rel) echo " `basename $$f`" >> $@ \
- ;; \
- *.a) \
- ( list=`$(AR) t $$f`;\
- for i in $$list; do \
- if fgrep " $$i" $@; then \
- echo "ERROR -- $$i in multiple files"; exit 1; \
- fi;\
- echo " $$i" >> $@;\
- done; ) \
- ;; \
- esac; \
- done;
-
- $(LIB):: $(ARCH)/check
- @for f in $(SRCS); do \
- case $$f in \
- *.o) $(AR) ru $@ $$f \
- ;;\
- *.rel) $(AR) ru $@ $$f \
- ;;\
*.a) \
(cd $(ARCH); \
! list=`$(AR) t $$f`; \
! $(AR) x $$f $$list; $(AR) ru $@ $$list; \
! $(RM) $$list ;)\
;; \
esac; \
! done;
! @$(RANLIB) $@
! @echo "*** Glommed $@"
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
--- 37,78 ----
$(wildcard $(PROJECT_RELEASE)/lib/rtems-ctor$(LIB_VARIANT).o) \
$(wildcard $(PROJECT_RELEASE)/lib/libno-ctor$(LIB_VARIANT).a)
! CLEAN_ADDITIONS +=
CLOBBER_ADDITIONS +=
all: $(ARCH) $(LIB)
install: all
! $(LIB):: $(SRCS)
! rm -f $@
! rm -rf $(ARCH)/*
! for f in $(SRCS); do \
case $$f in \
! *.o | *.rel) \
! if test -f $(ARCH)/`basename $$f`; then \
! if cmp $$f $(ARCH)/`basename $$f`; then \
! true; \
! else \
! echo 1>&2 "ERROR -- `basename $$f` in multiple files"; \
! exit 1; \
! fi; \
! else \
! cp $$f $(ARCH)/; \
! chmod a-w $(ARCH)/`basename $$f`; \
! fi; \
;; \
*.a) \
(cd $(ARCH); \
! $(AR) x $$f; \
! test $$? -eq 0 || exit 1; \
! chmod a-w *; ) \
;; \
esac; \
! done
! $(AR) rc $@ $(ARCH)/*
! rm -f $(ARCH)/*
! $(RANLIB) $@
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \