Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/doc/repl/glj.wasm
/report.html
.direnv
/.cache/

# useful to symlink in for context
/clojure
31 changes: 31 additions & 0 deletions .makes.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
M := $(or $(MAKES_REPO_DIR),.cache/makes)
M := .cache/makes
C := 46b9706d4af95d678935dba931d8c4c84eaebbe5
$(shell [ -d $M ] || git clone -q https://github.com/makeplus/makes $M)
$(shell [ -d $M ] || ( \
git clone -depth=1 -q https://github.com/makeplus/makes $M && \
git -C $M reset -q --hard $C))
include $M/init.mk
MAKES-NO-RULES := true
GO-VERSION ?= 1.19.3
include $M/go.mk
include $M/clean.mk
include $M/shell.mk

MAKES-DISTCLEAN := .cache/ .clj-kondo/ .lsp/ .vscode/


all \
aot \
build \
format \
generate \
glj-bins \
glj-imports \
stdlib-targets \
test \
test-glj \
test-suite \
update-clojure-sources \
vet \
:: $(GO)
34 changes: 19 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Usage:
# make clean all test GO-VERSION=1.25.1

ifdef GLOJURE_MAKES
include .makes.mk
endif

SHELL := bash

GO-VERSION ?= 1.19.3
Expand Down Expand Up @@ -80,39 +84,39 @@ ALL-TARGETS := \
glj-bins \

#-------------------------------------------------------------------------------
default: all
default:: all

# Dummy target for commands like:
# make all force=1
# make stdlib-targets force=1
force:

all: $(ALL-TARGETS)
all:: $(ALL-TARGETS)

gocmd:
@$(GO-CMD) version &> /dev/null || { \
(go install "golang.org/dl/$(GO-CMD)@latest" && \
$(GO-CMD) download > /dev/null && \
$(GO-CMD) version > /dev/null); }

stdlib-targets: $(STDLIB-TARGETS)
stdlib-targets:: $(STDLIB-TARGETS)

generate:
generate::
go generate ./...

aot: gocmd $(STDLIB-TARGETS)
aot:: gocmd $(STDLIB-TARGETS)
GLOJURE_USE_AOT=false \
GLOJURE_STDLIB_PATH=./pkg/stdlib \
$(GO-CMD) run -tags glj_no_aot_stdlib ./cmd/glj \
<<<"(map compile '[$(AOT-NAMESPACES)])"

glj-imports: $(GLJ-IMPORTS)
glj-imports:: $(GLJ-IMPORTS)

glj-bins: $(GLJ-BINS)
glj-bins:: $(GLJ-BINS)

build: $(GLJ-CMD)
build:: $(GLJ-CMD)

clean:
clean::
$(RM) report.html
$(RM) -r bin/ scripts/rewrite-core/.cpcache/

Expand Down Expand Up @@ -153,16 +157,16 @@ bin/%/glj.wasm: \
@mkdir -p $(dir $@)
scripts/build-glj.sh $@ $*

vet:
vet::
go vet ./...

.PHONY: test
# vet is disabled until we fix errors in generated code
test: test-glj test-suite # vet
test:: test-glj test-suite # vet

test-glj: $(TEST-GLJ-TARGETS)
test-glj:: $(TEST-GLJ-TARGETS)

test-suite: $(GLJ-CMD)
test-suite:: $(GLJ-CMD)
cd $(TEST-SUITE-DIR) && \
$(abspath $<) $(TEST-SUITE-FILE) \
--expect-failures 38 \
Expand All @@ -172,12 +176,12 @@ test-suite: $(GLJ-CMD)
$(TEST-GLJ-TARGETS): $(GLJ-CMD)
$< $(basename $@)

format:
format::
@if go fmt ./... | grep -q ''; then \
echo "Files were formatted. Please commit the changes."; \
exit 1; \
fi

update-clojure-sources:
update-clojure-sources::
scripts/rewrite-core/update-clojure-sources.sh \
$(CLOJURE-STDLIB-VERSION)