Skip to content

Commit

Permalink
Makefile: add test-submodules target
Browse files Browse the repository at this point in the history
...and remove "build" as dependency of "test" target. No need to waste time linking the
deft-app exe when we run tests.
  • Loading branch information
cgay committed Dec 29, 2024
1 parent cb53cb9 commit aceaee1
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 16 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ jobs:
run: |
mkdir -p ${DYLAN}
make install
ls -l ${DYLAN}/bin/
ldd ${DYLAN}/bin/deft
- name: Exercise deft
env:
Expand All @@ -55,3 +57,11 @@ jobs:
${exe} list
${exe} build abc-test-suite
_build/bin/abc-test-suite
- name: Run test suite using submodules
env:
DYLAN_CATALOG: ext/pacman-catalog
DYLAN: dylan-root
run: |
mkdir -p ${DYLAN}
make test-submodules
40 changes: 24 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
# Low-tech Makefile to build and install deft.

DYLAN ?= $${HOME}/dylan
DEFT_EXE ?= dylan

git_version := "$(shell git describe --tags --always --match 'v*')"

.PHONY: build build-with-version clean install install-debug really-install remove-deft-artifacts test dist distclean
.PHONY: build build-with-version clean install install-debug really-install remove-deft-artifacts test test-submodules dist distclean

build:
$(DEFT_EXE) update
$(DEFT_EXE) build --unify deft-app
build: remove-deft-artifacts
OPEN_DYLAN_USER_REGISTRIES=${PWD}/registry dylan-compiler -build -unify deft-app

# Hack to add the version to the binary with git tag info. Don't want this to
# be the normal build because it causes unnecessary rebuilds.
build-with-version:
build-with-version: remove-deft-artifacts
file="sources/commands/utils.dylan"; \
orig=$$(mktemp); \
temp=$$(mktemp); \
cp -p $${file} $${orig}; \
cat $${file} | sed "s,/.__./.*/.__./,/*__*/ \"${git_version}\" /*__*/,g" > $${temp}; \
mv $${temp} $${file}; \
$(DEFT_EXE) update; \
$(DEFT_EXE) build --unify deft-app; \
OPEN_DYLAN_USER_REGISTRIES=${PWD}/registry \
dylan-compiler -build -unify deft-app; \
cp -p $${orig} $${file}

# Until the install-deft GitHub Action is no longer referring to deft-app
# we also create a link named deft-app.
really-install:
mkdir -p $(DYLAN)/bin
cp _build/sbin/deft-app $(DYLAN)/bin/deft
ln -f $(DYLAN)/bin/deft $(DYLAN)/bin/{deft-app,dylan}
ln -f $(DYLAN)/bin/deft $(DYLAN)/bin/deft-app
ln -f $(DYLAN)/bin/deft $(DYLAN)/bin/dylan

install: build-with-version really-install

Expand All @@ -39,16 +38,25 @@ install-debug: build really-install
# Deft needs to be buildable with submodules so that it can be built on
# new platforms without having to manually install deps.
test: build
$(DEFT_EXE) build deft-test-suite \
OPEN_DYLAN_USER_REGISTRIES=${PWD}/registry \
dylan-compiler -build deft-test-suite \
&& DYLAN_CATALOG=ext/pacman-catalog _build/bin/deft-test-suite

dist: distclean install
# Deft also needs to be buildable with submodules so that it can be built on new
# platforms without having to manually install deps.
test-submodules: distclean
dylan-compiler -build deft-test-suite \
&& DYLAN_CATALOG=ext/pacman-catalog _build/bin/deft-test-suite

clean:
rm -rf _build
rm -rf _test
dist: distclean install

distclean: clean
rm -f $(DYLAN)/bin/{deft,deft-app,dylan}
# Sometimes I use deft to develop deft, so this makes sure to clean
# up its artifacts.
remove-deft-artifacts:
rm -rf _packages
find registry -not -path '*/generic/*' -type f -exec rm {} \;

clean: remove-deft-artifacts
rm -rf _build _test *~

distclean: clean

0 comments on commit aceaee1

Please sign in to comment.