3 ### Build and setup script
5 ### (c) 2013 Mark Wooding
8 ###----- Licensing notice ---------------------------------------------------
10 ### This file is part of Chopwood: a password-changing service.
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.
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.
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/>.
26 ## Basic naming stuff.
28 VERSION = $(shell ./get-version)
30 ###--------------------------------------------------------------------------
31 ### The big list of source files.
33 ## The main source files.
44 SOURCES += httpauth.py
45 SOURCES += operation.py
48 SOURCES += subcommand.py
51 ## The command implementations.
52 SOURCES += cmd-admin.py
54 SOURCES += cmd-remote.py
55 SOURCES += cmd-user.py
57 ## Template HTML files.
58 SOURCES += about.fhtml
59 SOURCES += cookies.fhtml
60 SOURCES += error.fhtml
61 SOURCES += exception.fhtml
63 SOURCES += login.fhtml
64 SOURCES += operate.fhtml
65 SOURCES += wrapper.fhtml
67 ## Other static files.
71 ###--------------------------------------------------------------------------
79 ###--------------------------------------------------------------------------
80 ### Additional machinery.
87 v_tag = $(call v_tag_$V,$1)
88 v_tag_0 = @printf " %-8s %s\n" '$1' '$@';
90 ###--------------------------------------------------------------------------
91 ### The automatically-generated installation module.
93 TARGETS += auto.py auto-$(VERSION).py
95 auto-$(VERSION).py: Makefile get-version $(SOURCES) $(wildcard RELEASE)
97 { echo "### -*-python-*-"; \
98 echo "PACKAGE = '$(PACKAGE)'"; \
99 echo "VERSION = '$(VERSION)'"; \
100 echo "HOME = '$$(pwd)'"; \
101 } >$@.new && mv $@.new $@
103 auto.py: auto-$(VERSION).py
104 $(call v_tag,SYMLINK)\
105 rm -f auto.py.new && ln -s $^ auto.py.new && mv auto.py.new auto.py
106 $(V_AT)for i in auto-*.py; do \
107 case $$i in auto-$(VERSION).py) ;; *) rm -f $$i ;; esac; \
110 ###--------------------------------------------------------------------------
111 ### Generate the static files.
113 TARGETS += static/stamp
115 static/stamp: $(SOURCES) auto.py
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
121 clean::; rm -rf static
123 ###--------------------------------------------------------------------------
124 ### The standard rules.
128 CLEANFILES += $(TARGETS)
129 clean::; rm -f $(CLEANFILES)
132 ###--------------------------------------------------------------------------
135 distdir = $(PACKAGE)-$(VERSION)
137 DISTFILES = $(SOURCES)
139 DISTFILES += Makefile get-version
140 DISTFILES += userv.rc
145 cp $(DISTFILES) $(distdir)
146 echo $(VERSION) >$(distdir)/RELEASE
147 tar cvfz $(distdir).tar.gz $(distdir)
151 ###----- That's all, folks --------------------------------------------------