Skip to content

Commit

Permalink
configure: support ZUO=<zuo>
Browse files Browse the repository at this point in the history
Supplying `ZUO=<zuo>` skips the submodule check in `configure`
and configures the generated makefile not to build or remove Zuo.
  • Loading branch information
LiberalArtist committed Feb 25, 2024
1 parent 59b7567 commit e3e4098
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
5 changes: 3 additions & 2 deletions BUILDING
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ information on the supported options.
The generated makefile mostly just ensures that a `zuo` executable is
built in a `bin` directory, and then it defers the actual build work
to `zuo`, which uses the "main.zuo" file. If you have `zuo` installed,
you can use `zuo` directly instead of `make`. In general, instead of
you can use `zuo` directly instead of `make`: in that case, you may
wish to use `./configure ZUO=<zuo>`. In general, instead of
the command `make X` to build target `X` as described below, you can
use `zuo . X` (or `bin/zuo . X` after `bin/zuo` is built).

Expand Down Expand Up @@ -333,7 +334,7 @@ The makefile supports several targets:
* `make clean`

Removes all built elements from the workarea, and then removes
`bin/zuo`.
`bin/zuo` (unless configured with `ZUO=<zuo>`).


WINDOWS VIA COMMAND PROMPT
Expand Down
22 changes: 20 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ moreBootFiles=
preloadBootFiles=
alwaysUseBootFile=
skipSubmoduleUpdate=
zuoExternal=

CONFIG_UNAME=`uname`

Expand Down Expand Up @@ -446,6 +447,9 @@ while [ $# != 0 ] ; do
LZ4=*)
LZ4Lib=`echo $1 | sed -e 's/^LZ4=//'`
;;
ZUO=*)
zuoExternal=`echo $1 | sed -e 's/^ZUO=//'`
;;
*)
echo "option '$1' unrecognized or missing an argument; try $0 --help"
exit 1
Expand Down Expand Up @@ -672,6 +676,7 @@ if [ "$help" = "yes" ]; then
echo " STRIP=<strip> executable stripper"
echo " ZLIB=<lib> link to <lib> instead of own zlib"
echo " LZ4=<lib> link to <lib> instead of own LZ4"
echo " ZUO=<zuo> build with <zuo> instead of own Zuo"
echo ""
echo "Available machine types: $machs"
echo ""
Expand Down Expand Up @@ -889,8 +894,17 @@ submod_instructions () {
exit 1
}

if [ ! -f "$srcdir"/zuo/configure ] ; then
submod_instructions 'Source in "zuo" is missing'
if [ "${zuoExternal}" = "" ] ; then
if [ ! -f "$srcdir"/zuo/configure ] ; then
submod_instructions 'Source in "zuo" is missing'
fi
ZUO="bin/zuo"
RM_ZUO="rm -f bin/zuo"
ZUO_TARGET="bin/zuo"
else
ZUO="${zuoExternal}"
RM_ZUO="@echo 'Not cleaning external ${zuoExternal}'"
ZUO_TARGET="DoNotBuildZuo"
fi

if [ ! -f "$srcdir"/nanopass/nanopass.ss ] ; then
Expand Down Expand Up @@ -1130,6 +1144,10 @@ preloadBootFiles=$preloadBootFiles
alwaysUseBootFile=$alwaysUseBootFile
relativeBootFiles=$relativeBootFiles
ZUO=$ZUO
RM_ZUO=$RM_ZUO
ZUO_TARGET=$ZUO_TARGET
InstallBin=$installbin
InstallLib=$installlib
InstallMan=$installman/man1
Expand Down
6 changes: 2 additions & 4 deletions makefiles/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ workarea=$(w)

include $(workarea)/Mf-config

ZUO=bin/zuo

.PHONY: build
build: $(ZUO)
+ $(ZUO) $(workarea) MAKE="$(MAKE)"
Expand Down Expand Up @@ -144,9 +142,9 @@ pkg: $(ZUO)
.PHONY: clean
clean: $(ZUO)
+ $(ZUO) $(workarea) clean MAKE="$(MAKE)"
rm -f bin/zuo
$(RM_ZUO)

# Using `+` here means that $(ZUO) gets built even if `-n`/`--dry-run` is provided to `make`
$(ZUO): $(srcdir)/zuo/zuo.c
$(ZUO_TARGET): $(srcdir)/zuo/zuo.c
+ mkdir -p bin
+ $(CC_FOR_BUILD) -DZUO_LIB_PATH='"'"../zuo/lib"'"' -o $(ZUO) $(srcdir)/zuo/zuo.c

0 comments on commit e3e4098

Please sign in to comment.