-
Notifications
You must be signed in to change notification settings - Fork 19
/
Makefile
92 lines (74 loc) · 2.34 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/make
# WARN: gmake syntax
########################################################
#
# useful targets:
# make test - run the unit tests
# make flake8 - linting and pep8
# make docs - create manpages and html documentation
########################################################
# variable section
NAME = nsshell
OS = $(shell uname -s)
ARCHITECTURE = amd64
VERSION= $(shell grep -e 'version=' setup.py | cut -d\' -f 2)
PYTHON = $(shell which python2)
VIRTUALENV_PATH = $(shell echo $$HOME/.virtualenvs)
INSTALL_PATH = /usr/local/lib
EXEC_PATH = /usr/local/bin
MANPAGES=$(wildcard docs/man/**/*.*.ronn)
MANPAGES_GEN=$(patsubst %.ronn,%,$(MANPAGES))
MANPAGES_HTML=$(patsubst %.ronn,%.html,$(MANPAGES))
ifneq ($(shell which ronn 2>/dev/null),)
RONN2MAN = ronn
else
RONN2MAN = @echo "WARN: 'ronn' command is not installed but is required to build $(MANPAGES)"
endif
UNITTESTS=unittest
COVERAGE=coverage
########################################################
docs: $(MANPAGES)
$(RONN2MAN) $^
.PHONY: clean
clean:
rm -f $(MANPAGES_GEN) $(MANPAGES_HTML)
rm -rf ./build
rm -rf ./dist
rm -rf ./*.egg-info
rm -rf ./*.deb
rm -rf .tox
rm -rf .coverage
rm -rf .cache
find . -name '*.pyc.*' -delete
find . -name '*.pyc' -delete
find . -name '__pycache__' -delete
test:
# "TODO - test"
virtualenv:
mkdir -p $(VIRTUALENV_PATH)
rm -rf $(VIRTUALENV_PATH)/$(NAME)
virtualenv -p $(PYTHON) $(VIRTUALENV_PATH)/$(NAME)
virtualenv-install: virtualenv
$(VIRTUALENV_PATH)/$(NAME)/bin/python setup.py install
virtualenv-develop: virtualenv
$(VIRTUALENV_PATH)/$(NAME)/bin/python setup.py develop
virtualenv-sdist: virtualenv
$(VIRTUALENV_PATH)/$(NAME)/bin/python setup.py sdist
dist: install
fpm -s dir -t deb -v $(VERSION) -n $(NAME) -a $(ARCHITECTURE) $(INSTALL_PATH)/$(NAME) $(EXEC_PATH)/$(NAME)
install:
virtualenv -p $(PYTHON) $(INSTALL_PATH)/$(NAME)
$(INSTALL_PATH)/$(NAME)/bin/python setup.py install
ln -f -s $(INSTALL_PATH)/$(NAME)/bin/$(NAME) $(EXEC_PATH)/$(NAME)
# look at my templating language ma
mkdir -p /etc/nsshell
mkdir -p /var/log/nsshell
echo -n '[a]\nSCRIPTS_DIR="/etc/nsshell/scripts/"\nLOG_DIR="/var/log/nsshell"' > /etc/nsshell/nsshell.conf
cp -r scripts/ /etc/nsshell/
uninstall:
rm -rf -v -I $(INSTALL_PATH)/$(NAME)
rm -f -v -I $(EXEC_PATH)/$(NAME)
container:
bash ./scripts/build.sh -d
bash ./scripts/build.sh -b
all: docs test