-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
73 lines (54 loc) · 1.58 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
NAME = $(shell cat bundle.json | sed -n 's/"name"//p' | tr -d '", :')
VERSION = $(shell cat bundle.json | sed -n 's/"version"//p' | tr -d '", :')
PROJECT = sanji-bundle-$(NAME)
DISTDIR = $(PROJECT)-$(VERSION)
ARCHIVE = $(CURDIR)/$(DISTDIR).tar.gz
SANJI_VER ?= 1.0
INSTALL_DIR = $(DESTDIR)/usr/lib/sanji-$(SANJI_VER)/$(NAME)
STAGING_DIR = $(CURDIR)/staging
PROJECT_STAGING_DIR = $(STAGING_DIR)/$(DISTDIR)
TARGET_FILES = \
index.py \
bundle.json \
requirements.txt \
mxserial/__init__.py \
data/serials.json.factory
DIST_FILES= \
$(TARGET_FILES) \
Makefile \
tests/__init__.py \
tests/test_mxserial/__init__.py \
tests/test_mxserial/test___init__.py
INSTALL_FILES=$(addprefix $(INSTALL_DIR)/,$(TARGET_FILES))
STAGING_FILES=$(addprefix $(PROJECT_STAGING_DIR)/,$(DIST_FILES))
all: pylint test
clean:
rm -rf $(DISTDIR)*.tar.gz $(STAGING_DIR)
@rm -rf .coverage
@rm -rf ./data/*.json
@rm -rf ./data/*.json.backup
@find ./ -name *.pyc | xargs rm -rf
distclean: clean
pylint:
flake8 -v index.py ./mxserial
jscpd:
jscpd
test:
nosetests --with-coverage --cover-package=mxserial --cover-erase
debian-changelog:
@cd build-deb && dch -u low -D unstable -v "`sed -n 's/.*"version":.*"\(.*\)",/\1/p' ../bundle.json`"
dist: $(ARCHIVE)
$(ARCHIVE): distclean $(STAGING_FILES)
@mkdir -p $(STAGING_DIR)
cd $(STAGING_DIR) && \
tar zcf $@ $(DISTDIR)
$(PROJECT_STAGING_DIR)/%: %
@mkdir -p $(dir $@)
@cp -a $< $@
install: $(INSTALL_FILES)
$(INSTALL_DIR)/%: %
@mkdir -p $(dir $@)
@cp -a $< $@
uninstall:
-rm $(addprefix $(INSTALL_DIR)/,$(TARGET_FILES))
.PHONY: clean dist pylint test jscpd