#
#                    A A O _ M a k e f i l e  
#
#   This makefile is used entirely for AAO internal purposes. The FPOSS
#   source used at ESO is held in a directory structure suited to ESO
#   layout requirements. At AAO, a similar structure is used, but there
#   are additional files kept in the development directories - for one
#   thing, AAO's version is able to build versions of FPOSS that support
#   2dF and 6dF. This makefile exists to create a tar file that can be used
#   to export the ESO-required files from this AAO structure. It only has
#   one important target 'source_release', which creates the required tar.gz
#   file. It also has the target 'configure_source_release' which creates the
#   tar.gz file that contains all the source files needed to build the full
#   version of 'configure' (with support for 2dF, 6dF and FLAMES).
#
#   Author(s): Keith Shortridge, AAO (KS)
#
#   History:
#
#   24th Jan 2002.  Original version, KS.
#   11th Feb 2002.  fpDefines.h moved to fpcol_src sub-directory, tdfxy.h
#                   no longer used. KS.
#   10th Apr 2002.  fpcolMdlFit.c added. KS.
#    6th Aug 2002.  Added new fpcol model files. KS.
#    7th Aug 2002.  Added fpcol_src/fitsio.h. KS.
#   22nd Aug 2002.  Added MacOSX support. KS.
#   19th Sep 2002.  Removed the executable and the tcl tk directories. KS.
#    2nd Oct 2002.  Added configure manual to full release files. KS.
#    5th Nov 2002.  Added eso-logo.bmp to release files. KS.

#  The following sections define the various source files and other files
#  needed for a release of the system.

DRAMA_H_FILES = \
   drama.h   mess.h \
   status.h  Ers.h

SLA_H_FILES = \
   slalib.h slamac.h

FPCOL_H_FILES = \
   fpDefines.h fpcolMdl_err.h fpcolBase.h fpcolFpil.h fpcolInstDescr.h \
   fpcolMdl.h fpcolMdlCalModel.h fpcolMdlCalLibs.h fitsio.h

FPOSS_H_FILES = \
   conf_err.h             fpil.h                 tdFconfig.h \
   conf_err_msgt.h        fpil_err.h             tdFconfigMethod.h \
   config_err.h           fpil_err_msgt.h        tdFconvert.h \
   config_err_msgt.h      tdffpil.h \
   sixdf_util_err_msgt.h  tdfxy_err.h \
   sixdffpil.h            tdfxy_err_msgt.h \
   convertPAF.h

DRAMA_C_FILES = \
   mess.c           erssprintf.c   ersvsprintf.c    ers_imp.c

SLA_C_FILES = \
   sla.c

FPCOL_C_FILES = \
   fpcolBase.c      fpcolFpil.c      fpcolMdl.c     fpcolMdlFit.c \
   fpcolMdlCalModel.c
 
FPOSS_C_FILES = \
   config.c         FpilExtras.c \
   config_method.c  fpilmodel.c      tdFconvertSds.c \
   configure.c      fpil.c           tdFparse.c \
   configversion.c  fpilcons.c       convertPAF.c

SDS_C_FILES = \
   arg.c         sds.c  \
   sdstcl.c      sdstest.c \
   sdslist.c     sdstclinit.c \
   sdsutil.c

SDS_H_FILES = \
   arg.h          arg_err_msgt.h   sds.h \
   sds_err_msgt.h arg_err.h \
   sds_err.h      sdstcl.h

DOCO_FILES = \
   fposs_user_manual.doc fposs_internals.doc ToDo.txt

TCL_FILES = \
   configure.tcl  mimic.tcl      procs.tcl      util.tcl

MISC_FILES = aao_logo.bmp eso-logo.bmp

OPERATIONAL_FILES = \
   fpossInsStatus.sds    M67.fld   N3201-00.fld  

MAKEFILES = \
   Makefile_HP-UX        Makefile_SunOS     Makefile_Darwin \
   Makefile_Linux        AAO_Makefile       Makefile
   
#  These source files are specific to 6dF and 2dF.

6DF_C_FILES = sixdFfpifull.c   sixdFcollision.c sixdfpos.c 

6DF_H_FILES = sixdffpil.h      sixdfpos.h       sixdFbuttonDims.h \
              sixdFfieldDims.h sixdf_util_err.h

6DF_OPERATIONAL_FILES = sixdFconstants.sds 6dF_Test1.fld

2DF_C_FILES = tdffpilfull.c    tdffpilmin.c     tdfxy.c  \
              tdFcollision.c
                 
2DF_H_FILES = tdffpil.h        tdfxy.h          tdFbuttonDims.h \
              tdfxy_err.h      tdFfieldDims.h   tdFcollision.h \
              tdFpmacDPR.h     tdFutil.h
              
2DF_OPERATIONAL_FILES =  tdFconstants.sds tdFdistortion1.sds tdFlinear1.sds \
                         tdFdistortion0.sds  tdFlinear0.sds \
                         tdf150.fld 2dF_Test_1.fld

2DF_DOCO_FILES = configure_user_manual.doc


#  These are the files required for a release of the system.  
#  This only includes those files needed to build FPOSS. It does not
#  include the executable or the Tcl/Tk directories. A source release is
#  intended to be a releas eof the files needed to build the system from
#  scratch on a machine that already has Tcl/Tk installed.

RELEASE_FILES = \
   $(TCL_FILES) $(MISC_FILES) \
   $(DOCO_FILES) $(OPERATIONAL_FILES)

#  'clean' is a standard target to get rid of object and other intermediate
#  files.

clean :
	-/bin/rm -r *.o configure libsds.a tcl_dir tk_dir *.bck *.ins *.tar *.gz


#  'source_release' builds a tar file that includes not only those files
#  used by the 'release' target, but also includes all those files needed
#  to build it.

source_release :
	-/bin/rm -rf ../release
	/bin/mkdir ../release
	/bin/mkdir ../release/src
	/bin/mkdir ../release/drama_src
	/bin/mkdir ../release/fpcol_src
	/bin/mkdir ../release/sds_src
	/bin/mkdir ../release/sla_src
	cd ../drama_src; \
	   /bin/cp $(DRAMA_H_FILES) $(DRAMA_C_FILES) ../release/drama_src
	cd ../fpcol_src; \
	   /bin/cp $(FPCOL_H_FILES) $(FPCOL_C_FILES) ../release/fpcol_src
	cd ../sla_src; \
	   /bin/cp $(SLA_H_FILES) $(SLA_C_FILES) ../release/sla_src
	cd ../sds_src; \
	   /bin/cp $(SDS_H_FILES) $(SDS_C_FILES) ../release/sds_src
	/bin/cp -r $(FPOSS_H_FILES) $(FPOSS_C_FILES) $(MAKEFILES) \
                                             $(RELEASE_FILES) ../release/src
	cd ../release; \
	   chmod +w *src/*; \
	   tar -cvf fposs_source.tar *; \
	   gzip fposs_source.tar
      
configure_source_release :
	-/bin/rm -rf ../configure_release
	/bin/mkdir ../configure_release
	/bin/mkdir ../configure_release/src
	/bin/mkdir ../configure_release/drama_src
	/bin/mkdir ../configure_release/fpcol_src
	/bin/mkdir ../configure_release/sds_src
	/bin/mkdir ../configure_release/sla_src
	/bin/mkdir ../configure_release/tdf_util
	/bin/mkdir ../configure_release/six_df_util
	cd ../drama_src; \
	   /bin/cp $(DRAMA_H_FILES) $(DRAMA_C_FILES) ../configure_release/drama_src
	cd ../fpcol_src; \
	   /bin/cp $(FPCOL_H_FILES) $(FPCOL_C_FILES) ../configure_release/fpcol_src
	cd ../sla_src; \
	   /bin/cp $(SLA_H_FILES) $(SLA_C_FILES) ../configure_release/sla_src
	cd ../sds_src; \
	   /bin/cp $(SDS_H_FILES) $(SDS_C_FILES) ../configure_release/sds_src
	cd ../tdf_util; \
	   /bin/cp $(2DF_H_FILES) $(2DF_C_FILES) ../configure_release/tdf_util
	cd ../six_df_util; \
	   /bin/cp $(6DF_H_FILES) $(6DF_C_FILES) ../configure_release/six_df_util
	/bin/cp -r $(FPOSS_H_FILES) $(FPOSS_C_FILES) $(MAKEFILES) \
         $(RELEASE_FILES) $(2DF_OPERATIONAL_FILES) $(2DF_DOCO_FILES) \
         $(6DF_OPERATIONAL_FILES) ../configure_release/src
	cd ../configure_release; \
	   tar -cvf configure_source.tar *; \
	   gzip configure_source.tar
