~nskaggs/help-app/functional-test-template

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
PY?=python
PELICAN?=pelican
PELICANOPTS=
APP_ARGS=

BASEDIR=$(CURDIR)
INTERNALS_DIR=$(BASEDIR)/internals
DOCS_DIR=$(BASEDIR)/content
PO_DIR=$(BASEDIR)/po
STATIC_DIR=$(BASEDIR)/static

CONFFILE=$(INTERNALS_DIR)/pelicanconf.py

BUILD_DIR=$(BASEDIR)/build
APP_DIR=$(BUILD_DIR)/app
OUTPUTDIR_APP=$(APP_DIR)/www
INPUTDIR=$(BUILD_DIR)/i18n/content

OUTPUTDIR_WEB=$(BUILD_DIR)/web/www
THEMEDIR_WEB=$(STATIC_DIR)/themes/web

DEBUG ?= 0
ifeq ($(DEBUG), 1)
	PELICANOPTS += -D
	APP_ARGS += --inspector
endif

MD_FILES=$(wildcard $(INPUTDIR)/pages/*.md)
PO_FILES=$(wildcard $(PO_DIR)/*.po)

ignored := $(shell bzr ignored | cut -d' ' -f1)

print-%:
	@echo -n '$*=$($*)'

clean:
ifneq ($(strip $(ignored)),)
	$(foreach fn, $(ignored), $(shell rm -r $(fn);))
endif

help:
	@echo 'Makefile for a pelican Web site                                        '
	@echo '                                                                       '
	@echo 'Usage:                                                                 '
	@echo '   make web                         (re)generate the (online) web site '
	@echo '   make app                         (re)generate the (offline) content ' 
	@echo '                                    for the phone app ("html" is an    '
	@echo '                                    alias)                             '
	@echo '   make click                       generate click for the phone app   '
	@echo '   make launch                      launch the phone app               '
	@echo '   make translations                generate translated markdown       '
	@echo '   make update-pot                  update the .pot file               '
	@echo '   make clean                       remove the generated files         '
	@echo '                                                                       '
	@echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html'
	@echo '                                                                       '

check:
	cd $(INTERNALS_DIR); ./run-tests
	cd $(INTERNALS_DIR); ./run-other-tests

translations:
	cd $(INTERNALS_DIR); ./generate-translations
	cp -r $(DOCS_DIR)/images/ $(INPUTDIR)

web: translations
	cd $(INTERNALS_DIR); $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR_WEB) -s $(CONFFILE) $(PELICANOPTS) -t $(THEMEDIR_WEB)

app: translations
	cd $(INTERNALS_DIR); $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR_APP) -s $(CONFFILE) $(PELICANOPTS)
	cp $(STATIC_DIR)/index.html $(OUTPUTDIR_APP)
	cp $(STATIC_DIR)/app/* $(APP_DIR)

html: app

click: app
	cd $(APP_DIR) && click build . && mv *.click $(BASEDIR)

launch: app
	cd $(APP_DIR); `grep '^Exec' help.desktop | tail -1 | sed 's/^Exec=//' | sed 's/%.//'` $(APP_ARGS) &

update-pot:
	cd $(INTERNALS_DIR) && ./generate-pot

web-publish: web
	cd $(INTERNALS_DIR) && ./web-publish

.PHONY: html help clean web check launch click app update-pot translations web-publish