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rnn.o) \
$(FLIB)(fttbit.o) \
$(FLIB)(fttdnn.o) \
$(FLIB)(fttkey.o) \
$(FLIB)(fttkyn.o) \
$(FLIB)(fttnul.o) \
$(FLIB)(fttrec.o) \
$(FLIB)(fttrnn.o) \
$(FLIB)(fttscl.o) \
$(FLIB)(ftupch.o) \
$(FLIB)(ftvers.o) \
$(FLIB)(ftzero.o) \
$(NULLO)
################################################################################
#       DO NOT EDIT "Makefile", EDIT "Make.proto"
#       IF YOU MAKE CHANGES TO "Makefile" THEY WILL BE LOST
################################################################################
#       A Makefile intended to be used to build the FITSIO libraries.
#       This makefile is intended for use on a Sun system, but by simply
#       changing the definition of SYSPEC below, it should work for another.
#       The FITSIO source code as obtained via anonymous ftp should be located
#       in this same directory as this file.  This file should exist as
#       two separate copies of itself.  One should be named Make.proto,
#       the other should be named Makefile.
#       New versions of the FITSIO software can be copied into this
#       directory at any time.  Invoking make on this Makefile
#       will then build the new version.
#
#       The FITSIO files come in a form suitable for compiling on a VMS system.
#       All of the subroutines come inside 2 source code files.
#       This form is not suitable for a Un*x system, because all routines
#       within a single source file are archived into a single object module.
#       This effectively forces any program that uses even one routine to
#       link itself with all routines.  (The FITSIO library is not currently
#       a shareable library.)  Thus, the executable image of a program would
#       be forced to have a copy of all of the routines.  This wastes disk.
#
#       To avoid this waste, the 'fsplit' program is used to split
#       the original source files into separate files.
#       If you do not have the fsplit program on your system, source code
#       (in C) can be obtained from several anonymous ftp archives.
#       Any "Archie" service can be used to find fsplit.c
#       N.B.:  There are several versions of fsplit.  This Makefile should
#       work with almost any of them.
#
#       Author of Makefile:     Steve Allen, UCO/Lick Observatory
#                               sla@helios.ucsc.edu
#                               1992 March 21
#       If you find bugs in this, or modify it so that it works well on
#       machines other than Sun and SGI, let Steve Allen know so that
#       he and Bill Pence can get the fixes into the next FITSIO release.
#
#       This Makefile/Make.proto file is Copyright (c) 1992 Steven L. Allen
#       This Makefile/Make.proto file comes with NO WARRANTY.
#       This Makefile/Make.proto file may be reproduced by any means,
#       modified in any way, and applied to other similar problems.
#################################################################################       This defines which system specific library to build
#       use this for Sun, SGI, IBM RS6000 (?), HP720 ...
SYSPEC=fitssun
#       use this for DecStation ...
#SYSPEC=fitsdec
########
#       flags for Sun Fortran compilers
FFLAGS=-O -u
#       flags for Silicon Graphics Fortran compilers (IRIX > v3.2)
#FFLAGS=-O -u -static -old_rl
#       flags for the IBM AIX xlf "Fortran" compiler
#FFLAGS=-O -u -qcharlen=2880
#       flags for HP 700 series Fortran compilersk, HPUX8.05
#       thanks to elwin@gamma.phys.clemson.edu (Lawrence E. Brown)
FFLAGS= -O -K -u
########
#       directory in which installed library lives
INSDIR=/usr/local/lib
#       name of this library
FLIB=libfitsio.sun4.a
#       These are the monolithic files which we want to split before compile
SPLITS=fitsio.split $(SYSPEC).split
################################
#       It is conceivable that you might have to change some of these
SHELL=/bin/sh
MKDIR=mkdir
RM=/bin/rm -rf
MV=/bin/mv
CMP=/bin/cmp -s
FSPLIT=fsplit
################################
#       In order to define the Make rule, we need to add some suffixes
.SUFFIXES: .split .for
#       Make rule for running fsplit
#       We make a subdirectory in which the monoliths are split, then
#       we compare each split module with the older one.  If they differ,
#       the new one is copied up here so it will be compiled.
.for.split:
	-$(RM) $*.dir $*.split
	$(MKDIR) $*.dir
	ln $*.for $*.dir/$*.for
	(cd $*.dir; $(FSPLIT) $*.for > /dev/null)
	(cd $*.dir; ls *.f > ../$*.split)
	for i in `cat $*.split`; do \
	    if $(CMP) $*.dir/$$i $$i; then \
		$(RM) $*.dir/$$i; \
	    else \
		$(RM) $$i; $(MV) $*.dir/$$i $$i; \
	    fi ; \
	done
	-$(RM) $*.dir
################################
#       What we want to make is the object archive of all FITSIO,
#       but in order to know what to make, we need to make the Makefile
default:: Makefile $(FLIB)
#
#       We do not want make to be able to delete these files unintentionally.
.PRECIOUS: Makefile $(FLIB)
#
#       Holdovers from an earlier version, now commented out.
#fitsio.for: ../fitsio.for
#        -$(RM) fitsio.for
#        ln ../fitsio.for
#$(SYSPEC).for: ../$(SYSPEC).for
#        -$(RM) $(SYSPEC).for
#        ln ../$(SYSPEC).for
#
#       The names and number of the fitsio routines are subject to change.
#       Thus, to insure that we get them all, we build the list of them
#       into the Makefile by starting with a prototype Makefile which is
#       named Make.proto.
#       Having built the Makefile, we then build the FITSIO library.
Makefile: $(SPLITS) Make.proto
	mv Makefile Makefile.old
	echo "NULLO=" > Makefile
	echo 'LOBJS=\' >> Makefile
	/bin/ls ft*.f | sed 's/\(.*\).f/$$(FLIB)(\1.o) \\/' >> Makefile
	echo '$$(NULLO)' >> Makefile
	cat Make.proto >> Makefile
	make $(FLIB)
#
#       This rule actually makes the object archive (library)
$(FLIB): $(LOBJS)
	$(FLIB)
################################
#       You will probably need root priviledge for this step
install: Makefile
	-$(RM) $(INSDIR)/$(FLIB)
	cp $(FLIB) $(INSDIR)/$(FLIB)
################################
clean:  tidy
	-$(RM) *.o *.a *.f *.split
	touch Make.proto
tidy:
	-$(RM) *.trace *.bak \#*
################################
