Fix leap second stuff
[phoros.git] / Makefile
blob393facc9047f3e3bbd550d2b0c307c91c5455186
1 # PHOROS -- Photogrammetric Road Survey
2 # Copyright (C) 2010, 2011, 2012, 2015, 2017 Bert Burgemeister
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License along
15 # with this program; if not, write to the Free Software Foundation, Inc.,
16 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 LISP = $(shell test -x ../sbcl/bin/sbcl && echo ../sbcl/bin/sbcl || which sbcl)
19 LIBPHOML_DIR = phoml/lib
20 LIBPHOML = libphoml.so
21 LIBIMREAD = imread.so
22 OPENLAYERS_TARBALL = OpenLayers-2.10.tar.gz
23 PRISTINE_OPENLAYERS_DIR = OpenLayers-2.10
24 EXAMPLES_DIR = examples
25 ETC_DIR = etc
26 OPENLAYERS_DIR = ol #for compiled/shrunk OpenLayers
27 OPENLAYERS_CONFIG = phoros.cfg
28 OPENLAYERS_JS = ol/OpenLayers.js
29 OPENLAYERS_THEME = ol/theme
30 OPENLAYERS_IMG = ol/img
31 LOGO = public_html/phoros-logo-plain.png
32 BUTTON_IMAGE = public_html/phoros-logo-button.png
33 BACKGROUND_IMAGE = public_html/phoros-logo-background.png
34 CURSOR_IMAGE = public_html/phoros-cursor.png
35 FAVICON = public_html/favicon.ico
36 INDEX_HTML = public_html/index.html
37 PHOROS_HELP_HTML = public_html/phoros--help.html
38 DEPLOYMENT_HTML = public_html/deployment.html
39 PUBLIC_CSS = public_html/style.css
40 NOT_FOUND_HTML = public_html/404.html
41 PHOROS_VERSION = $(shell ./phoros --version)
42 LATEST_TAG = $(shell git describe)
43 MACHINE_TYPE = $(shell uname -m)
44 PHOROS_HELP_OUTPUT = phoros-help.txt
45 SOURCE = *.lisp *.asd Makefile
47 all : fasttrack phoros
49 phoros : $(SOURCE) photogrammetry_lib $(OPENLAYERS_JS) \
50 $(OPENLAYERS_THEME) $(OPENLAYERS_IMG) \
51 $(BACKGROUND_IMAGE) $(LOGO) $(FAVICON) $(CURSOR_IMAGE) \
52 $(LIBIMREAD)
53 CC=gcc \
54 $(LISP) --lose-on-corruption \
55 --disable-ldb \
56 --dynamic-space-size 4096 \
57 --end-runtime-options \
58 --disable-debugger \
59 --eval '(progn (pushnew :build-phoros *features*) (load "make.lisp"))'
61 fasttrack : $(SOURCE) photogrammetry_lib \
62 $(BACKGROUND_IMAGE) $(LOGO) $(BUTTON_IMAGE)
63 CC=gcc \
64 $(LISP) --lose-on-corruption \
65 --disable-ldb \
66 --dynamic-space-size 4096 \
67 --end-runtime-options \
68 --disable-debugger \
69 --eval '(progn (pushnew :build-fasttrack *features*) (load "make.lisp"))'
71 $(OPENLAYERS_TARBALL) :
72 wget https://github.com/openlayers/openlayers/releases/download/release-2.10/$@
74 $(PRISTINE_OPENLAYERS_DIR)/lib/* : $(OPENLAYERS_TARBALL)
75 tar -xmzf $<
77 $(OPENLAYERS_JS) : $(PRISTINE_OPENLAYERS_DIR)/build/OpenLayers.js
78 mkdir -p $(OPENLAYERS_DIR) && cp $< $@
80 $(PRISTINE_OPENLAYERS_DIR)/build/OpenLayers.js : \
81 $(PRISTINE_OPENLAYERS_DIR)/lib/* $(OPENLAYERS_CONFIG)
82 cp $(OPENLAYERS_CONFIG) $(PRISTINE_OPENLAYERS_DIR)/build/ && \
83 cd $(PRISTINE_OPENLAYERS_DIR)/build && ./build.py $(OPENLAYERS_CONFIG)
84 ###### cd $(PRISTINE_OPENLAYERS_DIR)/build && ./build.py full.cfg
86 .INTERMEDIATE : $(PRISTINE_OPENLAYERS_DIR)/build/OpenLayers.js
88 $(OPENLAYERS_THEME) : $(PRISTINE_OPENLAYERS_DIR)/theme $(OPENLAYERS_JS)
89 cp -R $< $@
91 $(OPENLAYERS_IMG) : $(PRISTINE_OPENLAYERS_DIR)/img $(OPENLAYERS_JS)
92 cp -R $< $@
94 photogrammetry_lib :
95 cd phoml; $(MAKE)
97 public_html :
98 mkdir -p public_html
100 $(LOGO) : Makefile public_html
101 ! convert \
102 -size 113x125 xc:transparent \
103 -font Gentium \
104 -fill black \
105 -pointsize 200 -gravity center -draw "text 3,3 'Φ'" \
106 -pointsize 57 -gravity center -draw "text 23,2 'Σ'" \
107 $@ 2>&1 | grep convert:
108 $(BUTTON_IMAGE) : Makefile public_html
109 ! convert \
110 -size 113x125 xc:transparent \
111 -font Gentium \
112 -fill navy \
113 -pointsize 200 -gravity center -draw "text 3,3 'Φ'" \
114 -pointsize 57 -gravity center -draw "text 23,2 'Σ'" \
115 -resize 40% \
116 $@ 2>&1 | grep convert:
118 $(BACKGROUND_IMAGE) : Makefile public_html
119 ! convert \
120 -size 113x125 xc:transparent \
121 -font Gentium \
122 -fill "#f5f5f5" \
123 -pointsize 200 -gravity center -draw "text 3,3 'Φ'" \
124 -pointsize 57 -gravity center -draw "text 23,2 'Σ'" \
125 -resize 150% \
126 $@ 2>&1 | grep convert:
127 $(CURSOR_IMAGE) : Makefile public_html
128 ! convert \
129 -size 14x16 xc:transparent \
130 -font Gentium \
131 -fill Navy \
132 -pointsize 22 -gravity center -draw "text 0.21,1 'Φ'" \
133 -pointsize 7 -gravity center -draw "text 1.61,.1 'Σ'" \
134 $@ 2>&1 | grep convert:
135 # Font Gentium is in Debian package fonts-sil-gentium.
137 $(FAVICON) : favicon.png
138 icotool -c -o $@ $<
140 favicon.png : $(LOGO)
141 convert $< -resize 16x16 $@
143 .INTERMEDIATE : favicon.png
145 $(PHOROS_HELP_OUTPUT) : phoros
146 ./phoros --help > $@
148 .INTERMEDIATE : $(PHOROS_HELP_OUTPUT)
150 $(INDEX_HTML) : doc/index.org $(LOGO)
151 emacs --batch --visit=$< --eval '(progn (org-html-export-as-html) (write-file "../$@"))'
153 $(DEPLOYMENT_HTML) : doc/deployment.org $(LOGO)
154 emacs --batch --visit=$< --eval '(progn (org-html-export-as-html) (write-file "../$@"))'
156 $(PHOROS_HELP_HTML) : doc/phoros--help.org $(PHOROS_HELP_OUTPUT) $(LOGO)
157 emacs --batch --visit=$< --eval '(progn (org-html-export-as-html) (write-file "../$@"))'
159 $(PUBLIC_CSS) : doc/style.css public_html
160 cp $< $@
162 $(NOT_FOUND_HTML) : doc/404.org $(LOGO)
163 emacs --batch --visit=$< --eval '(progn (org-html-export-as-html) (write-file "../$@"))'
165 phoros-proper.tar :
166 git archive --prefix=phoros_$(LATEST_TAG)/ --output=$@ $(LATEST_TAG)
168 phoml.tar :
169 cd phoml \
170 && git archive --prefix=phoros_$(LATEST_TAG)/phoml/ --output=../$@ HEAD
172 .INTERMEDIATE : phoros-proper.tar phoml.tar
174 bin-tarball : phoros TimeSteps.history fasttrack README \
175 $(EXAMPLES_DIR) \
176 $(ETC_DIR) \
177 $(OPENLAYERS_DIR) \
178 $(BACKGROUND_IMAGE) $(LOGO) $(FAVICON) $(CURSOR_IMAGE) \
179 $(LIBPHOML_DIR)/$(LIBPHOML) \
180 $(LIBIMREAD)
181 tar -cf - \
182 --transform='s,^,phoros_$(PHOROS_VERSION)/,' \
183 phoros TimeSteps.history fasttrack fasttrack.ui README \
184 $(EXAMPLES_DIR) \
185 $(ETC_DIR) \
186 $(OPENLAYERS_DIR) \
187 $(BACKGROUND_IMAGE) $(LOGO) $(FAVICON) $(CURSOR_IMAGE) \
188 $(BUTTON_IMAGE) \
189 $(LIBIMREAD) \
190 --directory=$(LIBPHOML_DIR) $(LIBPHOML) \
191 | gzip -f \
192 > phoros_$(PHOROS_VERSION)_$(MACHINE_TYPE).tar.gz
194 src-tarball : phoros-proper.tar phoml.tar
195 tar --concatenate -f phoros_$(LATEST_TAG).tar $^ \
196 && gzip -f phoros_$(LATEST_TAG).tar
198 html : $(INDEX_HTML) $(DEPLOYMENT_HTML) $(PHOROS_HELP_HTML) $(PUBLIC_CSS) $(FAVICON) $(NOT_FOUND_HTML)
200 git-tag : phoros #tag name is :version string in phoros.asd
201 git tag -a $(PHOROS_VERSION) -m ""
203 imread : imread.c Makefile #for debugging
204 gcc imread.c -O2 -o imread `pkg-config --cflags --libs libpng libjpeg` -lm
206 $(LIBIMREAD) : imread.c Makefile
207 gcc -fpic -shared -O2 -o imread.so `pkg-config --cflags --libs libpng libjpeg` -lm imread.c
209 clean :
210 rm -rf *.fasl *.log \
211 phoros phoros*.tar.gz \
212 fasttrack fasttrack.ui \
213 $(LIBIMREAD) imread \
214 $(LOGO) $(BACKGROUND_IMAGE) $(FAVICON) $(CURSOR_IMAGE) \
215 $(BUTTON_IMAGE) \
216 $(PHOROS_HELP_OUTPUT) \
217 $(INDEX_HTML) $(DEPLOYMENT_HTML) \
218 $(PUBLIC_CSS)
219 rm -rf $(OPENLAYERS_DIR) $(PRISTINE_OPENLAYERS_DIR)
220 cd phoml; $(MAKE) clean
223 .PHONY : bin-tarball src-tarball html git-tag clean
226 # Github
228 gh-publish:
229 rm -rf gh-pages
230 mkdir gh-pages
231 $(MAKE) gh-pages/index.html \
232 gh-pages/deployment.html \
233 gh-pages/phoros--help.html \
234 gh-pages/phoros-12.8.1.png \
235 gh-pages/phoros-logo-plain.png \
236 gh-pages/404.html \
237 gh-pages/CNAME \
238 gh-pages/README \
239 gh-pages/favicon.ico \
240 gh-pages/robots.txt \
241 gh-pages/style.css
242 cd gh-pages; git init; git add ./; git commit -a -m "gh-pages pseudo commit"; git push git@github.com:trebb/phoros.git +master:gh-pages
244 gh-pages/%.html: public_html/%.html
245 cp $< $@
247 gh-pages/favicon.ico: public_html/favicon.ico
248 cp $< $@
250 gh-pages/phoros-logo-plain.png: public_html/phoros-logo-plain.png
251 cp $< $@
253 gh-pages/%: doc/%
254 cp $< $@