-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
73 lines (51 loc) · 2.11 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
# This way everything works as expected ever for
# `make -C /path/to/project` or
# `make -f /path/to/project/Makefile`.
MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
PROJECT_DIR := $(patsubst %/,%,$(dir $(MAKEFILE_PATH)))
PREFIX ?= /usr
PREFIX_MAN = ${PREFIX}/share/man
PREFIX_DATA = ${PREFIX}/local/share
TARGET_DIR ?= static
JSON_DIR = $(TARGET_DIR)/times
VIDEO_DIR = $(TARGET_DIR)/video
QUOTES_RU = $(PROJECT_DIR)/quotes/quotes_ru.csv
QUOTES_EN = $(PROJECT_DIR)/quotes/quotes_en.csv
QUOTES = ${QUOTES_RU} ${QUOTES_EN}
LITCLOCK_SCRIPT = litclock
LITCLOCK_MAN = litclock.1
all: build
build: build_json build_video
build_json: build_json_ru build_json_en
build_json_ru: ${QUOTES_RU}
@python build.py --filename $< --language ru --create-json --path ${JSON_DIR}/ru
build_json_en: ${QUOTES_EN}
@python build.py --filename $< --language en --create-json --path ${JSON_DIR}/en
build_video: build_video_ru build_video_en
build_video_ru: ${QUOTES_RU}
@python build.py --filename $< --language ru --create-video --path ${VIDEO_DIR}/ru
build_video_en: ${QUOTES_EN}
@python build.py --filename $< --language en --create-video --path ${VIDEO_DIR}/en
check: check-data check-man check-pep8
check-data: check_data_ru check_data_en
check_data_ru: ${QUOTES_RU}
@python build.py --filename $< --language ru --dry-run --create-json
check_data_en: ${QUOTES_EN}
@python build.py --filename $< --language en --dry-run --create-json
check-man: ${LITCLOCK_MAN}
@mandoc -Tlint $< -W style
check-pep8: build.py
@autopep8 --diff --exit-code $<
www: build_json
@python -m http.server 8000 --bind 127.0.0.1 -d ${TARGET_DIR}
install: ${LITCLOCK_SCRIPT} ${LITCLOCK_MAN} ${QUOTES}
install ${LITCLOCK_SCRIPT} ${PREFIX}/local/bin/${LITCLOCK_SCRIPT}
install ${LITCLOCK_MAN} ${PREFIX_MAN}/man1/${LITCLOCK_MAN}
install -d -m 755 ${PREFIX_DATA}/litclock
install -m 644 ${QUOTES} ${PREFIX_DATA}/litclock
clean:
@rm -rf ${VIDEO_DIR}/* ${JSON_DIR}/*
.PHONY: build build_json build_json_ru build_json_en
.PHONY: build_video build_video_ru build_video_en
.PHONY: check check-data check_data_ru check_data_en check-man check-pep8
.PHONY: install www clean