summaryrefslogtreecommitdiff
path: root/Makefile
blob: f4368195accb92c206b014d87f69407ef0eb2e49 (plain)
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
# android-issuetrackerredirect
#
# Define DATASTORE to the location where 'make serve' should store its
# runtime data files; by default this is /tmp/dev_appserver.datastore.
#
# Define REMOTE=1 to enable remote hosts to connect to the development
# web server started by 'make serve'.  This may be a security risk.
#
# Define EMAIL=1 to enable sending email messages during 'make serve'.
# This may spam invalid addresses, so it is off by default.
#
# Define APPID to the unique Google App Engine application instance
# 'make update' will upload the application files to.
#
# Define DEV_APPSERVER to the location of dev_appserver.py from the
# Google App Engine SDK download.
#
# Define APPCFG to the location of appcfg.py from the Google App
# Engine SDK download.
#

ifeq ($(shell uname),Darwin)
	DEV_APPSERVER := python2.5 /usr/local/bin/dev_appserver.py
else
	DEV_APPSERVER := dev_appserver.py
endif

APPID   = android-issuetrackerredirect
APPCFG  = appcfg.py
CPIO    = cpio -pd

-include config.mak

ifdef DATASTORE
	WEB_ARG += --datastore_path=$(DATASTORE)
endif
ifeq (1,$(REMOTE))
	WEB_ARG += --address 0.0.0.0
endif
ifeq (1,$(EMAIL))
	WEB_ARG += --enable_sendmail
endif

R_WEB      := release/web

WEB_INCLUDE := $(strip \
	app.yaml \
	index.yaml \
	redirect.py \
	static \
)

## Top level targets
##

all: web
release: release-web

clean:
	@rm -rf release *.pyc

## Web application
##

web:

serve: web
	$(DEV_APPSERVER) $(WEB_ARG) .

release-web: web
	@echo Building Android Issue Tracker Redirect `./GIT-VERSION-GEN`  for $(APPID):
	@rm -rf $(R_WEB)
	@mkdir -p $(R_WEB)
	@echo "  Copying loose files" && \
	 find $(WEB_INCLUDE) -print | $(CPIO) $(abspath $(R_WEB))
	@./GIT-VERSION-GEN >$(R_WEB)/static/application_version
	@perl -pi -e 's/(application:).*/$$1 $(APPID)/' $(R_WEB)/app.yaml
	@echo $(R_WEB) built for $(APPID).

update: release-web
	$(APPCFG) update $(R_WEB)

version:
	@printf '%s = ' '$(APPID)'
	@curl http://$(APPID).appspot.com/application_version