Makefile 829 Bytes
Newer Older
1
PREFIX=/usr/local
2 3
INSTALL_DIR=$(PREFIX)/bin
AMBER_SYSTEM=$(INSTALL_DIR)/amber
4

5 6 7
OUT_DIR=$(shell pwd)/bin
AMBER=$(OUT_DIR)/amber
AMBER_SOURCES=$(shell find src/ -type f -name '*.cr')
8

9
all: build
10

11
build: lib $(AMBER)
12 13

lib:
14
	@shards install --production
15

16 17 18 19 20 21
$(AMBER): $(AMBER_SOURCES) | $(OUT_DIR)
	@echo "Building amber in $@"
	@crystal build -o $@ src/amber/cli.cr -p --no-debug

$(OUT_DIR) $(INSTALL_DIR):
	 @mkdir -p $@
22

Isaac Sloan's avatar
Isaac Sloan committed
23
run:
24 25 26
	$(AMBER)

install: build | $(INSTALL_DIR)
27
	@rm -f $(AMBER_SYSTEM)
28
	@cp $(AMBER) $(AMBER_SYSTEM)
29

30 31 32
link: build | $(INSTALL_DIR)
	@echo "Symlinking $(AMBER) to $(AMBER_SYSTEM)"
	@ln -s $(AMBER) $(AMBER_SYSTEM)
33

34 35 36
force_link: build | $(INSTALL_DIR)
	@echo "Symlinking $(AMBER) to $(AMBER_SYSTEM)"
	@ln -sf $(AMBER) $(AMBER_SYSTEM)
37

38
clean:
39 40 41 42
	rm -rf $(AMBER)

distclean:
	rm -rf $(AMBER) .crystal .shards libs lib