/******************************************************************************
  Imakefile
  Z261093

Imakefile for XCCPJIFFIES
******************************************************************************/

/******************************************************************************
	The current distribution of xccp jiffies was "debugged" on
        following set of machines (operating systems).

Machine		Opearing system		Symbol	Remark
SGI		IRIX 4.*        	IRIX_4	older version used to run on
						IRIX 3.5
SGI             IRIX 5.*                IRIX_5  only slightly different from
                                                IRIX_4
SGI             IRIX 6.*                IRIX_6  same as IRIX_5 to be used upto
                                                and incl irix6.3
SGI             IRIX 6.4                IRIX_6_4 seems to default to
                                                n32 so U77/I77 etc replaced by ftn
SGI             IRIX 6.5                IRIX_6_5 seems to default to 
                                                n32 so U77/I77 etc replaced by ftn
SGI             IRIX64 6.*              IRIX_64 64-bit: not well tested!
                                                Local installations often
                                                have U77, I77, F77 libraries 
                                                missing.
IBM PC		linux			LINUX   may need changes for different
                                                compilers (egcs, gcc)
ESV		ES/os 2.2		ESV_2
Alliant 2800	Concentrix 2.2		AL2800_2
Convex C220	???			CONVEX
Sun SPARC       SunOS4                  SUNOS_4 Tested with SunPro
                                                compilers and MIT X11.5
                                                See comment `standard' 
                                                configuration.
Sun SPARC       SunOS5                  SUNOS_5 SunPro compilers and OpenWindows
DECAPLHAOSF1    DEC OSF/1 V1.3A         DECALPHAOSF
HP-UX           HP-UX                   HPUX    Tested by Morten Kjeldgaard
workstation
******************************************************************************/

/*****************************************************************************/
/*** DEAR USER !!!! CUSTOMIZE FOLLOWING LINES PLEASE:                      ***/
/*****************************************************************************/

/*** Machine specification & compiler options ***/
#define IRIX_6          /* replace this definition with one of those above
                           for your machine. Keep the "#", it is not
                           a comment !!! */
     CDEBUGFLAGS = 	/* compiler/site specific */

/*** Site specific ***/
/*	The directories will agree with values which ccp4.setup has set if
	you install jiffies from the CCP4 environment.
	BUT, please be sure that directory $(CCP4_LIB)/X11 exists !!!
	---
     You will need to define CBIN and CCP4_LIB explicitly if your make 
     doesn't inherit them from the environment.
*/
          BINDIR = $(CBIN)
      TOMFONTDIR = $(CCP4_LIB)                  /* Tom fonts destination */
     XAPPLRESDIR = $(CCP4_LIB)/X11/app-defaults /* application def. file dest*/

        TOM_FONT = $(TOMFONTDIR)/nice_font.bin  /* Font in use */
    PLOT_COMMAND =  lp -s -dmicrolaser          /* Postscript spooler */
   PRINT_COMMAND =  lp -s -denscript            /* Enscript spooler */

/*****************************************************************************/
/*** DEAR USER !!!! END OF CUSTOMIZATION                                   ***/
/*****************************************************************************/



/*****************************************************************************/
/*****************************************************************************/
/*** Guru section follows, do not touch unless really necessary            ***/
/*****************************************************************************/


#if defined (IRIX_4) || defined (IRIX_5) || defined (IRIX_6)
       CCOPTIONS = -prototypes -float -DIRIX_4
EXTRA_LOAD_FLAGS = -lI77 -lisam -lU77 -lF77 -lm
 EXTRA_LIBRARIES =
         DEPLIBS =
#if defined (IRIX_5) || defined (IRIX_6)
    INSTDATFLAGS =  /* else data files get installed read-only and
		       owned by root (irix5.2) */
#endif
#endif /* IRIX_4 || IRIX_5 || IRIX_6 */

#if defined (IRIX_6_4) || defined (IRIX_6_5)
       CCOPTIONS = -fullwarn -DIRIX_4
EXTRA_LOAD_FLAGS = -lftn
 EXTRA_LIBRARIES =
         DEPLIBS =
#endif /* IRIX_6_5 IRIX_6_5 */

#if defined (IRIX_64)
       CCOPTIONS = -64 -mips4 -DIRIX_4
          FFLAGS = -64 -mips4
EXTRA_LOAD_FLAGS = -lI77 -lisam -lU77 -lF77 -lm
 EXTRA_LIBRARIES =
         DEPLIBS =
         SHLIBDIR = /usr/lib64
#endif /* IRIX_64 */

#if defined (LINUX)
/* This section from Joe Krahn */
 CC=gcc
 CCOPTIONS = -I/usr/include/X11R6
 EXTRA_LOAD_FLAGS = -lf2c 
 EXTRA_LIBRARIES =
 DEPLIBS =
 FC= g77 -fno-second-underscore
#endif /* linux */


#ifdef AL2800_2
       CCOPTIONS = -DAL2800_2
EXTRA_LOAD_FLAGS = -lfortran_u -lF77
 EXTRA_LIBRARIES =
         DEPLIBS =
#endif /* AL2800_2 */

#ifdef ESV_2
          FFLAGS = -w
       CCOPTIONS = -I/usr/include -DESV_2
EXTRA_LOAD_FLAGS = -lI77 -lisam -lU77 -lF77 -lm -lbsd
         DEPLIBS =
#endif /* ESV_2 */

#ifdef CONVEX
/* You may need to define CBIN and CCP4_LIB as Convex make reportedly 
   doesn't inherit them from the environment */
              CC = gcc -g -w
       CCOPTIONS = -DCONVEX -DSYSV
EXTRA_LOAD_FLAGS = -lI77 -lU77 -lmathC2 -lF77 -lD77
         DEPLIBS =
#endif /* ESV_2 */

#ifdef SUNOS_4
/* [Dave Love] I had a lot of trouble with this, but that may be due */
/* to our mixture of Openwindows and X11R5.  I found I tickled this in
    EditString.c:
      XtError("editStringWidgetClass - you MUST useStringInPlace");
   If I tried to use the Openwindows libraries, but I don't know if
   ours have all the patches applied.

   Also, I had no success using gcc with our SunPro 2.0.1 f77
   (couldn't get xloggraph linked)
*/
 CC = acc
/* The link stuff should probably be assigned to a different imake */
/* symbol, but I couldn't find an appropriate one -- it has to come */
/* *before* the X libraries, it seems. */
 CCOPTIONS = -Xa -DSUNOS_4
 CDEBUGFLAGS =
 TOP_INCLUDES = 
/* With OpenWindows and SunPro, I'd expect the following to work:
 STD_INCLUDES =  -I/usr/openwin/include
 EXTRA_LOAD_FLAGS = -lM77 -lF77 -lm
 */
 STD_INCLUDES =  -I/usr/local/include
 EXTRA_LOAD_FLAGS = -L/usr/lang/SC2.0.1 -lF77 -lM77 -L/usr/local/lib
         DEPLIBS =
#endif

#ifdef SUNOS_5
 CC = cc
/* The link stuff should probably be assigned to a different imake */
/* symbol, but I couldn't find an appropriate one -- it has to come */
/* *before* the X libraries, it seems. */
 CCOPTIONS = -DSUNOS_4
 CDEBUGFLAGS =
 TOP_INCLUDES = 
 STD_INCLUDES =  -I/usr/openwin/include
 EXTRA_LOAD_FLAGS = -lM77 -lF77 -lsunmath -lm
         DEPLIBS =
#endif

#ifdef DECALPHAOSF
          FFLAGS = 
       CCOPTIONS = -DDECALPHAOSF
EXTRA_LOAD_FLAGS = -lfor -lm -lots
         DEPLIBS =
#endif /* DECALPHAOSF */

#if defined (HPUX)
/* This section has kindly come from Morten Kjeldgaard */
 CC=gcc
 CCOPTIONS = -I/usr/include/X11R5
 EXTRA_LOAD_FLAGS = -lf -lm
 EXTRA_LIBRARIES =
 DEPLIBS =
 FC= f77 +U77
#endif /* HPUX */

/********************** DO NOT EDIT BELOW THIS LINE **************************/
/*****************************************************************************/
/*** Couple of new rules  DO NOT TOUCH***/

/******************************************************************************
 * ZProgramTarget - generate rules for compiling and linking the 
 * program specified by "program" and "objects" & installing the program.
 * It can used in Imakefiles that describe multiple programs.
 */
#ifndef ZProgramTarget
#define	ZProgramTarget(program,objects)					@@\
									@@\
AllTarget(program)							@@\
									@@\
program: objects $(DEPLIBS)						@@\
	RemoveTargetProgram($@)						@@\
	$(CC) -o $@ objects $(LDOPTIONS) $(LOCAL_LIBRARIES)\
	$(LDLIBS) $(EXTRA_LOAD_FLAGS)					@@\
									@@\
install:: program                                                       @@\
	-@if [ ! -d  $(BINDIR) ];then mkdir $(BINDIR);else exit 0;fi	@@\
	$(INSTALL) -c $(INSTPGMFLAGS) program $(BINDIR)/program		@@\
									@@\
clean::									@@\
	$(RM) program
#endif /* ZProgramTarget */


/*****************************************************************************
 * ZTmpForProgramTarget - generate rules for compiling and linking the fortran
 * temporary existing program specified by "program" and "objects".
 * Program is used during instalation procedure and is NOT installed.
 * Rule can used in Imakefiles that describe multiple programs.
 */
#ifndef ZTmpForProgramTarget
#define	ZTmpForProgramTarget(program,objects)       			@@\
									@@\
AllTarget(program)							@@\
									@@\
program: objects $(DEPLIBS)						@@\
	RemoveTargetProgram($@)						@@\
	$(FC) -o $@ objects $(FLDOPTIONS)				@@\
									@@\
clean::									@@\
	$(RM) program
#endif /* ZTmpForProgramTarget */


/******************************************************************************
 * ZTomFontTarget - generate rule for compiling and installing Tom's font.
 * can be used for several fonts.
 */
#ifndef ZTomFontTarget
#define ZTomFontTarget(fontname)					@@\
					                                @@\
AllTarget(fontname/**/.bin)					        @@\
					                                @@\
fontname/**/.bin: fontname/**/.asc back_font				@@\
	./back_font fontname					        @@\
					                                @@\
clean::					                                @@\
	$(RM) fontname/**/.bin                                          @@\
			                                                @@\
install::	fontname/**/.bin                                        @@\
	-@if [ ! -d  $(TOMFONTDIR) ];then mkdir $(TOMFONTDIR);else exit 0;fi @@\
	$(INSTALL) -c $(INSTDATFLAGS) fontname/**/.bin $(TOMFONTDIR)
#endif /* ZTomFontTarget */


/******************************************************************************
 * ZAppDefaultsTarget - generate rule for crating application default
 * file and installing it
 */
/* The `for' loop has been layed out to avoid SunOS imake scrambling it... */
#ifndef ZAppDefaultsTarget
#define ZAppDefaultsTarget(class,res)					@@\
									@@\
AllTarget(class)						        @@\
									@@\
class:	class/**/.AppDefaults						@@\
	@cp class/**/.AppDefaults class					@@\
	@echo >> class							@@\
	@echo !!!! Resources set during install procedure !!!! >> class	@@\
	@for r \ @@\
 in res; \ @@\
	do echo $$r >> class; done			@@\
									@@\
clean::					                                @@\
	$(RM) class							@@\
									@@\
install::	class							@@\
	-@if [ ! -d  $(XAPPLRESDIR) ];then mkdir $(XAPPLRESDIR);else exit 0;fi @@\
	$(INSTALL) -c $(INSTDATFLAGS) class $(XAPPLRESDIR)/class
#endif /*ZAppDefaultsTarget */








/*****************************************************************************/
/************************ Project description ********************************/
/*****************************************************************************/

 LOCAL_LIBRARIES = XawClientLibs
   SYS_LIBRARIES = -lm

/************************ Project Source Code ********************************/
            SRCS = \
		msg_box.c ZDr2d.c EditString.c hardcopy_ctrl.c \
			xplot84driver.c plot84_file.c \
			xloggraph.c log_file.c tom_fortran_interface.c \
			back_font.f bits_and_pieces.f graphics.f

/************************** Program xloggraph ********************************/
  XPLOT84DRIVER_OBJS = \
			xplot84driver.o plot84_file.o msg_box.o ZDr2d.o \
			EditString.o hardcopy_ctrl.o

/************************** Program xloggraph ********************************/
  XLOGGRAPH_OBJS = \
		msg_box.o ZDr2d.o EditString.o hardcopy_ctrl.o \
                        xloggraph.o log_file.o tom_fortran_interface.o \
			bits_and_pieces.o graphics.o

/************************* Program xccpjiffy2idraw **************************/
XCCPJIFFY2IDRAW_OBJS = \
		xccpjiffy2idraw.o

/********************** Temporary Program back_font **************************/
   BACK_FONT_OBJS = \
			back_font.o

/*************************** Makefile generation *****************************/

ZProgramTarget(xplot84driver,$(XPLOT84DRIVER_OBJS))
ZProgramTarget(xccpjiffy2idraw,$(XCCPJIFFY2IDRAW_OBJS))
ZProgramTarget(xloggraph,$(XLOGGRAPH_OBJS))
ZTmpForProgramTarget(back_font,$(BACK_FONT_OBJS))

ZTomFontTarget(font)
ZTomFontTarget(nice_font)

ZAppDefaultsTarget(XCCPJiffy, "XCCPJiffy*psPlotCommand: $(PLOT_COMMAND)" \
                              "XCCPJiffy*textPrintCommand: $(PRINT_COMMAND)" \
			      "XCCPJiffy*tomFontPath: $(TOM_FONT)")

DependTarget()
