-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
326 lines (274 loc) · 10.5 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
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
# This file is part of the Astrometry.net suite.
# Copyright 2006-2008 Dustin Lang, Keir Mierle and Sam Roweis.
# Copyright 2010, 2011, 2012, 2013 Dustin Lang.
#
# The Astrometry.net suite is free software; you can redistribute
# it and/or modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, version 2.
#
# The Astrometry.net suite is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with the Astrometry.net suite ; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# To set the install directory:
# make install INSTALL_DIR=/path/to/dir
# or see util/makefile.common
# Turn off optimisation? If the following line is commented-out, the default
# is to turn optimization on. See util/makefile.common for details.
#export OPTIMIZE = no
all:
BASEDIR := .
COMMON := $(BASEDIR)/util
# The internal Astrometry.net dependency stack, top to bottom, is:
#
# blind/libastrometry.a -- astrometry.net core
# catalogs/libcatalogs.a
# util/libanfiles.a -- astrometry.net index files, etc
# libkd/libkd.a -- kd-trees
# util/libanutils.a -- utilities
# gsl-an/libgsl-an.a OR system gsl -- GNU scientific library
# [wcslib] -- optional
# qfits-an/libqfits.a -- FITS files
# util/libanbase.a -- basic stuff
include $(COMMON)/makefile.common
#include $(COMMON)/makefile.qfits
#include $(COMMON)/makefile.cfitsio
.PHONY: all
all: subdirs
check: pkgconfig
.PHONY: check
# Just check that we have pkg-config, since it's needed to get
# wcslib, cfitsio, cairo, etc config information.
pkgconfig:
pkg-config --version || (echo -e "\nWe require the pkg-config package.\nGet it from http://www.freedesktop.org/wiki/Software/pkg-config" && false)
pkg-config --modversion cfitsio || (echo -e "\nWe require cfitsio but it was not found.\nGet it from http://heasarc.gsfc.nasa.gov/fitsio/\nOr on Ubuntu/Debian, apt-get install cfitsio-dev\nOr on Mac OS / Homebrew, brew install cfitsio\n" && false)
.PHONY: pkgconfig
subdirs: thirdparty
$(MAKE) -C util
$(MAKE) -C catalogs
$(MAKE) -C libkd
$(MAKE) -C blind
thirdparty: qfits-an
ifneq ($(SYSTEM_GSL),yes)
thirdparty: gsl-an
endif
doc:
$(MAKE) -C doc html
.PHONY: doc
html:
.PHONY: html
$(MAKE) -C doc html
qfits-an:
$(MAKE) -C qfits-an
gsl-an:
$(MAKE) -C gsl-an
.PHONY: subdirs thirdparty qfits-an gsl-an
# Targets that require extra libraries
extra:
$(MAKE) -C qfits-an
$(MAKE) -C util
$(MAKE) -C catalogs
$(MAKE) -C blind cairo
# Targets that create python bindings (requiring swig)
py: thirdparty
$(MAKE) -C catalogs
$(MAKE) -C util pyutil
$(MAKE) -C util cairoutils.o
$(MAKE) -C blind pyplotstuff
$(MAKE) -C libkd pyspherematch
$(MAKE) -C sdss
pyutil: thirdparty
$(MAKE) -C util pyutil
install: all report.txt
$(MAKE) install-core
@echo
@echo The following command may fail if you don\'t have the cairo, netpbm, and
@echo png libraries and headers installed. You will lose out on some eye-candy
@echo but will still be able to solve images.
@echo
-$(MAKE) extra
-$(MAKE) -C blind install-extra
@echo
@echo Errors in the previous make command are not fatal -- we try to build and install some optional code.
@echo
install-core:
mkdir -p '$(DATA_INSTALL_DIR)'
mkdir -p '$(BIN_INSTALL_DIR)'
mkdir -p '$(INSTALL_DIR)/doc'
mkdir -p '$(INCLUDE_INSTALL_DIR)'
mkdir -p '$(LIB_INSTALL_DIR)'
mkdir -p '$(INSTALL_DIR)/examples'
mkdir -p '$(PY_BASE_INSTALL_DIR)'
mkdir -p '$(INSTALL_DIR)/ups'
cp ups/astrometry_net.table-dist '$(INSTALL_DIR)/ups/astrometry_net.table'
cp ups/astrometry_net.cfg '$(INSTALL_DIR)/ups'
cp __init__.py '$(PY_BASE_INSTALL_DIR)'
cp CREDITS LICENSE README.md '$(INSTALL_DIR)/doc'
cp report.txt '$(INSTALL_DIR)/doc'
cp demo/* '$(INSTALL_DIR)/examples'
$(MAKE) -C util install
$(MAKE) -C catalogs install
$(MAKE) -C libkd install
$(MAKE) -C qfits-an install
$(MAKE) -C blind install
$(MAKE) -C sdss install
install-indexes:
mkdir -p '$(DATA_INSTALL_DIR)'
@for x in `ls index-*.tar.bz2 2>/dev/null`; do \
echo Installing $$x in '$(DATA_INSTALL_DIR)'...; \
echo tar xvjf $$x -C '$(DATA_INSTALL_DIR)'; \
tar xvjf $$x -C '$(DATA_INSTALL_DIR)'; \
done
@for x in `ls index-*.bz2 | grep -v tar.bz2 2>/dev/null`; do \
echo Installing $$x in '$(DATA_INSTALL_DIR)'...; \
echo "cp $$x '$(DATA_INSTALL_DIR)' && bunzip2 --force '$(DATA_INSTALL_DIR)/'$$x;"; \
cp $$x '$(DATA_INSTALL_DIR)' && bunzip2 --force '$(DATA_INSTALL_DIR)/'$$x; \
done
@for x in `ls index-*.tar.gz 2>/dev/null`; do \
echo Installing $$x in '$(DATA_INSTALL_DIR)'...; \
echo tar xvzf $$x -C '$(DATA_INSTALL_DIR)'; \
tar xvzf $$x -C '$(DATA_INSTALL_DIR)'; \
done
@for x in `ls index-*.fits 2>/dev/null`; do \
echo Installing $$x in '$(DATA_INSTALL_DIR)'...; \
echo "cp $$x '$(DATA_INSTALL_DIR)'" \
cp $$x '$(DATA_INSTALL_DIR)' \
done
reconfig:
-rm -f util/os-features-config.h util/makefile.os-features
$(MAKE) -C util config
.PHONY: reconfig
config: util/os-features-config.h util/makefile.os-features
$(MAKE) -C util config
.PHONY: config
RELEASE_VER := 0.48
RELEASE_DIR := astrometry.net-$(RELEASE_VER)
RELEASE_SVN := svn+ssh://astrometry.net/svn/tags/tarball-$(RELEASE_VER)/astrometry
RELEASE_SUBDIRS := qfits-an gsl-an util libkd blind demo catalogs etc ups sdss
release:
-rm -R $(RELEASE_DIR) $(RELEASE_DIR).tar $(RELEASE_DIR).tar.gz $(RELEASE_DIR).tar.bz2
svn export -N $(RELEASE_SVN) $(RELEASE_DIR)
for x in $(RELEASE_SUBDIRS); do \
svn export $(RELEASE_SVN)/$$x $(RELEASE_DIR)/$$x; \
done
(cd $(RELEASE_DIR)/util && swig -python -I. util.i)
(cd $(RELEASE_DIR)/util && swig -python -I. index.i)
(cd $(RELEASE_DIR)/blind && swig -python -I. -I../util -I../qfits-an plotstuff.i)
(cd $(RELEASE_DIR)/sdss && swig -python -I. cutils.i)
tar cf $(RELEASE_DIR).tar $(RELEASE_DIR)
gzip --best -c $(RELEASE_DIR).tar > $(RELEASE_DIR).tar.gz
bzip2 --best $(RELEASE_DIR).tar
SNAPSHOT_SVN := svn+ssh://astrometry.net/svn/trunk/src/astrometry
SNAPSHOT_SUBDIRS := $(RELEASE_SUBDIRS)
.PHONY: snapshot
snapshot:
-rm -R snapshot snapshot.tar
svn export -N $(SNAPSHOT_SVN) snapshot
for x in $(SNAPSHOT_SUBDIRS); do \
svn export $(SNAPSHOT_SVN)/$$x snapshot/$$x; \
done
(cd snapshot/util && swig -python -I. util.i)
(cd snapshot/util && swig -python -I. index.i)
(cd snapshot/blind && swig -python -I. -I../util -I../qfits-an plotstuff.i)
(cd snapshot/sdss && swig -python -I. cutils.i)
SSD=astrometry.net-$(shell svn info $(SNAPSHOT_SVN) | $(AWK) -F": " /^Revision/'{print $$2}'); \
mv snapshot $$SSD; \
tar cf snapshot.tar $$SSD; \
gzip --best -c snapshot.tar > $$SSD.tar.gz; \
bzip2 --best -c snapshot.tar > $$SSD.tar.bz2
LIBKD_RELEASE_DIR := libkd-$(RELEASE_VER)
LIBKD_RELEASE_SUBDIRS := qfits-an libkd doc \
CREDITS LICENSE __init__.py setup-libkd.py Makefile \
util/ioutils.c util/mathutil.c util/fitsioutils.c util/fitsbin.h \
util/ioutils.h util/mathutil.h util/fitsioutils.h util/fitsbin.c \
util/an-endian.c util/fitsfile.c util/log.c util/errors.c util/tic.c \
util/an-endian.h util/fitsfile.h util/log.h util/errors.h util/tic.h \
util/bl.c util/bl.inc util/bl-nl.c util/bl-nl.inc \
util/bl.h util/bl.ph util/bl-nl.h util/bl-nl.ph \
util/keywords.h util/an-bool.h util/mathutil.inc util/starutil.h \
util/an-thread.h util/an-thread-pthreads.h util/thread-specific.inc \
util/__init__.py util/starutil_numpy.py util/makefile.common
release-libkd:
-rm -R $(LIBKD_RELEASE_DIR) $(LIBKD_RELEASE_DIR).tar $(LIBKD_RELEASE_DIR).tar.gz $(LIBKD_RELEASE_DIR).tar.bz2
svn export --depth files $(RELEASE_SVN) $(LIBKD_RELEASE_DIR)
svn export --depth empty $(RELEASE_SVN)/util $(LIBKD_RELEASE_DIR)/util
for x in $(LIBKD_RELEASE_SUBDIRS); do \
svn export $(RELEASE_SVN)/$$x $(LIBKD_RELEASE_DIR)/$$x; \
done
tar cf $(LIBKD_RELEASE_DIR).tar $(LIBKD_RELEASE_DIR)
gzip --best -c $(LIBKD_RELEASE_DIR).tar > $(LIBKD_RELEASE_DIR).tar.gz
bzip2 --best $(LIBKD_RELEASE_DIR).tar
LIBKD_SNAPSHOT_DIR := snapshot-libkd
snapshot-libkd:
-rm -R $(LIBKD_SNAPSHOT_DIR)
svn export --depth empty $(SNAPSHOT_SVN) $(LIBKD_SNAPSHOT_DIR)
svn export --depth empty $(SNAPSHOT_SVN)/util $(LIBKD_SNAPSHOT_DIR)/util
for x in $(LIBKD_RELEASE_SUBDIRS); do \
svn export $(SNAPSHOT_SVN)/$$x $(LIBKD_SNAPSHOT_DIR)/$$x; \
done
SSD=libkd-$(shell svn info $(SNAPSHOT_SVN) | $(AWK) -F": " /^Revision/'{print $$2}'); \
mv $(LIBKD_SNAPSHOT_DIR) $$SSD; \
tar cf $(LIBKD_SNAPSHOT_DIR).tar $$SSD; \
gzip --best -c $(LIBKD_SNAPSHOT_DIR).tar > $$SSD.tar.gz; \
bzip2 --best -c $(LIBKD_SNAPSHOT_DIR).tar > $$SSD.tar.bz2
tag-release:
svn copy svn+ssh://astrometry.net/svn/trunk/src svn+ssh://astrometry.net/svn/tags/tarball-$(RELEASE_VER)
retag-release:
-svn rm svn+ssh://astrometry.net/svn/tags/tarball-$(RELEASE_VER) \
-m "Remove old release tag in preparation for re-tagging"
svn copy svn+ssh://astrometry.net/svn/trunk/src svn+ssh://astrometry.net/svn/tags/tarball-$(RELEASE_VER)
test:
$(MAKE) -C blind test
$(MAKE) -C util test
$(MAKE) -C catalogs test
$(MAKE) -C libkd test
clean:
$(MAKE) -C util clean
$(MAKE) -C catalogs clean
-$(MAKE) -C qfits-an clean
-rm __init__.pyc
$(MAKE) -C gsl-an clean
-rm gsl-an/config.h
$(MAKE) -C libkd clean
$(MAKE) -C blind clean
$(MAKE) -C sdss clean
realclean: clean
TAGS:
etags -I `find . -name "*.c" -o -name "*.h"`
tags:
ctags-exuberant --fields=+aiKS --c++-kinds=+p --extra=+q -I --file-scope=no -R *
report:
-uname -m
-uname -a
-uname -p
-uname -s
@echo "CC is $(CC)"
-which $(CC)
-$(CC) --version
-$(MAKE) --version
-$(CC) -dM -E - < /dev/null
-cat /proc/cpuinfo
-sysctl -a kern.ostype kern.osrelease kern.version kern.osversion hw.machine hw.model hw.ncpu hw.byteorder hw.physmem hw.cpufrequency hw.memsize hw.optional.x86_64 hw.cpu64bit_capable machdep.cpu.brand_string
-free
@echo "SHAREDLIBFLAGS_DEF: $(SHAREDLIBFLAGS_DEF)"
@echo "FLAGS_DEF: $(FLAGS_DEF)"
@echo "CFLAGS_DEF: $(CFLAGS_DEF)"
@echo "LDFLAGS_DEF: $(LDFLAGS_DEF)"
-python -V
@echo "PYTHONPATH: $${PYTHONPATH}"
@echo "PATH: $${PATH}"
@echo "pkg-config --cflags cfitsio:"
-pkg-config --cflags cfitsio
@echo "pkg-config --libs cfitsio:"
-pkg-config --libs cfitsio
@echo "pkg-config --cflags cairo:"
-pkg-config --cflags cairo
@echo "pkg-config --libs cairo: "
-pkg-config --libs cairo
report.txt: Makefile
$(MAKE) report > $@
.SUFFIXES: # Delete the default suffixes