source: trunk/src/astrometry/util/Makefile @ 12099

Revision 12099, 7.5 KB checked in by dstn, 15 months ago (diff)

add pad-file

Line 
1# This file is part of the Astrometry.net suite.
2# Copyright 2006, 2007 Dustin Lang, Keir Mierle and Sam Roweis.
3#
4# The Astrometry.net suite is free software; you can redistribute
5# it and/or modify it under the terms of the GNU General Public License
6# as published by the Free Software Foundation, version 2.
7#
8# The Astrometry.net suite is distributed in the hope that it will be
9# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11# General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with the Astrometry.net suite ; if not, write to the Free Software
15# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
16
17BASEDIR := ..
18COMMON := .
19
20all:
21.PHONY: all
22
23# You can build stripped-down versions of the AN libraries that do not
24# depend on libkd or libqfits by defining the following in your Makefile
25# before calling make in the an-common directory:
26#   NO_KDTREE := 1
27#   export NO_KDTREE
28#   NO_QFITS := 1
29#   export NO_QFITS
30
31include $(COMMON)/makefile.common
32ifndef NO_QFITS
33include $(COMMON)/makefile.qfits
34endif
35ifndef NO_KDTREE
36include $(COMMON)/makefile.libkd
37endif
38
39include $(COMMON)/makefile.cairo
40include $(COMMON)/makefile.jpeg
41include $(COMMON)/makefile.netpbm
42include $(COMMON)/makefile.gsl
43
44CFLAGS += $(CFLAGS_DEF)
45CFLAGS += $(CAIRO_INC)
46CFLAGS += $(NETPBM_INC)
47CFLAGS += $(JPEG_INC)
48CFLAGS += $(GSL_INC)
49
50LDFLAGS += $(LDFLAGS_DEF)
51LDFLAGS += -lm
52
53ifndef NO_QFITS
54CFLAGS += $(QFITS_INC)
55endif
56ifndef NO_KDTREE
57CFLAGS += $(LIBKD_INC)
58endif
59CFLAGS += -I.
60
61ANFILES_LIB := libanfiles.a
62ANUTILS_LIB := libanutils.a
63
64PYTHON_LIBS := _sip.so _healpix.so
65
66PROGS := an-fitstopnm downsample-fits pad-file
67
68all: $(ANUTILS_LIB) $(ANFILES_LIB) $(PYTHON_LIBS) $(PROGS)
69
70# Things that it depends on but which aren't linked in
71ANUTILS_DEPS :=
72
73ANUTILS_OBJ := starutil.o mathutil.o bl.o bt.o healpix-utils.o healpix.o \
74        permutedsort.o ioutils.o sip.o sip-utils.o md5.o constellations.o \
75        gnu-specific.o an-endian.o errors.o an-opts.o svn.o tic.o log.o \
76        gslutils.o
77ifndef NO_QFITS
78ANUTILS_OBJ += fitsioutils.o sip_qfits.o fitstable.o fitsbin.o fitsfile.o
79ANUTILS_DEPS += $(QFITS_LIB)
80endif
81ifndef NO_KDTREE
82ANUTILS_OBJ += dualtree.o dualtree_rangesearch.o dualtree_nearestneighbour.o
83endif
84
85# Things that it depends on but which aren't linked in
86ANFILES_DEPS :=
87
88ANFILES_OBJ :=
89ifndef NO_QFITS
90ANFILES_OBJ += index.o codekd.o starkd.o rdlist.o xylist.o \
91        starxy.o an-catalog.o qidxfile.o quadfile.o scamp-catalog.o
92ANFILES_DEPS += $(QFITS_LIB)
93endif
94
95MISC_OBJ := grab-stellarium-constellations.o
96
97ALL_OBJ := $(ANUTILS_OBJ) $(ANFILES_OBJ) $(MISC_OBJ)
98
99# svn.c depends on all the .c and .h files in ANUTILS_OBJ
100SVN_C_DEPS := $(subst svn.o,,$(ANUTILS_OBJ))
101SVN_C_DEPS := $(subst .o,.c,$(SVN_C_DEPS)) $(subst .o,.h,$(SVN_C_DEPS))
102
103svn.c: $(SVN_C_DEPS)
104        echo "//" >> svn.c
105
106$(ANUTILS_LIB): $(ANUTILS_OBJ) $(ANUTILS_DEPS)
107        -rm -f $@
108        $(AR) rc $@ $(ANUTILS_OBJ)
109        $(RANLIB) $@
110
111$(ANFILES_LIB): $(ANFILES_OBJ) $(ANFILES_DEPS)
112        -rm -f $@
113        $(AR) rc $@ $(ANFILES_OBJ)
114        $(RANLIB) $@
115
116SHAREDLIBFLAGS := $(SHAREDLIBFLAGS_DEF)
117
118_sip.so: sip-utils.o sip.o starutil.o mathutil.o sip_qfits.o \
119                fitsioutils.o ioutils.o bl.o gnu-specific.o an-endian.o \
120                errors.o log.o $(QFITS_LIB)
121        $(CC) $(SHAREDLIBFLAGS) -o $@ $^
122
123_healpix.so: healpix.o starutil.o mathutil.o errors.o bl.o log.o
124        $(CC) $(SHAREDLIBFLAGS) -o $@ $^
125
126pad-file: pad-file.o $(ANUTILS_LIB)
127
128an-fitstopnm: an-fitstopnm.o $(ANUTILS_LIB) $(QFITS_LIB)
129
130downsample-fits: downsample-fits.o $(ANUTILS_LIB) $(QFITS_LIB)
131
132ALL_OBJ += an-fitstopnm.o
133
134PYTHON_INSTALL := fits2fits.py image2pnm.py healpix.py sip.py starutil.py \
135        shell.py __init__.py file.py run_command.py w3c_validator.py \
136        filetype.py \
137        $(PYTHON_LIBS)
138
139PYTHON_EXECS := fits2fits.py image2pnm.py
140
141PY_INSTALL_DIR := $(INSTALL_DIR)/python/astrometry/util
142BIN_INSTALL_DIR := $(INSTALL_DIR)/bin
143LINK_DIR := ../python/astrometry/util
144
145install: $(PYTHON_LIBS)
146        @echo Installing in base directory $(INSTALL_DIR)
147        mkdir -p $(PY_INSTALL_DIR)
148        @for x in $(PYTHON_INSTALL); do \
149                echo cp $$x $(PY_INSTALL_DIR)/$$x; \
150                cp $$x $(PY_INSTALL_DIR)/$$x; \
151        done
152        @echo Making symlinks in directory $(BIN_INSTALL_DIR)
153        mkdir -p $(BIN_INSTALL_DIR)
154        @for x in $(PYTHON_EXECS); do \
155                echo ln -f -s $(PY_INSTALL_DIR)/$$x $(BIN_INSTALL_DIR)/$$x; \
156                ln -f -s $(LINK_DIR)/$$x $(BIN_INSTALL_DIR)/$$x; \
157        done
158        @echo Installing executables into $(BIN_INSTALL_DIR)...
159        @for x in $(PROGS); do \
160                echo cp $$x $(BIN_INSTALL_DIR)/$$x; \
161                cp $$x $(BIN_INSTALL_DIR)/$$x; \
162        done
163
164gnu-specific-config.h: gnu-specific-test.c
165        ( \
166        (($(CC) -o gnu-specific-test-canonicalize \
167                $(CFLAGS) -DTEST_CANONICALIZE_FILE_NAME $(LDFLAGS) $^  > /dev/null && \
168          ./gnu-specific-test-canonicalize) \
169        || echo "#define NEED_CANONICALIZE_FILE_NAME 1") \
170        ; \
171         (($(CC) -o gnu-specific-test-declare-qsort \
172                $(CFLAGS) -DTEST_DECLARE_QSORT_R $(LDFLAGS) $^ > /dev/null && \
173          ./gnu-specific-test-declare-qsort) \
174        || echo "#define NEED_DECLARE_QSORT_R 0") \
175        ; \
176         (($(CC) -o gnu-specific-test-qsort \
177                $(CFLAGS) -DTEST_QSORT_R $(LDFLAGS) $^ > /dev/null && \
178          ./gnu-specific-test-qsort) \
179        || echo "#define NEED_QSORT_R 1") \
180        ; \
181         (($(CC) -o gnu-specific-test-swap-qsort \
182                $(CFLAGS) -DTEST_SWAP_QSORT_R $(LDFLAGS) $^ > /dev/null && \
183          ./gnu-specific-test-swap-qsort) \
184        || echo "#define NEED_SWAP_QSORT_R 0") \
185        ; \
186        echo) | grep -v "Segmentation" > $@
187
188ALL_OBJ += gnu-specific.o
189ALL_TARGETS := gnu-specific-test.o \
190        gnu-specific-test-canonicalize \
191        gnu-specific-test-declare-qsort \
192        gnu-specific-test-qsort \
193        gnu-specific-config.h
194
195DEP_OBJ := $(ANUTILS_OBJ) $(ANFILES_OBJ) $(MISC_OBJ)
196ifndef NO_QFITS
197DEP_PREREQS := $(QFITS_LIB)
198endif
199include $(COMMON)/makefile.deps
200
201stellarium-constellations.c:
202        -$(MAKE) grab-stellarium-constellations
203        -(./grab-stellarium-constellations > $@.tmp  &&  mv $@.tmp $@) || touch $@
204
205grab-stellarium-constellations: grab-stellarium-constellations.o \
206                starutil.o mathutil.o bl.o an-endian.o
207        $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $^ -lm
208
209### TESTS
210
211ALL_TEST_FILES = test_bl test_bt test_endian test_fitstable test_xylist \
212        test_rdlist test_healpix test_fitsioutils test_fitsbin test_log test_ioutils \
213        test_dualtree_nn test_scamp_catalog test_starutil test_svd
214ALL_TEST_EXTRA_OBJS =
215ALL_TEST_LIBS = $(LIBKD_LIB) $(ANFILES_LIB) $(ANUTILS_LIB) $(QFITS_LIB) $(GSL_LIB)
216
217include $(COMMON)/makefile.tests
218
219DEP_OBJ += $(ALL_TEST_FILES_O)
220
221test_fitstable: $(ANFILES_LIB) $(ANUTILS_LIB) $(QFITS_LIB)
222
223test_fitsbin: $(ANFILES_LIB) $(ANUTILS_LIB) $(QFITS_LIB)
224
225test_fitsioutils: $(ANUTILS_LIB) $(QFITS_LIB)
226
227test_xylist: $(ANFILES_LIB) $(ANUTILS_LIB) $(QFITS_LIB)
228
229test_rdlist: $(ANFILES_LIB) $(ANUTILS_LIB) $(QFITS_LIB)
230
231test_bl: $(ANUTILS_LIB)
232
233test_bt: $(ANUTILS_LIB)
234
235test_endian: $(ANUTILS_LIB)
236
237test_healpix: $(ANUTILS_LIB)
238
239test_log: $(ANUTILS_LIB)
240
241test_ioutils: $(ANUTILS_LIB)
242
243test_dualtree_nn: $(LIBKD_LIB) $(ANFILES_LIB) $(ANUTILS_LIB) $(QFITS_LIB)
244
245test_scamp_catalog: $(ANFILES_LIB) $(ANUTILS_LIB) $(QFITS_LIB)
246
247test_starutil: $(ANUTILS_LIB)
248
249test_svd: $(ANUTILS_LIB) $(GSL_LIB)
250
251### /TESTS
252
253# we'll just tack this on here... It depends on cairo, libjpeg, etc, so it's not part
254# of the anX.a libraries.
255ifeq ($(MAKECMDGOALS),cairoutils.o)
256  include cairoutils.dep
257endif
258
259.PHONY: allclean realclean clean
260
261allclean: clean
262        rm -f *.o *~ *.dep *.so
263
264realclean: allclean
265
266clean:
267        rm -f $(ANUTILS_LIB) $(ANFILES_LIB) $(ALL_OBJ) \
268                $(DEPS) deps cairoutils.o $(PYTHON_LIBS) \
269                grab-stellarium-constellations \
270                $(PROGS) $(ALL_TARGETS) $(ALL_TESTS_CLEAN)
Note: See TracBrowser for help on using the repository browser.