-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (46 loc) · 1.76 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
SHELL=bash
all: check-cli
build: seguid
src/base64.tcl:
@url=https://core.tcl-lang.org/tcllib/raw/f6bea09d4aa9768279d2b74f7ab4a114dfb7c0583beded9da44eda66e888b8f7?at=base64.tcl; \
tf=base64.tcl; \
curl --silent "$${url}" > "$${tf}"; \
{ \
echo "## The following Base64 encode code was extracted from the tcllib source code"; \
echo "## $${url}"; \
echo ; \
head -n 19 "$${tf}"; \
sed -n -e '/namespace eval base64 {/,$$p' "$${tf}" | sed -e '/# ::base64::decode --/,$$d' | sed 's/ decode//'; \
} >> "$@"
seguid: src/seguid.tcl src/base64.tcl src/sha1.tcl
@echo "Building $@ from $^ ..."
@grep -q -F 'source [file join $$script_path ' "$<"
@while IFS= read -r line; do \
if [[ "$${line}" == "source "* ]]; then \
file=$$(sed 's/source \[file join [$$]script_path /src\//' <<< "$${line}" | sed 's/\]//'); \
echo "## DON'T EDIT: The source of this part is $${file}"; \
cat "$${file}"; \
echo; \
elif [[ "$${line}" != "set script_path "* ]]; then \
echo "$${line}"; \
fi; \
done < "$<" > "$@.tmp"
@chmod ugo+x "$@.tmp"
@mv "$@.tmp" "$@"
@ls -l "$@"
@echo "Version built: $$(tclsh seguid --version)"
@echo "Building $@ from $^ ... done"
#---------------------------------------------------------------
# Check CLI using 'seguid-tests' test suite
#---------------------------------------------------------------
add-submodules:
git submodule add https://github.com/seguid/seguid-tests seguid-tests
seguid-tests:
git submodule init
git submodule update
cd "$@" && git pull origin main
check-cli: seguid seguid-tests
$(MAKE) -C seguid-tests check-cli CLI_CALL="tclsh $(CURDIR)/seguid"
check-api: seguid-tests
TCL_PATH="$(shell pwd)/$<"; $(MAKE) -C seguid-tests check-api/seguid-tcl
.PHONY: seguid-tests