Commit | Line | Data |
---|---|---|
a2916c06 MW |
1 | ### -*-makefile-*- |
2 | ### | |
3 | ### Build and setup script | |
4 | ### | |
5 | ### (c) 2013 Mark Wooding | |
6 | ### | |
7 | ||
8 | ###----- Licensing notice --------------------------------------------------- | |
9 | ### | |
10 | ### This file is part of Chopwood: a password-changing service. | |
11 | ### | |
12 | ### Chopwood is free software; you can redistribute it and/or modify | |
13 | ### it under the terms of the GNU Affero General Public License as | |
14 | ### published by the Free Software Foundation; either version 3 of the | |
15 | ### License, or (at your option) any later version. | |
16 | ### | |
17 | ### Chopwood is distributed in the hope that it will be useful, | |
18 | ### but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | ### GNU Affero General Public License for more details. | |
21 | ### | |
22 | ### You should have received a copy of the GNU Affero General Public | |
23 | ### License along with Chopwood; if not, see | |
24 | ### <http://www.gnu.org/licenses/>. | |
25 | ||
26 | ## Basic naming stuff. | |
27 | PACKAGE = chopwood | |
28 | VERSION = $(shell ./get-version) | |
29 | ||
30 | ###-------------------------------------------------------------------------- | |
31 | ### The big list of source files. | |
32 | ||
33 | ## The main source files. | |
34 | SOURCES += chpwd | |
a6af9c27 | 35 | SOURCES += agpl.py |
a2916c06 MW |
36 | SOURCES += backend.py |
37 | SOURCES += cgi.py | |
38 | SOURCES += cmdutil.py | |
39 | SOURCES += config.py | |
40 | SOURCES += crypto.py | |
41 | SOURCES += dbmaint.py | |
42 | SOURCES += format.py | |
a6af9c27 | 43 | SOURCES += hash.py |
a2916c06 MW |
44 | SOURCES += httpauth.py |
45 | SOURCES += operation.py | |
46 | SOURCES += output.py | |
47 | SOURCES += service.py | |
48 | SOURCES += subcommand.py | |
49 | SOURCES += util.py | |
50 | ||
51 | ## The command implementations. | |
52 | SOURCES += cmd-admin.py | |
53 | SOURCES += cmd-cgi.py | |
54 | SOURCES += cmd-remote.py | |
55 | SOURCES += cmd-user.py | |
56 | ||
57 | ## Template HTML files. | |
58 | SOURCES += about.fhtml | |
59 | SOURCES += cookies.fhtml | |
60 | SOURCES += error.fhtml | |
61 | SOURCES += exception.fhtml | |
62 | SOURCES += list.fhtml | |
63 | SOURCES += login.fhtml | |
64 | SOURCES += operate.fhtml | |
65 | SOURCES += wrapper.fhtml | |
66 | ||
67 | ## Other static files. | |
68 | SOURCES += chpwd.css | |
69 | SOURCES += chpwd.js | |
70 | ||
71 | ###-------------------------------------------------------------------------- | |
72 | ### Default rules. | |
73 | ||
74 | all:: | |
75 | .PHONY: all | |
76 | ||
77 | CLEANFILES = *.pyc | |
78 | ||
79 | ###-------------------------------------------------------------------------- | |
fb306d6e MW |
80 | ### Additional machinery. |
81 | ||
82 | V = 0 | |
83 | ||
84 | V_AT = $(V_AT_$V) | |
85 | V_AT_0 = @ | |
86 | ||
87 | v_tag = $(call v_tag_$V,$1) | |
88 | v_tag_0 = @printf " %-8s %s\n" '$1' '$@'; | |
89 | ||
90 | ###-------------------------------------------------------------------------- | |
a2916c06 MW |
91 | ### The automatically-generated installation module. |
92 | ||
93 | TARGETS += auto.py auto-$(VERSION).py | |
94 | ||
ffd791da | 95 | auto-$(VERSION).py: Makefile get-version $(SOURCES) $(wildcard RELEASE) |
fb306d6e | 96 | $(call v_tag,GEN)\ |
a2916c06 MW |
97 | { echo "### -*-python-*-"; \ |
98 | echo "PACKAGE = '$(PACKAGE)'"; \ | |
99 | echo "VERSION = '$(VERSION)'"; \ | |
100 | echo "HOME = '$$(pwd)'"; \ | |
fb306d6e | 101 | } >$@.new && mv $@.new $@ |
a2916c06 MW |
102 | |
103 | auto.py: auto-$(VERSION).py | |
fb306d6e | 104 | $(call v_tag,SYMLINK)\ |
ffd791da | 105 | rm -f auto.py.new && ln -s $^ auto.py.new && mv auto.py.new auto.py |
fb306d6e | 106 | $(V_AT)for i in auto-*.py; do \ |
a2916c06 MW |
107 | case $$i in auto-$(VERSION).py) ;; *) rm -f $$i ;; esac; \ |
108 | done | |
109 | ||
110 | ###-------------------------------------------------------------------------- | |
111 | ### Generate the static files. | |
112 | ||
113 | TARGETS += static/stamp | |
114 | ||
115 | static/stamp: $(SOURCES) auto.py | |
fb306d6e MW |
116 | $(V_AT)rm -rf static.new |
117 | $(call v_tag,GEN)./chpwd static static.new | |
118 | $(V_AT)touch static.new/stamp | |
119 | $(V_AT)rm -rf static && mv static.new static | |
a2916c06 MW |
120 | |
121 | clean::; rm -rf static | |
122 | ||
123 | ###-------------------------------------------------------------------------- | |
124 | ### The standard rules. | |
125 | ||
126 | all:: $(TARGETS) | |
127 | ||
128 | CLEANFILES += $(TARGETS) | |
129 | clean::; rm -f $(CLEANFILES) | |
130 | .PHONY: clean | |
131 | ||
a4a97b6b MW |
132 | ###-------------------------------------------------------------------------- |
133 | ### Distributions. | |
134 | ||
135 | distdir = $(PACKAGE)-$(VERSION) | |
136 | ||
137 | DISTFILES = $(SOURCES) | |
138 | DISTFILES += AGPLv3 | |
139 | DISTFILES += Makefile get-version | |
140 | DISTFILES += userv.rc | |
141 | ||
142 | dist: | |
143 | rm -rf $(distdir) | |
144 | mkdir $(distdir) | |
145 | cp $(DISTFILES) $(distdir) | |
146 | echo $(VERSION) >$(distdir)/RELEASE | |
147 | tar cvfz $(distdir).tar.gz $(distdir) | |
148 | rm -rf $(distdir) | |
149 | .PHONY: dist | |
150 | ||
a2916c06 | 151 | ###----- That's all, folks -------------------------------------------------- |