aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: cfd057a9844177a53eae1c2713189fda789125f3 (plain)
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
58
59
60
ifdef XDG_DATA_HOME
	DATA_DIR=$(XDG_DATA_HOME)
else
	DATA_DIR=$(HOME)/.local/share
endif

ifdef XDG_CONFIG_HOME
	CONF_DIR=$(XDG_CONFIG_HOME)
else
	CONF_DIR=$(HOME)/.config
endif

BIN_DIR=$(HOME)/.local/bin

all:
	@echo "Nothing to build. Run 'make install' to install, 'make test' to run tests."

install:
	-mkdir -p $(DATA_DIR)/ves/bin
	-mkdir -p $(DATA_DIR)/ves/lib
	-mkdir -p $(DATA_DIR)/ves/envs
	-mkdir -p $(CONF_DIR)/ves
	-mkdir -p $(BIN_DIR)/ves_scripts
	-mkdir -p $(DATA_DIR)/man/man1
	cp ./*.sh $(BIN_DIR)/ves_scripts
	chmod u+x $(BIN_DIR)/ves_scripts/*
	cp ./man/ves.1 $(DATA_DIR)/man/man1/ves.1
	@if command -v fish > /dev/null 2>&1; then \
		mkdir -p $(CONF_DIR)/fish/functions $(CONF_DIR)/fish/completions; \
		cp ./ves.fish $(CONF_DIR)/fish/functions/ves.fish; \
		cp ./completions/ves.fish $(CONF_DIR)/fish/completions/ves.fish; \
		echo "fish detected: installed function and completions"; \
	fi
	@echo ""
	@echo "Installation complete. To enable sh-ves, add the following line"
	@echo "to your shell's rc or profile file:"
	@echo ""
	@echo "    . $(BIN_DIR)/ves_scripts/ves-init.sh"
	@echo ""

test:
	sh ./tests/run_tests.sh
	@if command -v fish > /dev/null 2>&1; then \
		fish ./tests/run_tests.fish; \
	else \
		echo "fish not found, skipping fish shim tests"; \
	fi

uninstall:
	-rm -f $(BIN_DIR)/ves
	-rm -rf $(BIN_DIR)/ves_scripts
	-rm -f $(CONF_DIR)/fish/functions/ves.fish
	-rm -f $(CONF_DIR)/fish/completions/ves.fish
	-rm -f $(DATA_DIR)/man/man1/ves.1

purge: uninstall
	-rm -rf $(DATA_DIR)/ves
	-rm -rf $(CONF_DIR)/ves

.PHONY: all install test uninstall purge