forked from containers/ramalama
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
106 lines (91 loc) · 2.16 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
MAKEFLAGS += -j2
OS := $(shell uname;)
SELINUXOPT ?= $(shell test -x /usr/sbin/selinuxenabled && selinuxenabled && echo -Z)
PREFIX ?= /usr/local
BINDIR ?= ${PREFIX}/bin
SHAREDIR ?= ${PREFIX}/share/ramalama
PYTHON ?= $(shell command -v python3 python|head -n1)
DESTDIR ?= /
PATH := $(PATH):$(HOME)/.local/bin
default: help
help:
@echo "Build Container"
@echo
@echo " - make build"
@echo
@echo "Build docs"
@echo
@echo " - make docs"
@echo
@echo "Install ramalama"
@echo
@echo " - make install"
@echo
@echo "Test ramalama"
@echo
@echo " - make test"
@echo
@echo "Clean the repository"
@echo
@echo " - make clean"
@echo
.PHONY:
install-program:
install ${SELINUXOPT} -d -m 755 $(DESTDIR)$(BINDIR)
install ${SELINUXOPT} -m 755 ramalama.py \
$(DESTDIR)$(BINDIR)/ramalama
.PHONY:
install-shortnames:
install ${SELINUXOPT} -d -m 755 $(DESTDIR)$(SHAREDIR)
install ${SELINUXOPT} -m 644 shortnames/shortnames.conf \
$(DESTDIR)$(SHAREDIR)
.PHONY:
install: install-program install-shortnames install-docs
RAMALAMA_VERSION=$(RAMALAMA_VERSION) \
pip install . --root $(DESTDIR) --prefix ${PREFIX}
.PHONY:
build:
ifeq ($(OS),Linux)
$(PYTHON) -m pip install --user -r requirements.txt
./container_build.sh
endif
.PHONY: install-docs
install-docs: docs
make -C docs install
.PHONY: docs
docs:
make -C docs
.PHONY: lint
lint:
@pip install -q black flake8
black --line-length 120 --exclude 'venv/*' *.py ramalama/*.py # Format the code
flake8 --max-line-length=120 --exclude=venv *.py ramalama/*.py # Check for any inconsistencies
.PHONY: codespell
codespell:
@pip install -q codespell
codespell --dictionary=- -w
.PHONY: validate
validate: build codespell lint
ifeq ($(OS),Linux)
hack/man-page-checker
hack/xref-helpmsgs-manpages
endif
.PHONY: bats
bats:
RAMALAMA=$(CURDIR)/ramalama.py bats -T test/system/
_RAMALAMA_TEST_OPTS=--nocontainer RAMALAMA=$(CURDIR)/ramalama.py bats -T test/system/
.PHONY: ci
ci:
test/ci.sh
.PHONY: test
test: validate bats ci
make clean
hack/tree_status.sh
.PHONY: clean
clean:
@find . -name \*~ -delete
@find . -name \*# -delete
@find . -name \*.rej -delete
@find . -name \*.orig -delete
rm -rf $$(<.gitignore)
make -C docs clean