* Re: -j6 build
2010-08-24 16:07 -j6 build Mike Stump
@ 2010-08-30 16:52 ` Jean-Marc Saffroy
0 siblings, 0 replies; 2+ messages in thread
From: Jean-Marc Saffroy @ 2010-08-30 16:52 UTC (permalink / raw)
To: Mike Stump; +Cc: cgen
[-- Attachment #1: Type: text/plain, Size: 650 bytes --]
On 08/24/2010 06:33 AM, Mike Stump wrote:
> So, I have a cgen port and am wondering, is there anyway to speed up the 6 minute build that uses 1 core, to being a 1 minute build that uses 6 cores? -j8 didn't seem to do it.
>
FWIW setting CC="ccache gcc" and CFLAGS="-O0 -pipe" at configure time
did wonders for me (in addition to make -jN with N = 2 x number of
cores). Also I issue a single make command for all targets.
See attached makefile, which builds a complete toolchain (binutils, gcc,
newlib, and gcc for newlib).
Binutils (cgen, gas, ld, sim) now build in 36 seconds on my quad core
(44secs user, 34secs sys), with hot caches.
HTH,
JM
[-- Attachment #2: Makefile --]
[-- Type: text/plain, Size: 2802 bytes --]
# Makefile for the whole bare-metal C toolchain (binutils, gcc, newlib)
# arch name
target ?= xxx
TARGET ?= $(target)-elf
# install dir
DESTDIR = /tmp/$(target)
# build dirs
BUILDROOT = $(HOME)/build/$(target)
SRCBUILDDIR = $(BUILDROOT)/binutils
LIBBUILDDIR = $(BUILDROOT)/newlib
GCCELFBUILDDIR = $(BUILDROOT)/gccelf
GCCLIBBUILDDIR = $(BUILDROOT)/gcclib
# source dirs
GCCDIR = $(HOME)/gcc/src
SRCDIR = $(HOME)/cygnus/src
# build flags
BUILD_CC = ccache gcc
BUILD_CFLAGS = -g3 -O0 -Wall -pipe
SRCMAINT = --enable-maintainer-mode --enable-cgen-maint
GCCMAINT = --enable-maintainer-mode --enable-checking
LIBMAINT =
# misc
export PATH := $(DESTDIR)/bin:$(PATH)
NPROCS := $(shell getconf _NPROCESSORS_ONLN)
NJOBS := $(shell expr $(NPROCS) '*' 2)
TOUCH = touch
MK = make -j $(NJOBS)
all: gcclib-make
# binutils
binutils-configure:
mkdir -p $(SRCBUILDDIR)
cd $(SRCBUILDDIR) && \
CC="$(BUILD_CC)" CFLAGS="$(BUILD_CFLAGS)" \
$(SRCDIR)/configure --target=$(TARGET) $(SRCMAINT) --prefix=$(DESTDIR)
$(TOUCH) $@
binutils-make: binutils-configure
$(MK) -C $(SRCBUILDDIR) $(patsubst %,all-%,binutils gas ld sim)
$(MK) -C $(SRCBUILDDIR) $(patsubst %,install-%,binutils gas ld sim)
$(TOUCH) $@
# initial gcc
gccelf-configure: binutils-make
mkdir -p $(GCCELFBUILDDIR)
cd $(GCCELFBUILDDIR) && \
CC="$(BUILD_CC)" CFLAGS="$(BUILD_CFLAGS)" \
$(GCCDIR)/configure --target=$(TARGET) --prefix=$(DESTDIR) \
--enable-languages=c --disable-libssp --with-newlib
$(TOUCH) $@
gccelf-make: gccelf-configure
$(MK) -C $(GCCELFBUILDDIR)
$(MK) -C $(GCCELFBUILDDIR) install
$(TOUCH) $@
# newlib
newlib-configure: gccelf-make
mkdir -p $(LIBBUILDDIR)
cd $(LIBBUILDDIR) && \
CC="$(BUILD_CC)" CFLAGS="$(BUILD_CFLAGS)" \
$(SRCDIR)/configure --target=$(TARGET) $(LIBMAINT) --prefix=$(DESTDIR)
$(TOUCH) $@
newlib-make: newlib-configure
$(MK) -C $(LIBBUILDDIR) CC_FOR_TARGET=$(TARGET)-gcc \
all-target-newlib all-target-libgloss
$(MK) -C $(LIBBUILDDIR) CC_FOR_TARGET=$(TARGET)-gcc \
install-target-newlib install-target-libgloss
$(TOUCH) $@
# gcc for newlib
gcclib-configure: newlib-make
mkdir -p $(GCCLIBBUILDDIR)
cd $(GCCLIBBUILDDIR) && \
CC="$(BUILD_CC)" CFLAGS="$(BUILD_CFLAGS)" \
$(GCCDIR)/configure --target=$(TARGET) --prefix=$(DESTDIR) \
--enable-languages=c --disable-libssp --with-newlib \
--with-headers=$(DESTDIR)/$(TARGET)/include
$(TOUCH) $@
gcclib-make: gcclib-configure
$(MK) -C $(GCCLIBBUILDDIR)
$(MK) -C $(GCCLIBBUILDDIR) install
$(TOUCH) $@
# run gcc test suite
check: gcclib-make
$(MK) -C $(GCCLIBBUILDDIR)/gcc check \
RUNTESTFLAGS="--target_board=$(target)-sim $(RUNTESTFLAGS)"
tail $(GCCLIBBUILDDIR)/gcc/testsuite/gcc/gcc.log
# clean
clean:
$(RM) -r *-configure *-make $(DESTDIR) $(BUILDROOT)
.PHONY: clean all check
^ permalink raw reply [flat|nested] 2+ messages in thread