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 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408
|
#-----------------------------------------------------------------------------
# GNU makefile for building WCSLIB 4.8 and its test suite.
#
# Summary of the main targets
# ---------------------------
# build: Build the library.
#
# clean: Delete intermediate object files.
#
# cleaner: clean, and also delete the test executables.
#
# cleanest (distclean or realclean): cleaner, and also delete the object
# library the C source files generated by 'flex'.
#
# check (or test): Compile and run the test programs. By default they are
# executed in batch mode, and non-graphical tests only report
# "PASS" on success. Use
#
# gmake MODE=interactive check
#
# to run them interactively with full diagnostic output.
#
# tests: Compile the test programs (but don't run them).
#
# Notes:
# 1) If you need to make changes then preferably modify ../makedefs.in
# instead and re-run configure.
#
# Author: Mark Calabretta, Australia Telescope National Facility
# http://www.atnf.csiro.au/~mcalabre/index.html
# $Id: GNUmakefile,v 4.8.1.2 2011/09/16 04:41:29 cal103 Exp cal103 $
#-----------------------------------------------------------------------------
# Get configure settings.
include ../makedefs
FLEXMODS := $(patsubst %.l,%.c,$(wildcard *.l))
MODULES := $(sort \
$(patsubst %.c,%.o, \
$(filter-out getwcstab.c,$(wildcard *.c)) $(FLEXMODS)))
ifeq "$(WCSTRIG)" "MACRO"
CPPFLAGS += -DWCSTRIG_MACRO
MODULES := $(filter-out wcstrig.o, $(MODULES))
else
ifeq "$(WCSTRIG)" "NATIVE"
MODULES := $(filter-out wcstrig.o, $(MODULES))
endif
endif
# For building the sharable library.
PICLIB := libwcs-PIC.a
CPPFLAGS += -I. -I..
vpath %.c test
vpath %.h ..
vpath %.in ..
# For building and exercising the test suite
# ------------------------------------------
# Signals tfitshdr to use wcshdr().
ifneq "$(DO_WCSHDR)" ""
CPPFLAGS += -DDO_WCSHDR
endif
# Test programs that don't require PGPLOT.
TEST_N := tlin tlog tprj1 tsph tsphdpa tspx ttab1 twcs twcssub tpih1 tbth1 \
tfitshdr tunits twcsfix
# Test programs that require CFITSIO (they don't need PGPLOT).
TEST_C := twcstab twcshdr
# Test programs that require PGPLOT but not PGSBOX.
TEST_P := tspc tprj2 tcel1 tcel2 ttab2 ttab3 twcsmix
# Test programs that require PGPLOT and PGSBOX.
TEST_B := tpih2
# Test programs that aren't automatically exercised.
TEST_X := tsphdpa twcshdr
TESTS := $(TEST_N)
# Add test programs that require CFITSIO if we have it.
ifneq "$(CFITSIOINC)" ""
ifneq "$(CFITSIOLIB)" ""
TESTS += $(TEST_C)
endif
endif
# Add test programs that require PGPLOT if we have it.
ifneq "$(PGPLOTINC)" ""
ifneq "$(PGPLOTLIB)" ""
TESTS += $(TEST_P) $(TEST_B)
endif
endif
# Remove tests that aren't automatically exercised.
TESTS := $(filter-out $(TEST_X), $(TESTS))
PGSBOXLIB := ../pgsbox/libpgsbox-$(LIBVER).a
# Pattern rules
#--------------
ifeq "$(FLEX)" "flex"
%.c : %.l
-@ echo ''
-@ $(RM) $@
$(FLEX) $(FLFLAGS) -t $< | sed -e 's/^[ ]*#/#/' > $@
else
%.c : %.l
-@ echo ''
-@ $(RM) $@
cp flexed/$@ .
endif
$(WCSLIB)(%.o) : %.c
-@ echo ''
$(CC) $(CPPFLAGS) $(CFLAGS) -c $<
$(AR) r $(WCSLIB) $%
-@ $(RM) $%
$(PICLIB)(%.o) : %.c
-@ echo ''
$(CC) $(CPPFLAGS) $(CFLAGS) $(SHRFLAGS) -c $<
$(AR) r $(PICLIB) $%
-@ $(RM) $%
%.i : %.c
-@ echo ''
-@ $(RM) $@
$(CPP) $(CPPFLAGS) $(CFLAGS) $< > $@
# Print out include file dependencies.
%.d : %.c
-@ echo ''
-@ $(CPP) $(CPPFLAGS) $(CFLAGS) $< | \
sed -n -e 's|^# 1 "\([^/].*\.h\)".*|\1|p' | \
sort -u
# Use 'make FLAVOUR=Linux run_%' to have VALGRIND defined (from flavours).
run_% : %
-@ echo ''
-@ $(TIMER)
@ if [ '$(MODE)' = interactive -o '$(VALGRIND)' ] ; then \
printf 'Press <CR> to run $<: ' ; \
read DUMMY ; \
if [ '$<' = tunits ] ; then \
$(VALGRIND) ./$< < test/units_test ; \
else \
$(VALGRIND) ./$< ; \
fi ; \
else \
if [ '$<' = tcel2 ] ; then \
echo N | ./$< ; \
elif [ '$(filter $<, $(TEST_N) $(TEST_C))' ] ; then \
if [ '$<' = tunits ] ; then \
./$< < test/units_test > $<.out 2>&1 ; \
else \
./$< < /dev/null > $<.out 2>&1 ; \
fi ; \
if grep 'PASS:' $<.out > /dev/null ; then \
head -2 $<.out ; \
grep 'PASS:' $<.out ; \
elif [ -f 'test/$<.out' ] ; then \
trap 'rm -f run_test.tmp' 0 1 2 3 15 ; \
sed -e 's/0x[0-9a-f][0-9a-f][0-9a-f]*/0x<address>/g' $<.out > \
run_test.tmp ; \
mv -f run_test.tmp $<.out ; \
if cmp -s $<.out test/$<.out ; then \
head -2 $<.out ; \
echo 'PASS: Output agrees with C/test/$<.out' ; \
else \
cat $<.out ; \
echo '' ; \
echo 'FAIL: Output disagrees with C/test/$<.out' ; \
fi ; \
else \
cat $<.out ; \
fi ; \
else \
./$< < /dev/null 2>&1 ; \
fi ; \
fi
-@ echo ''
# Static and static pattern rules
#--------------------------------
.PHONY : build check clean cleaner cleanest distclean install lib realclean \
run_% test tests
build : lib
lib : $(FLEXMODS) $(WCSLIB) $(SHRLIB)
$(WCSLIB) : $(MODULES:%=$(WCSLIB)(%))
-@ echo ''
$(RANLIB) $@
$(SHRLIB) : $(PICLIB)
-@ echo ''
-@ $(RM) -r tmp
mkdir tmp && \
cd tmp && \
trap 'cd .. ; $(RM) -r tmp' 0 1 2 3 15 ; \
$(AR) x ../$(PICLIB) && \
$(SHRLD) $(LDFLAGS) -o $@ *.o && \
mv $@ ..
$(PICLIB) : $(MODULES:%.o=$(PICLIB)(%.o)) ;
install : build
- if [ ! -d "$(LIBDIR)" ] ; then \
$(INSTALL) -d -m 2775 $(LIBDIR) ; \
fi
$(INSTALL) -m 644 $(WCSLIB) $(LIBDIR)
$(RANLIB) $(LIBDIR)/$(WCSLIB)
- if [ -h "$(LIBDIR)/libwcs.a" ] ; then \
$(RM) $(LIBDIR)/libwcs.a ; \
fi
- $(LN_S) $(WCSLIB) $(LIBDIR)/libwcs.a
- if [ "$(SHRLIB)" != "" ] ; then \
$(INSTALL) -m 644 $(SHRLIB) $(LIBDIR) ; \
if [ -h "$(LIBDIR)/$(SONAME)" ] ; then \
$(RM) $(LIBDIR)/$(SONAME) ; \
fi ; \
$(LN_S) $(SHRLIB) $(LIBDIR)/$(SONAME) ; \
if [ "$(SHRLN)" != "" ] ; then \
if [ -h "$(LIBDIR)/$(SHRLN)" ] ; then \
$(RM) $(LIBDIR)/$(SHRLN) ; \
fi ; \
$(LN_S) $(SONAME) $(LIBDIR)/$(SHRLN) ; \
fi ; \
fi
- if [ ! -d "$(INCDIR)" ] ; then \
$(INSTALL) -d -m 2775 $(INCDIR) ; \
fi
$(INSTALL) -m 444 *.h $(INCDIR)
$(RM) $(INCLINK)
$(LN_S) $(notdir $(INCDIR)) $(INCLINK)
clean :
- $(RM) -r *.o *.i a.out t*.out core *.dSYM $(EXTRA_CLEAN)
cleaner : clean
- $(RM) .gdb_history
- $(RM) $(TEST_N) $(TEST_X)
- $(RM) $(TEST_P) tpih2 twcstab twcshdr
- $(RM) tofits bth.fits pih.fits wcstab.fits
- $(RM) t*_cfitsio
cleanest distclean realclean : cleaner
- $(RM) ../wcsconfig.h ../wcsconfig_tests.h
- $(RM) fitshdr.c wcsbth.c wcspih.c wcsulex.c wcsutrn.c
- $(RM) $(PICLIB) libwcs-*.a libwcs.so.* libwcs.*.dylib
check test : tests $(TESTS:%=run_%)
tests : $(TESTS) $(TEST_X)
$(TEST_N) : % : test/%.c $(WCSLIB)
-@ echo ''
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $< $(WCSLIB) $(LIBS)
-@ $(RM) $@.o
$(TEST_P) : % : test/%.c $(WCSLIB)
-@ echo ''
$(CC) $(CPPFLAGS) $(PGPLOTINC) $(CFLAGS) -c -o $@.o $<
$(LD) $(LDFLAGS) -o $@ $@.o $(PGPLOTLIB) $(WCSLIB) $(LIBS)
-@ $(RM) $@.o
tpih2 : test/tpih2.c $(PGSBOXLIB) $(WCSLIB)
-@ echo ''
$(CC) $(CPPFLAGS) -I../pgsbox $(PGPLOTINC) $(CFLAGS) -c -o $@.o $<
$(LD) $(LDFLAGS) -o $@ $@.o $(PGSBOXLIB) $(PGPLOTLIB) $(WCSLIB) \
$(FLIBS) $(LIBS)
-@ $(RM) $@.o
tfitshdr_cfitsio tpih1_cfitsio tbth1_cfitsio : %_cfitsio : test/%.c $(WCSLIB)
-@ echo ''
$(CC) -DDO_CFITSIO $(CPPFLAGS) $(CFITSIOINC) $(CFLAGS) \
$(LDFLAGS) -o $@ $< $(CFITSIOLIB) $(WCSLIB) $(LIBS)
-@ $(RM) $@.o
tpih2_cfitsio : test/tpih2.c $(PGSBOXLIB) $(WCSLIB)
-@ echo ''
$(CC) -DDO_CFITSIO $(CPPFLAGS) -I../pgsbox $(PGPLOTINC) \
$(CFITSIOINC) $(CFLAGS) -c -o $@.o $<
$(LD) $(LDFLAGS) -o $@ $@.o $(PGSBOXLIB) $(PGPLOTLIB) \
$(CFITSIOLIB) $(WCSLIB) $(FLIBS) $(LIBS)
-@ $(RM) $@.o
twcstab : test/twcstab.c $(GETWCSTAB) $(WCSLIB)
-@ echo ''
$(CC) $(CPPFLAGS) $(CFITSIOINC) $(CFLAGS) $(LDFLAGS) -o $@ $< \
$(GETWCSTAB) $(CFITSIOLIB) $(WCSLIB) $(LIBS)
-@ $(RM) $@.o
twcshdr : test/twcshdr.c $(GETWCSTAB) $(WCSLIB)
-@ echo ''
$(CC) $(CPPFLAGS) $(CFITSIOINC) $(CFLAGS) $(LDFLAGS) -o $@ $< \
$(GETWCSTAB) $(CFITSIOLIB) $(WCSLIB) $(LIBS)
-@ $(RM) $@.o
getwcstab.o : getwcstab.c getwcstab.h
-@ echo ''
$(CC) $(CPPFLAGS) $(CFLAGS) $(CFITSIOINC) -c $<
$(PGSBOXLIB) :
-@ echo ''
$(MAKE) -C ../pgsbox lib
tofits : test/tofits.c
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $<
pih.fits : test/pih.keyrec tofits
./tofits < $< > $@
bth.fits : test/bth.keyrec tofits
./tofits < $< > $@
GNUmakefile : ../makedefs ;
../makedefs ../wcsconfig.h ../wcsconfig_tests.h : makedefs.in wcsconfig.h.in \
wcsconfig_tests.h.in ../config.status
-@ $(RM) ../wcsconfig.h ../wcsconfig_tests.h
cd .. && ./config.status
show ::
-@ -@ echo ' FLEXMODS := $(FLEXMODS)'
-@ -@ echo ' MODULES := $(MODULES)'
# Dependencies (use the %.d pattern rule to list them)
#-----------------------------------------------------
$(WCSLIB)(cel.o) : cel.h prj.h sph.h wcsconfig.h wcserr.h wcsmath.h \
wcsprintf.h wcstrig.h
$(WCSLIB)(fitshdr.o) : wcsconfig.h fitshdr.h
$(WCSLIB)(lin.o) : lin.h wcserr.h wcsprintf.h
$(WCSLIB)(log.o) : log.h
$(WCSLIB)(prj.o) : prj.h wcsconfig.h wcserr.h wcsmath.h wcsprintf.h \
wcstrig.h wcsutil.h
$(WCSLIB)(spc.o) : spc.h spx.h wcserr.h wcsmath.h wcsprintf.h wcstrig.h \
wcsutil.h
$(WCSLIB)(sph.o) : sph.h wcsconfig.h wcstrig.h
$(WCSLIB)(spx.o) : spx.h wcserr.h wcsmath.h
$(WCSLIB)(tab.o) : tab.h wcserr.h wcsmath.h wcsprintf.h
$(WCSLIB)(wcs.o) : cel.h lin.h log.h prj.h spc.h sph.h spx.h tab.h \
wcs.h wcsconfig.h wcserr.h wcsmath.h wcsprintf.h \
wcstrig.h wcsunits.h wcsutil.h
$(WCSLIB)(wcsbth.o) : cel.h lin.h prj.h spc.h spx.h tab.h wcs.h wcserr.h \
wcshdr.h wcsmath.h
$(WCSLIB)(wcserr.o) : wcserr.h wcsprintf.h
$(WCSLIB)(wcsfix.o) : cel.h lin.h prj.h spc.h sph.h spx.h tab.h wcs.h \
wcserr.h wcsfix.h wcsmath.h wcsunits.h wcsutil.h
$(WCSLIB)(wcshdr.o) : cel.h lin.h prj.h spc.h spx.h tab.h wcs.h wcserr.h \
wcshdr.h wcsmath.h wcsutil.h
$(WCSLIB)(wcspih.o) : cel.h lin.h prj.h spc.h spx.h tab.h wcs.h wcserr.h \
wcshdr.h wcsmath.h
$(WCSLIB)(wcsprintf.o): wcsprintf.h
$(WCSLIB)(wcstrig.o) : wcsconfig.h wcsmath.h wcstrig.h
$(WCSLIB)(wcsulex.o) : wcserr.h wcsmath.h wcsunits.h
$(WCSLIB)(wcsunits.o) : wcserr.h wcsunits.h
$(WCSLIB)(wcsutil.o) : wcsutil.h
$(WCSLIB)(wcsutrn.o) : wcserr.h wcsunits.h
tbth1 tbth1_cfitsio : cel.h lin.h prj.h spc.h spx.h tab.h wcs.h wcsconfig.h \
wcsconfig_tests.h wcserr.h wcsfix.h wcshdr.h
tcel1 : cel.h prj.h wcserr.h
tcel2 : cel.h prj.h wcserr.h
tfitshdr tfitshdr_cfitsio : fitshdr.h wcsconfig.h wcsconfig_tests.h
tlin : lin.h wcserr.h
tlog : log.h
tpih1 tpih1_cfitsio : cel.h lin.h prj.h spc.h spx.h tab.h wcs.h wcsconfig.h \
wcsconfig_tests.h wcserr.h wcsfix.h wcshdr.h wcsprintf.h
tpih2 tpih2_cfitsio : cel.h lin.h prj.h spc.h spx.h tab.h wcs.h wcsconfig.h \
wcsconfig_tests.h wcserr.h wcshdr.h
tprj1 : prj.h wcsconfig.h wcserr.h wcstrig.h
tprj2 : prj.h wcserr.h
tspc : spc.h spx.h wcsconfig.h wcserr.h wcstrig.h
tsph : sph.h wcsconfig.h wcstrig.h
tsphdpa : sph.h
tspx : spx.h wcserr.h
ttab1 : tab.h wcserr.h
ttab2 : tab.h wcserr.h
ttab3 : prj.h tab.h wcserr.h
tunits : wcserr.h wcsunits.h
twcs : cel.h lin.h log.h prj.h spc.h sph.h spx.h tab.h wcs.h wcsconfig.h \
wcsconfig_tests.h wcserr.h wcsfix.h wcshdr.h wcslib.h wcsmath.h \
wcsprintf.h wcstrig.h wcsunits.h wcsutil.h
twcsfix : cel.h lin.h prj.h spc.h spx.h tab.h wcs.h wcserr.h wcsfix.h \
wcsunits.h
twcshdr : cel.h fitshdr.h getwcstab.h lin.h log.h prj.h spc.h sph.h spx.h \
tab.h wcs.h wcsconfig.h wcserr.h wcsfix.h wcshdr.h wcslib.h \
wcsmath.h wcsprintf.h wcstrig.h wcsunits.h wcsutil.h
twcsmix : cel.h lin.h prj.h spc.h sph.h spx.h tab.h wcs.h wcserr.h
twcssub : cel.h lin.h prj.h spc.h spx.h tab.h wcs.h wcserr.h
twcstab : cel.h fitshdr.h getwcstab.h lin.h log.h prj.h spc.h sph.h spx.h \
tab.h wcs.h wcsconfig.h wcserr.h wcsfix.h wcshdr.h wcslib.h \
wcsmath.h wcsprintf.h wcstrig.h wcsunits.h wcsutil.h
run_tbth1 run_tbth1_cfitsio : bth.fits
run_tfitshdr run_tfitshdr_cfitsio : pih.fits
run_tpih1 run_tpih1_cfitsio : pih.fits
run_tpih2 run_tpih2_cfitsio : pih.fits
|