|
3 | 3 | # "http-server". The expectation is that during development people will use `deft build` |
4 | 4 | # or `deft test`. |
5 | 5 |
|
6 | | -# TODO: use the .gitattributes filtering that Deft uses instead of this version hack. |
7 | | - |
8 | 6 | DYLAN ?= $${HOME}/dylan |
9 | 7 |
|
10 | 8 | .PHONY: build clean install |
11 | 9 |
|
12 | | -build: |
| 10 | +git_version := $(shell git describe --tags --always --match 'v*') |
| 11 | + |
| 12 | +# We assume `deft update` is invoked manually before running make. |
| 13 | + |
| 14 | +build: common/*.dylan common/*.lid server/*/*.dylan server/*/*.lid |
13 | 15 | file="server/core/server.dylan"; \ |
14 | | - backup=$$(mktemp); \ |
15 | | - temp=$$(mktemp); \ |
16 | | - cp -p $${file} $${backup}; \ |
17 | | - cat $${file} | sed "s,/.__./.*/.__./,/*__*/ \"$$(git describe --always --tags)\" /*__*/,g" > $${temp}; \ |
18 | | - mv $${temp} $${file}; \ |
19 | | - dylan update; \ |
20 | | - dylan build --unify http-server-app; \ |
21 | | - cp -p $${backup} $${file} |
| 16 | + orig=$$(mktemp); \ |
| 17 | + temp=$$(mktemp); \ |
| 18 | + cp -p $${file} $${orig}; \ |
| 19 | + cat $${file} | sed "s|_NO_VERSION_SET_|${git_version} built on $$(date -Iseconds)|g" > $${temp}; \ |
| 20 | + mv $${temp} $${file}; \ |
| 21 | + deft build http-server-app; \ |
| 22 | + cp -p $${orig} $${file} |
22 | 23 |
|
23 | 24 | install: build |
24 | 25 | mkdir -p $(DYLAN)/bin |
25 | | - cp _build/sbin/http-server-app $(DYLAN)/bin/http-server |
| 26 | + mkdir -p $(DYLAN)/install/http/bin |
| 27 | + mkdir -p $(DYLAN)/install/http/lib |
| 28 | + cp _build/bin/http-server-app $(DYLAN)/install/http/bin/http-server |
| 29 | + cp -r _build/lib/lib* $(DYLAN)/install/http/lib/ |
| 30 | + ln -s -f $$(realpath $(DYLAN)/install/http/bin/http-server) $(DYLAN)/bin/http-server |
26 | 31 |
|
27 | 32 | clean: |
28 | | - rm -rf _build registry |
| 33 | + rm -rf _build _packages registry |
0 commit comments