-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (33 loc) · 1.61 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
# -*- Makefile -*-
-include $(buildTop)/share/dws/prefix.mk
srcDir ?= $(realpath .)
objDir ?= $(realpath .)/build
installTop ?= $(VIRTUAL_ENV)
binDir ?= $(installTop)/bin
SYSCONFDIR := $(installTop)/etc
LOCALSTATEDIR := $(installTop)/var
CONFIG_DIR := $(SYSCONFDIR)/$(APP_NAME)
PYTHON := $(binDir)/python
APP_NAME := $(notdir $(srcDir))
all::
@echo "Nothing to be done for 'make'."
install:: install-conf
install-conf:: $(DESTDIR)$(SYSCONFDIR)/$(APP_NAME)/credentials \
$(DESTDIR)$(SYSCONFDIR)/$(APP_NAME)/site.conf
install -d $(DESTDIR)$(LOCALSTATEDIR)/log/gunicorn
# Implementation Note:
# We use [ -f file ] before install here such that we do not blindly erase
# already present configuration files with template ones.
$(DESTDIR)$(SYSCONFDIR)/%/site.conf: $(srcDir)/etc/site.conf
install -d $(dir $@)
[ -f $@ ] || \
sed -e 's,%(LOCALSTATEDIR)s,$(LOCALSTATEDIR),' \
-e 's,%(APP_NAME)s,$(APP_NAME),' \
$< > $@
$(DESTDIR)$(SYSCONFDIR)/%/credentials: $(srcDir)/etc/credentials
install -d $(dir $@)
[ -f $@ ] || \
sed -e "s,\%(SECRET_KEY)s,$(if $(SECRET_KEY),$(SECRET_KEY),$(shell $(PYTHON) -c 'import sys ; from random import choice ; sys.stdout.write("".join([choice("abcdefghijklmnopqrstuvwxyz0123456789!@#$%^*-_=+") for i in range(50)]))' ))," \
-e "s,\%(DJAODJIN_SECRET_KEY)s,$(if $(DJAODJIN_SECRET_KEY),$(DJAODJIN_SECRET_KEY),$(shell $(PYTHON) -c 'import sys ; from random import choice ; sys.stdout.write("".join([choice("abcdefghijklmnopqrstuvwxyz0123456789!@#$%^*-_=+") for i in range(50)]))' ))," \
$< > $@
-include $(buildTop)/share/dws/suffix.mk