Fix usage of realpath on macOS, instead preferring grealpath

This commit is contained in:
Tim Wojtulewicz 2023-06-13 15:51:47 -07:00
parent 894be5aa2d
commit 05efc0f9df

View file

@ -9,6 +9,7 @@ BUILD=build
REPO=$$(cd $(CURDIR) && basename $$(git config --get remote.origin.url | sed 's/^[^:]*://g')) REPO=$$(cd $(CURDIR) && basename $$(git config --get remote.origin.url | sed 's/^[^:]*://g'))
VERSION_FULL=$(REPO)-$$(cd $(CURDIR) && cat VERSION) VERSION_FULL=$(REPO)-$$(cd $(CURDIR) && cat VERSION)
GITDIR=$$(test -f .git && echo $$(cut -d" " -f2 .git) || echo .git) GITDIR=$$(test -f .git && echo $$(cut -d" " -f2 .git) || echo .git)
REALPATH=$$($$(realpath --relative-to=$(pwd) . >/dev/null 2>&1) && echo 'realpath' || echo 'grealpath')
all: configured all: configured
$(MAKE) -C $(BUILD) $@ $(MAKE) -C $(BUILD) $@
@ -38,8 +39,8 @@ livehtml:
dist: dist:
@test -e ../$(VERSION_FULL) && rm -ri ../$(VERSION_FULL) || true @test -e ../$(VERSION_FULL) && rm -ri ../$(VERSION_FULL) || true
@cp -R . ../$(VERSION_FULL) @cp -R . ../$(VERSION_FULL)
@for i in . $$(git submodule foreach -q --recursive realpath --relative-to=$$(pwd) .); do ((cd ../$(VERSION_FULL)/$$i && test -f .git && cp -R $(GITDIR) .gitnew && rm -f .git && mv .gitnew .git && sed -i.bak -e 's#[[:space:]]*worktree[[:space:]]*=[[:space:]]*.*##g' .git/config) || true); done @for i in . $$(git submodule foreach -q --recursive $(REALPATH) --relative-to=$$(pwd) .); do ((cd ../$(VERSION_FULL)/$$i && test -f .git && cp -R $(GITDIR) .gitnew && rm -f .git && mv .gitnew .git && sed -i.bak -e 's#[[:space:]]*worktree[[:space:]]*=[[:space:]]*.*##g' .git/config) || true); done
@for i in . $$(git submodule foreach -q --recursive realpath --relative-to=$$(pwd) .); do (cd ../$(VERSION_FULL)/$$i && git reset -q --hard && git clean -ffdxq); done @for i in . $$(git submodule foreach -q --recursive $(REALPATH) --relative-to=$$(pwd) .); do (cd ../$(VERSION_FULL)/$$i && git reset -q --hard && git clean -ffdxq); done
@(cd ../$(VERSION_FULL) && find . -name \.git\* | xargs rm -rf) @(cd ../$(VERSION_FULL) && find . -name \.git\* | xargs rm -rf)
@(cd ../$(VERSION_FULL) && find . -name \.idea -type d | xargs rm -rf) @(cd ../$(VERSION_FULL) && find . -name \.idea -type d | xargs rm -rf)
@(cd ../$(VERSION_FULL) && find . -maxdepth 1 -name build\* | xargs rm -rf) @(cd ../$(VERSION_FULL) && find . -maxdepth 1 -name build\* | xargs rm -rf)