diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2024-06-21 12:11:08 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2024-06-21 12:51:37 -0400 |
commit | 4bc79148e2ed23273afefaf439a03364d5161046 (patch) | |
tree | 4e996b7e46e56e28bb6d137db49b8fae139189eb | |
parent | 4bc06bd999786da359a05801bf9106597fe57298 (diff) | |
download | bfs-4bc79148e2ed23273afefaf439a03364d5161046.tar.xz |
build: Save cc.sh build products to gen/
-rwxr-xr-x | build/cc.sh | 11 | ||||
-rw-r--r-- | build/deps.mk | 2 | ||||
-rw-r--r-- | build/header.mk | 6 | ||||
-rwxr-xr-x | build/pkgconf.sh | 2 |
4 files changed, 8 insertions, 13 deletions
diff --git a/build/cc.sh b/build/cc.sh index 45d51ca..23a4c01 100755 --- a/build/cc.sh +++ b/build/cc.sh @@ -5,12 +5,5 @@ # Run the compiler and check if it succeeded -set -eu - -TMP=$(mktemp) -trap 'rm -f "$TMP"' EXIT - -( - set -x - $XCC $XCPPFLAGS $XCFLAGS $XLDFLAGS "$@" $XLDLIBS -o "$TMP" -) +set -eux +$XCC $XCPPFLAGS $XCFLAGS $XLDFLAGS "$@" $XLDLIBS diff --git a/build/deps.mk b/build/deps.mk index d382f5d..a6ea673 100644 --- a/build/deps.mk +++ b/build/deps.mk @@ -11,7 +11,7 @@ include build/exports.mk gen/deps.mk:: ${MSG} "[ GEN] $@" @printf '# %s\n' "$@" >$@ - @if build/cc.sh -MD -MP -MF /dev/null build/empty.c; then \ + @if build/cc.sh -MD -MP build/empty.c -o gen/.deps.out; then \ printf '_CPPFLAGS += -MD -MP\n'; \ fi >>$@ 2>$@.log ${VCAT} $@ diff --git a/build/header.mk b/build/header.mk index 65e95cb..afd04d0 100644 --- a/build/header.mk +++ b/build/header.mk @@ -76,16 +76,18 @@ gen/config.h: ${PKG_HEADERS} ${HEADERS} # The short name of the config test SLUG = ${@:gen/%.h=%} +# The hidden output file name +OUT = ${SLUG:has/%=gen/has/.%.out} ${HEADERS}: cc @${MKDIR} ${@D} - @build/define-if.sh ${SLUG} build/cc.sh build/${SLUG}.c >$@ 2>$@.log; \ + @build/define-if.sh ${SLUG} build/cc.sh build/${SLUG}.c -o ${OUT} >$@ 2>$@.log; \ build/msg-if.sh "[ CC ] ${SLUG}.c" test $$? -eq 0 .PHONY: ${HEADERS} # Check that the C compiler works at all cc:: - @build/cc.sh build/empty.c 2>gen/cc.log; \ + @build/cc.sh build/empty.c -o gen/.cc.out 2>gen/cc.log; \ ret=$$?; \ build/msg-if.sh "[ CC ] build/empty.c" test $$ret -eq 0; \ exit $$ret diff --git a/build/pkgconf.sh b/build/pkgconf.sh index 244c95d..a8a3341 100755 --- a/build/pkgconf.sh +++ b/build/pkgconf.sh @@ -37,7 +37,7 @@ if [ -z "$MODE" ]; then CFLAGS=$("$0" --cflags "$LIB") || exit 1 LDFLAGS=$("$0" --ldflags "$LIB") || exit 1 LDLIBS=$("$0" --ldlibs "$LIB") || exit 1 - build/cc.sh $CFLAGS $LDFLAGS build/with/$LIB.c $LDLIBS || exit 1 + build/cc.sh $CFLAGS $LDFLAGS "build/with/$LIB.c" $LDLIBS -o "gen/with/.$LIB.out" || exit 1 done fi |