forked from adamcooke/procodile
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
57 lines (46 loc) · 1.27 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
57
NAME = procodile
CRYSTAL_ENTRY := $(shell pwd)/$(shell cat shard.yml |grep main: |cut -d: -f2|cut -d" " -f2)
CRYSTAL_ENTRY != echo ${CRYSTAL_ENTRY} |cut -c2-
COMPILER ?= crystal
SHARDS ?= shards
CHECK ?= shards_check
CACHE_DIR != ${COMPILER} env CRYSTAL_CACHE_DIR
CACHE_DIR := $(CACHE_DIR)/$(subst /,-,${CRYSTAL_ENTRY})
FLAGS ?= --progress -Dstrict_multi_assign -Dno_number_autocast
RELEASE_FLAGS ?= --progress --production --release -Dstrict_multi_assign -Dno_number_autocast
# INSTALL:
DESTDIR ?= /usr/local
BINDIR ?= $(DESTDIR)/bin
INSTALL ?= /usr/bin/install
SOURCES := $(shell find src -name '*.cr')
O := bin/$(NAME)
.PHONE: test
test: $(O)
scripts/test.sh
all: $(O)
$(O): $(SOURCES)
mkdir -p bin
$(SHARDS) build $(FLAGS)
.PHONY: $(CHECK)
$(SHARDS) check || $(SHARDS) install
.PHONY: release
release: $(CHECK)
mkdir -p bin
$(SHARDS) build $(RELEASE_FLAGS)
.PHONY: spec
spec:
mkdir -p bin
$(COMPILER) spec $(FLAGS) --order=random --error-on-warnings
.PHONY: install
install: $(O) ## Install the compiler at DESTDIR
$(INSTALL) -d -m 0755 "$(BINDIR)/"
$(INSTALL) -m 0755 "$(O)" "$(BINDIR)/$(NAME)"
.PHONY: uninstall
uninstall: ## Uninstall the compiler from DESTDIR
rm -f "$(BINDIR)/$(NAME)"
.PHONY: clean
clean:
rm -f $(O)
.PHONY: cleanall
cleanall: clean
rm -rf ${CACHE_DIR}