-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
46 lines (33 loc) · 942 Bytes
/
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
PREFIX=/usr/local
INSTALL_DIR=$(PREFIX)/bin
SNIPCLI_SYSTEM=$(INSTALL_DIR)/snipcli
OUT_DIR=./bin
SNIPCLI=$(OUT_DIR)/snipcli
SNIPCLI_SOURCES=$(shell find src/ -type f -name '*.cr')
all: build
build: lib $(SNIPCLI)
lib:
@shards install --production
$(SNIPCLI): $(SNIPCLI_SOURCES) | $(OUT_DIR)
@echo "Building snipcli in $@"
@crystal build -o $@ src/snipline_cli.cr -p --no-debug --release
$(OUT_DIR) $(INSTALL_DIR):
@mkdir -p $@
run:
$(SNIPCLI)
install: build | $(INSTALL_DIR)
@rm -f $(SNIPCLI_SYSTEM)
@cp $(SNIPCLI) $(SNIPCLI_SYSTEM)
cp:
@rm -f $(SNIPCLI_SYSTEM)
@cp $(SNIPCLI) $(SNIPCLI_SYSTEM)
link: build | $(INSTALL_DIR)
@echo "Symlinking $(SNIPCLI) to $(SNIPCLI_SYSTEM)"
@ln -s $(SNIPCLI) $(SNIPCLI_SYSTEM)
force_link: build | $(INSTALL_DIR)
@echo "Symlinking $(SNIPCLI) to $(SNIPCLI_SYSTEM)"
@ln -sf $(SNIPCLI) $(SNIPCLI_SYSTEM)
clean:
rm -rf $(SNIPCLI)
distclean:
rm -rf $(SNIPCLI) .crystal .shards libs lib