From: Jean-Marc Saffroy <jean-marc.saffroy@joguin.com>
To: Mike Stump <mikestump@comcast.net>
Cc: cgen@sourceware.org
Subject: Re: -j6 build
Date: Mon, 30 Aug 2010 16:52:00 -0000 [thread overview]
Message-ID: <4C73EE46.3050709@joguin.com> (raw)
In-Reply-To: <C62F248C-BFA3-43D5-BC72-18AE4F030CDE@comcast.net>
[-- 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
prev parent reply other threads:[~2010-08-24 16:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-24 16:07 Mike Stump
2010-08-30 16:52 ` Jean-Marc Saffroy [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C73EE46.3050709@joguin.com \
--to=jean-marc.saffroy@joguin.com \
--cc=cgen@sourceware.org \
--cc=mikestump@comcast.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).