File: Makefile

package info (click to toggle)
astrometry.net 0.70%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 17,544 kB
  • sloc: ansic: 161,390; python: 19,747; makefile: 1,412; awk: 159; cpp: 78; pascal: 67; sh: 61; perl: 9
file content (184 lines) | stat: -rw-r--r-- 5,087 bytes parent folder | download
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
# This file is part of the Astrometry.net suite.
# Licensed under a 3-clause BSD style license - see LICENSE

BASEDIR := ..
COMMON := $(BASEDIR)/util
DATA := .

all:
.PHONY: all

include $(COMMON)/makefile.common

# required for build-hd-tree
include $(COMMON)/makefile.anfiles
# 2masstofits
include $(COMMON)/makefile.zlib
#include $(COMMON)/makefile.libkd
#include $(COMMON)/makefile.anutils

$(DATA)/%.txt: ;
$(DATA)/%.dat: ;

ngc2000.o: ngc2000.c ngc2000names.c ngc2000entries.c

ngc2000names.c: parse-ngc2000names.awk
	$(AWK) -f parse-ngc2000names.awk < /dev/null  > $@

ngc2000entries.py: parse-ngc2000-py.awk
	$(AWK) -f parse-ngc2000-py.awk < /dev/null  > $@

ngc2000accurate.py: parse-ngcic-accurate-py.awk $(DATA)/ngc2000_pos.txt $(DATA)/ic2000_pos.txt
	cat $(DATA)/ngc2000_pos.txt $(DATA)/ic2000_pos.txt | $(AWK) -f parse-ngcic-accurate-py.awk > $@

ngc2000.py: ngc2000-pre.py ngc2000entries.py ngc2000-mid.py ngc2000accurate.py ngc2000-post.py
	cat $^ > $@

ngc2000entries.c: parse-ngc2000.awk
	$(AWK) -f parse-ngc2000.awk < /dev/null  > $@

ngcic-accurate-entries.c: parse-ngcic-accurate.awk $(DATA)/ngc2000_pos.txt $(DATA)/ic2000_pos.txt
	cat $(DATA)/ngc2000_pos.txt $(DATA)/ic2000_pos.txt | $(AWK) -f parse-ngcic-accurate.awk > $@

stellarium-constellations.c:
	-$(MAKE) grab-stellarium-constellations
	-(./grab-stellarium-constellations > $@.tmp  &&  mv $@.tmp $@) || touch $@

grab-stellarium-constellations: grab-stellarium-constellations.o \
		starutil.o mathutil.o bl.o an-endian.o errors.o log.o ioutils.o qsort_reentrant.o tic.o
	$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS)


OBJS := ngc2000.o ngcic-accurate.o brightstars.o constellations.o \
	tycho2-fits.o tycho2.o usnob-fits.o usnob.o nomad.o nomad-fits.o \
	ucac3-fits.o ucac3.o ucac4-fits.o ucac4.o 2mass-fits.o 2mass.o hd.o \
	constellation-boundaries.o

HEADERS := brightstars.h constellations.h ngc2000.h ngcic-accurate.h \
	tycho2.h tycho2-fits.h usnob-fits.h usnob.h nomad-fits.h nomad.h \
	2mass-fits.h 2mass.h hd.h ucac3.h ucac4.h constellation-boundaries.h

HEADERS_PATH := $(addprefix $(INCLUDE_DIR)/,$(HEADERS))

PY_INSTALL_DIR := $(PY_BASE_INSTALL_DIR)/catalogs
LINK_DIR := $(PY_BASE_LINK_DIR)/catalogs

# MISC_OBJ := grab-stellarium-constellations.o 

DEP_OBJ := $(OBJS)
DEP_PREREQS :=
DEP_PREREQS += ngc2000names.c ngc2000entries.c ngcic-accurate-entries.c

CFLAGS += $(CFLAGS_DEF)
CFLAGS += $(LIBKD_INC)
CFLAGS += $(ANUTILS_INC)

LDFLAGS += $(LDFLAGS_DEF)

LDLIBS := $(LDLIBS_DEF)
LDLIBS += $(ANFILES_LIB)
LDLIBS += -lm

CFLAGS += -I.
CFLAGS += -I$(COMMON)
CFLAGS += $(ZLIB_INC)

LIBCAT := libcatalogs.a

SLIB := $(LIBCAT)
SLIB += $(ANFILES_SLIB)

$(LIBCAT): $(OBJS)
	-rm -f $@
	$(AR) rc $@ $(OBJS)
	$(RANLIB) $@

PROGS := build-hd-tree tycho2tofits usnobtofits nomadtofits \
	2masstofits
	#ucac3tofits ucac4tofits

# not built by default
MISC_PROGS := usnob-scamp-catalog read_nomad

ucac3tofits: ucac3tofits.o $(SLIB)
	$(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS) -lbz2
ALL_OBJ += ucac3tofits.o

ucac4tofits: ucac4tofits.o $(SLIB)
	$(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS) -lbz2
ALL_OBJ += ucac4tofits.o

2masstofits: 2masstofits.o $(SLIB)
	$(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS) $(ZLIB_LIB)
ALL_OBJ += 2masstofits.o

$(PROGS): %: %.o $(SLIB)
ALL_OBJ += $(addsuffix .o,$(PROGS))

all: ngc2000.py $(LIBCAT) $(PROGS)

hd1.fits: henry-draper.tsv build-hd-tree
	build-hd-tree -s -R 16 henry-draper.tsv $@

hd.fits: henry-draper.tsv build-hd-tree tycho2.fits tyc2_hd.dat
	build-hd-tree -s -R 16 -T tycho2.fits -X tyc2_hd.dat henry-draper.tsv $@

tyc2_hd.dat:
	wget "ftp://cdsarc.u-strasbg.fr/pub/cats/IV/25/tyc2_hd.dat.gz" -O $@.gz
	gunzip $@.gz

henry-draper.tsv:
	wget "http://trac.astrometry.net/browser/binary/henry-draper/henry-draper.tsv?format=txt" -O $@

tycho2.fits: catalog.dat suppl_1.dat
	tycho2tofits -o $@ $^

catalog.dat:
	wget -c http://www.astro.ku.dk/~cf/CD/data/catalog.dat

suppl_1.dat:
	wget -c http://www.astro.ku.dk/~cf/CD/data/suppl_1.dat

install: $(PYTHON_INSTALL) $(LIBCAT) $(HEADERS_PATH)
	@echo Installing in base directory '$(INSTALL_DIR)'
	mkdir -p '$(PY_INSTALL_DIR)'
	mkdir -p '$(INCLUDE_INSTALL_DIR)'
	mkdir -p '$(LIB_INSTALL_DIR)'
	@for x in $(PYTHON_INSTALL); do \
		echo cp $$x '$(PY_INSTALL_DIR)/'$$x; \
		cp $$x '$(PY_INSTALL_DIR)/'$$x; \
	done
	@for x in $(HEADERS); do \
		echo cp '$(INCLUDE_DIR)/'$$x '$(INCLUDE_INSTALL_DIR)/'$$x; \
		cp '$(INCLUDE_DIR)/'$$x '$(INCLUDE_INSTALL_DIR)/'$$x; \
	done
	@for x in $(LIBCAT); do \
		echo cp $$x '$(LIB_INSTALL_DIR)/'$$x; \
		cp $$x '$(LIB_INSTALL_DIR)/'$$x; \
	done
	@echo ok

.PHONY: install

ALL_TEST_FILES = test_tycho2 test_usnob test_nomad test_2mass test_hd \
	test_boundaries
ALL_TEST_EXTRA_OBJS = 
ALL_TEST_LIBS = $(SLIB)
ALL_TEST_EXTRA_LDFLAGS = 
include $(COMMON)/makefile.tests

$(ALL_TEST_FILES): $(SLIB)

tests: $(ALL_TEST_FILES)
.PHONY: tests

clean:
	rm -f $(LIBCAT) $(OBJS) $(ALL_OBJ) $(DEPS) *.dep deps \
		grab-stellarium-constellations \
		ngc2000names.c ngc2000entries.py ngc2000.py ngc2000entries.c \
		ngcic-accurate-entries.c

ifneq ($(MAKECMDGOALS),clean)
          include $(COMMON)/makefile.deps
endif