From 3798957c3ba100a929cfb8e44f393cb0157158c4 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Jul 2010 14:28:04 -0400 Subject: [PATCH] Speedup build somewhat. --- cmd/wmii/mouse.c | 8 ++------ mk/hdr.mk | 5 +++++ util/compile | 18 +++++++++++------- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/cmd/wmii/mouse.c b/cmd/wmii/mouse.c index 593e517c..53d4e934 100644 --- a/cmd/wmii/mouse.c +++ b/cmd/wmii/mouse.c @@ -63,13 +63,9 @@ constraintwin(Rectangle r) { void destroyconstraintwin(Window *w) { - Window *w2; - if(w->aux) { - w2 = w->aux; - sethandler(w2, nil); - destroywindow(w2); - } + if(w->aux) + destroywindow(w->aux); destroywindow(w); } diff --git a/mk/hdr.mk b/mk/hdr.mk index 9567e347..4bfe7889 100644 --- a/mk/hdr.mk +++ b/mk/hdr.mk @@ -22,6 +22,11 @@ FILTER = cat EXCFLAGS = $(INCLUDES) -D_XOPEN_SOURCE=600 +# Try to avoid bash if possible. It slows the build considerably. +SHELL := $(shell which /bin/dash 2>/dev/null || echo /bin/sh) +SHELL != which /bin/dash 2>/dev/null || echo /bin/sh +.SHELL: name=sh path=$(SHELL) + COMPILE_FLAGS = $(EXCFLAGS) $(CFLAGS) COMPILE = $(SHELL) $(ROOT)/util/compile "$(CC)" "$(PACKAGES)" "$(COMPILE_FLAGS)" COMPILEPIC = $(SHELL) $(ROOT)/util/compile "$(CC)" "$(PACKAGES)" "$(COMPILE_FLAGS) $(SOCFLAGS)" diff --git a/util/compile b/util/compile index 35caa5ff..b2f16ea2 100755 --- a/util/compile +++ b/util/compile @@ -8,11 +8,10 @@ CFLAGS=$3; shift 3 outfile="$1"; shift bin="$(echo $0 | sed 's,/[^/]*$,,')" +xtmp=/tmp/cc.$$.$USER.out # Derived from Russ Cox's 9c in plan9port. -xtmp=/tmp/cc.$$.$USER.out - echo CC $($bin/cleanname ${BASE}$outfile) [ -n "$noisycc" ] && echo $CC -o $outfile $CFLAGS $@ eval '$CC -o $outfile '"$CFLAGS"' $@ >$xtmp 2>&1' @@ -50,7 +49,16 @@ undup() { # GCC is crap. nl=0 maxl=6 } + /: (error|note): .?Each undeclared identifier|: error: for each function it appears|is dangerous, better use|is almost always misused|: In function |: At top level:|support .long long.|use of C99 long long|ISO C forbids conversion|warning:.*warn_unused_result/ { + next + } + $1 == "warning:" { + t = $2 " " $1 + sub(/^[^ ]+ [^ ]+ /, "") + $0 = t " " $0 + } { + sub(/\[/, ": [", $1) if(nl == maxl) shift() l[++nl] = $0 @@ -62,12 +70,8 @@ undup() { # GCC is crap. } cat $xtmp | sed "s,^$re,$base&,g; s,\([[:space:]]\)$re,\1$base\2,g" | - egrep -iv ': (error|note): .?Each undeclared identifier|: error: for each function it appears|is dangerous, better use|is almost always misused|: In function |: At top level:|support .long long.|use of C99 long long|ISO C forbids conversion|warning:.*warn_unused_result' | sed 's/ .first use in this function.$//; s/\"\([^\"][^\"]*\)\", line \([0-9][0-9]*\)/\1:\2/g' | - awk '$1 == "warning:"{t=$2" "$1; sub(/^[^ ]+ [^ ]+ /, ""); $0 = t" "$0}; //' | - awk '{sub(/\[/, ": [", $1); print}' | - undup 1>&2 - + undup >&2 rm -f $xtmp exit $status