|
1 | 1 | # Low-tech Makefile to build and install deft.
|
2 | 2 |
|
3 | 3 | DYLAN ?= $${HOME}/dylan
|
4 |
| -install_dir = $(DYLAN)/install/deft |
5 |
| -install_bin = $(install_dir)/bin |
6 |
| -install_lib = $(install_dir)/lib |
7 |
| -link_target = $(install_bin)/deft-app |
8 |
| -link_source = $(DYLAN)/bin/dylan |
9 | 4 |
|
10 |
| -git_version := "$(shell git describe --tags --always --match 'v*')" |
| 5 | +.PHONY: build clean install remove-deft-artifacts test dist distclean |
11 | 6 |
|
12 |
| -.PHONY: build build-with-version clean install install-debug really-install remove-deft-artifacts test dist distclean |
| 7 | +git_version := $(shell git describe --tags --always --match 'v*') |
13 | 8 |
|
14 |
| -build: remove-deft-artifacts |
15 |
| - OPEN_DYLAN_USER_REGISTRIES=${PWD}/registry dylan-compiler -build -unify deft-app |
16 |
| - |
17 |
| -# Hack to add the version to the binary with git tag info. Don't want this to |
18 |
| -# be the normal build because it causes unnecessary rebuilds. |
19 |
| -build-with-version: remove-deft-artifacts |
| 9 | +# Hack to add the version to the binary with Git tag info. During development I (cgay) |
| 10 | +# just build with "deft build" so the unnecessary rebuilds that this would cause aren't |
| 11 | +# an issue. |
| 12 | +build: |
| 13 | + dylan update |
20 | 14 | file="sources/commands/utils.dylan"; \
|
21 | 15 | orig=$$(mktemp); \
|
22 | 16 | temp=$$(mktemp); \
|
23 | 17 | cp -p $${file} $${orig}; \
|
24 |
| - cat $${file} | sed "s,/.__./.*/.__./,/*__*/ \"${git_version}\" /*__*/,g" > $${temp}; \ |
| 18 | + cat $${file} | sed "s,/.__./.*/.__./,/*__*/ \"${git_version}\ built on $$(date -Iseconds)\" /*__*/,g" > $${temp}; \ |
25 | 19 | mv $${temp} $${file}; \
|
26 |
| - OPEN_DYLAN_USER_REGISTRIES=${PWD}/registry \ |
27 |
| - dylan-compiler -build -unify deft-app; \ |
| 20 | + OPEN_DYLAN_USER_REGISTRIES=${PWD}/registry dylan-compiler -build deft-app; \ |
28 | 21 | cp -p $${orig} $${file}
|
29 | 22 |
|
30 |
| -# Until the install-deft GitHub Action is no longer referring to deft-app |
31 |
| -# we also create a link named deft-app. |
32 |
| -really-install: |
| 23 | +install: build |
33 | 24 | mkdir -p $(DYLAN)/bin
|
34 |
| - cp _build/sbin/deft-app $(DYLAN)/bin/deft |
35 |
| - ln -f $(DYLAN)/bin/deft $(DYLAN)/bin/deft-app |
36 |
| - ln -f $(DYLAN)/bin/deft $(DYLAN)/bin/dylan |
37 |
| - |
38 |
| -install: build-with-version really-install |
39 |
| - |
40 |
| -# Build and install without the version hacking above. |
41 |
| -install-debug: build really-install |
42 |
| - |
43 |
| -# Deft needs to be buildable with submodules so that it can be built on |
44 |
| -# new platforms without having to manually install deps. |
45 |
| -test: build |
46 |
| - OPEN_DYLAN_USER_REGISTRIES=${PWD}/registry \ |
47 |
| - dylan-compiler -build deft-test-suite \ |
48 |
| - && DYLAN_CATALOG=ext/pacman-catalog _build/bin/deft-test-suite |
| 25 | + mkdir -p $(DYLAN)/install/deft/bin |
| 26 | + mkdir -p $(DYLAN)/install/deft/lib |
| 27 | + cp _build/bin/deft-app $(DYLAN)/install/deft/bin/deft |
| 28 | + cp -r _build/lib/lib* $(DYLAN)/install/deft/lib/ |
| 29 | + # For unified exe these could be hard links but for now they must be symlinks so |
| 30 | + # that the relative paths to ../lib are correct. With --unify I ran into the |
| 31 | + # "libunwind.so not found" bug. |
| 32 | + ln -s -f $$(realpath $(DYLAN)/install/deft/bin/deft) $(DYLAN)/bin/deft |
| 33 | + # For temp backward compatibility... |
| 34 | + ln -s -f $$(realpath $(DYLAN)/install/deft/bin/deft) $(DYLAN)/bin/deft-app |
| 35 | + ln -s -f $$(realpath $(DYLAN)/install/deft/bin/deft) $(DYLAN)/bin/dylan |
| 36 | + |
| 37 | +test: |
| 38 | + dylan update |
| 39 | + OPEN_DYLAN_USER_REGISTRIES=${PWD}/registry dylan-compiler -build deft-test-suite \ |
| 40 | + && _build/bin/deft-test-suite |
49 | 41 |
|
50 | 42 | dist: distclean install
|
51 | 43 |
|
52 |
| -# Sometimes I use deft to develop deft, so this makes sure to clean |
53 |
| -# up its artifacts. |
54 |
| -remove-deft-artifacts: |
| 44 | +clean: |
55 | 45 | rm -rf _packages
|
56 |
| - find registry -not -path '*/generic/*' -type f -exec rm {} \; |
57 |
| - |
58 |
| -clean: remove-deft-artifacts |
| 46 | + rm -rf registry |
59 | 47 | rm -rf _build
|
60 | 48 | rm -rf _test
|
| 49 | + rm -rf *~ |
61 | 50 |
|
62 | 51 | distclean: clean
|
63 |
| - rm -rf $(install_dir) |
64 |
| - rm -f $(link_source) |
| 52 | + rm -rf $(DYLAN)/install/deft |
| 53 | + rm $(DYLAN)/bin/deft |
| 54 | + rm $(DYLAN)/bin/deft-app |
| 55 | + rm $(DYLAN)/bin/dylan |
0 commit comments