#
# This file is a Makefile for wcssubs.  If it has the name "Makefile.in"
# then it is a template for a Makefile;  to generate the actual Makefile,
# run "./configure", which is a configuration script generated by the
# "autoconf" program (constructs like "@foo@" will get replaced in the
# actual Makefile.
#

PACKAGE = wcs
VERSION = 3.6.6

DISTNAME = wcs-${VERSION}
DISTDIR = ../export/${DISTNAME}
FTPDIR	= ../ftp

#----------------------------------------------------------------
# Things you can change to personalize the Makefile for your own
# site (you can make these changes in either Makefile.in or
# Makefile, but changes to Makefile will get lost if you re-run
# the configuration script).
#----------------------------------------------------------------

# Default top-level directories in which to install architecture-
# specific files (exec_prefix) and machine-independent files such
# as scripts (prefix).  The values specified here may be overridden
# at configure-time with the --exec-prefix and --prefix options
# to the "configure" script.

prefix =		/home/eric
exec_prefix =		${prefix}

# The following definition can be set to non-null for special systems
# like AFS with replication.  It allows the pathnames used for installation
# to be different than those used for actually reference files at
# run-time.  INSTALL_ROOT is prepended to $prefix and $exec_prefix
# when installing files.
INSTALL_ROOT =

# Directory in which to install the .a or .so binary for the WCS library:
LIB_INSTALL_DIR =	$(INSTALL_ROOT)$(exec_prefix)/lib

# Directory in which to install the program wish:
BIN_INSTALL_DIR =	$(INSTALL_ROOT)$(exec_prefix)/bin

# Directory in which to install the include file wcs.h:
INCLUDE_INSTALL_DIR =	$(INSTALL_ROOT)$(prefix)/include

# To change the compiler switches, for example to change from -O
# to -g, change the following line:
CFLAGS = 		-g -W -Wall -Wno-implicit-int -fPIC

# To add ld switches, change the following line:
LDFLAGS =		-g -rdynamic

# Some versions of make, like SGI's, use the following variable to
# determine which shell to use for executing commands:
SHELL =			/bin/sh

# extra modules added by configure.in to fix OS bugs
EXTRA_OBJS = 		

# There are just too many different versions of "install" around;
# better to use the install-sh script that comes with the distribution,
# which is slower but guaranteed to work.

INSTALL = 		./install-sh -c
INSTALL_PROGRAM =	${INSTALL}
INSTALL_DATA =		${INSTALL} -m 644

#----------------------------------------------------------------
# The information below is modified by the configure script when
# Makefile is generated from Makefile.in.  You shouldn't normally
# modify any of this stuff by hand.
#----------------------------------------------------------------

AC_FLAGS =		-DHAVE_CONFIG_H
RANLIB =		ranlib

#----------------------------------------------------------------
# The information below should be usable as is.  The configure
# script won't modify it and you shouldn't need to modify it
# either.
#----------------------------------------------------------------

CC =		gcc

CC_SWITCHES =	-I. ${CFLAGS} -DWCS_VERSION="\"$(VERSION)\"" ${AC_FLAGS}

DEPEND_SWITCHES = -I. ${CFLAGS} ${AC_FLAGS}

SRCS =  wcsinit.c wcs.c wcscon.c fitsfile.c imhfile.c fileutil.c \
	hget.c hput.c iget.c imio.c worldpos.c tnxpos.c dsspos.c platepos.c \
        wcslib.c lin.c cel.c proj.c sph.c wcstrig.c dateutil.c distort.c

OBJS =  wcsinit.o wcs.o wcscon.o fitsfile.o imhfile.o fileutil.o \
	hget.o hput.o iget.o imio.o worldpos.o tnxpos.o dsspos.o platepos.o \
        wcslib.o lin.o cel.o proj.o sph.o wcstrig.o dateutil.o distort.o

# these are all the modules going into the "normal" wcs library
LIBOBJS =	${OBJS}

# whether to build library at all
WHICHLIB =	lib
EXTLIB =	

# the default library for this package
DEFLIB =	libwcs.a
# the actual library we are building (if this is a subpackage)
LIB =		/proj/rd/eric/funtools-1.4.4/libfuntools.a

PROGS =

TESTPROGS =

all:		$(WHICHLIB) $(PROGS)

testall:	$(TESTPROGS)

All:		all testall

install:	install-binaries

extlib:
		@echo "No build needed -- using external WCS library: $(EXTLIB)"

lib:		$(LIBOBJS)
		ar cruv $(LIB) $(LIBOBJS)
		$(RANLIB) $(LIB)

# Note: before running ranlib below, must cd to target directory because
# some ranlibs write to current directory, and this might not always be
# possible (e.g. if installing as root).

install-binaries: $(LIB) $(PROGS)
	@for i in $(LIB_INSTALL_DIR) $(INCLUDE_INSTALL_DIR) $(BIN_INSTALL_DIR) ; \
	    do \
	    if [ ! -d $$i ] ; then \
		echo "Making directory $$i"; \
		mkdir $$i; \
		chmod 755 $$i; \
		else true; \
		fi; \
	    done;
	@if [ "$(LIB)" = "$(DEFLIB)" ] ; then \
	    XLIB=`basename $(LIB)`; \
	    echo "Installing $$XLIB"; \
	    $(INSTALL_DATA) $$XLIB $(LIB_INSTALL_DIR)/$$XLIB; \
	    (cd $(LIB_INSTALL_DIR); $(RANLIB) $$XLIB); \
	    chmod 555 $(LIB_INSTALL_DIR)/$$XLIB; \
        fi;
	@echo "Installing fitshead.h"
	@$(INSTALL_DATA) fitshead.h $(INCLUDE_INSTALL_DIR)/fitshead.h
	@echo "Installing wcs.h"
	@$(INSTALL_DATA) wcs.h $(INCLUDE_INSTALL_DIR)/wcs.h
	@echo "Installing wcslib.h"
	@$(INSTALL_DATA) wcslib.h $(INCLUDE_INSTALL_DIR)/wcslib.h

Makefile:	Makefile.in
		$(SHELL) config.status

RM =		rm -f

clean:
		$(RM) *.a *.so *.o *.exe core errs *pure* .nfs* \
			foo* *~ *.log \#* TAGS *.E a.out errors \
			$(PROGS) $(TESTPROGS) \
			gmon.out *.pg *.bak \
			config.info config.log \
			doc/*~
		$(RM) -r autom4te.cache

distclean:	clean
		$(RM) Makefile config.status config.cache config.log

depend:
		makedepend -- $(DEPEND_SWITCHES) -- $(SRCS)


.c.o:
		$(CC) -c $(CC_SWITCHES) $<

cel.o:		wcslib.h
distort.o:	wcs.h fitshead.h wcslib.h
fitsfile.o:	fitsfile.h fitshead.h
hget.o:		fitshead.h
hput.o:		fitshead.h
iget.o:		fitshead.h
imhfile.o:	fitsfile.h fitshead.h
imio.o:		fitshead.h
lin.o:		wcslib.h
platepos.o:	wcs.h fitshead.h wcslib.h
proj.o:		wcslib.h
sph.o:		wcslib.h
tnxpos.o:	wcs.h fitshead.h wcslib.h
wcs.o:		wcs.h fitshead.h wcslib.h
wcsinit.o:	wcs.h fitshead.h wcslib.h
wcscon.o:	wcs.h fitshead.h wcslib.h
wcslib.o:	wcslib.h
wcstrig.o:	wcslib.h
worldpos.o:	wcs.h fitshead.h wcslib.h
dateutil.o:	fitsfile.h fitshead.h
fileutil.o:	fitsfile.h

# DO NOT DELETE THIS LINE -- make depend depends on it.
