#
#	 Imakefile for asedit Release 1.11
#	 (C) A. Stochniol, 1993
#	 18.01.1993
#


#include "As.rules"


#   -----------------
#   *** 1. SELECT ***
#
#   which Motif, Xt Toolkit and X library are you using ?
#   Usually you do NOT change the 3 definitions that follows unless you use
#   extra shared libraries (in which case you would probably use "-lXm_s -lPW",
#   "-lXt_s", "-lX11_s" respectively).
#   Note that on some systems you might not need PW library at all (see below).
#
#   If you use libraries located in non-standard tree you might define
#   my LOCAL_X_LIBDIR variable instead of specifiying the full pathname for
#   each library (see the SUN example).
#

LOCAL_X_LIBDIR =

XMLIB    = -lXm 
XTOOLLIB = -lXt
XLIB     = -lX11

#  Note about libPW.a: it is the Programmers Workbench library, which is
#    an ATT product not included in Berkeley systems. Hence it is not found
#    in SunOS or Ultrix. The library is needed because of regex(3) routines
#    i.e. regcmp & regex, for systems that do not have them in the libc.a.
#    If you don't have libPW.a (SunOS, Ultrix) simply don't specify "-lPW".
#
#
#  On some systems the libaries and include files might be located
#  in quite strange places. Below there are lines that I've used to install
#  asedit on different systems around my place (you might find it helpful).
#
#  DEC settings (to use uncomment the lines below)
#  XMLIB = /usr/lib/DXM/lib/Xm/libXm.a
#  XTOOLLIB = /usr/lib/DXM/lib/Xt/libXt.a
#  STD_INCLUDES = -I/usr/lib/DXM/lib -I/usr/lib/DXM/lib/Xt
#
#  SUN settings (to use uncomment the lines below)
#  LOCAL_X_LIBDIR =  -L/usr/local/lib
#  STD_INCLUDES = -I/usr/local/include
#
#  for SUN with X11R4 and Motif 1.1.4 I had to declare additionally
#      Xext and m (mathematical) libraries ...
#      XLIB     = -lXext -lX11 -lm

#
#  On most SUN's there are only non-ANSI C compilers available so you might
#  have to uncomment No_proto_def and No_stdarg_def variables (see later
#  in this file).





#   ------------------------------------
#   *** 2. SELECT *** X-Windows version !!!!!
#
#   Please specify what version of X-windows do you use. You can define
#   XVERSION as X11R5, X11R4 or X11R3. So edit the line XVERSION few lines
#   below.
#   Note about X-Windows Release 3:
#     As default asedit is prepared to run under X-windows Release 4 and 5
#     (with appropriate Motif versions).
#     Because in some places version 3 of X-windows and Motif 1.0 are still in
#     use special code is implemented in asedit to support such an environment
#     (beware that some bugs exist in that version that might affect using
#     asedit).
#

XVERSION = X11R5


#   XMULIB library is only needed for X11R4 and X11R5 versions !!
#   (for X11R3 the following line that defines XMULIB should be commented
#   or defined as an empty string !)

XMULIB = -lXmu

SYS_LIBRARIES =  $(LOCAL_X_LIBDIR) $(XMLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)



#   ---------------------------------------------------------------
#   *** 3. DEFINE *** a print command used for printing (default lp)
#   (if you have permission problems during remote printing redirect
#   the file into the command, e.g. use   lpr <    or   lp <   )   
#

Print_cmd = lp <



#   -----------------------------------------------------
#   *** 4. DEFINE *** backup file suffix (default: .bak )
#

Backup_file_suffix = .bak



#   ----------------------------------
#   *** 5. WHERE *** to install asedit
#
#   If you install contributed X applications in their standard place you do
#   NOT have to change the default definitions for BINDIR, XAPPLOADDIR, MANDIR
#   and LIBDIR.  But if you would like to install asedit somewhere else
#   you have to uncomment the lines that defines those names and explicitly
#   define appropriate directories (bear in mind that what is currently written
#   are the most often used X-Window defaults obtained after applying standard
#   X11 templates, i.e. they might be different on your system).
#   BINDIR 		- defines where the executables are installed
#   XAPPLOADDIR 	- defines where the app defaults files are installed
#   MANDIR      	- defines where the man pages are installed (standard suffix assumed)
#   LIBDIR      	- defines where the help file(s), etc. are installed
#

#   BINDIR  = /usr/bin/X11
#   XAPPLOADDIR = /usr/lib/X11/app-defaults
#   MANDIR = /usr/man/mann
#   LIBDIR = /usr/lib/X11


#
#   Special note for IBM RS/6000
#   If you would like to install asedit in the standard IBM X examples tree
#   you might do that easily just specifying appropriately the TOP variable.
#   If that's the case uncommenting the following "TOP=..." line should do.
#
   TOP=/usr/lpp/X11/Xamples


#   -------------------------------------------------------------------
#   *** 6. SPECIFY **** where do you want the help file to be installed
#

Help_dir = ${LIBDIR}


#
#   --------------------------------------------------------------------
#   *** 7. TUNE **** specifically to your system if something goes wrong
#
#
#   define increase of String literal space for asedit.c compilation: if
#   it is needed (because of the fallbacks), simply uncomment the STRING_INC
#   line below.
#
#   STRING_INC  = -Wf,-XNl4096


#   If you find that prototypes are not supported on your system
#   (non ANSI C, etc.) then uncomment the next line
#   No_proto_def = -D_NO_PROTO

#
#   If you find that <stdarg.h> does not exist on your system  then
#   uncomment the next line  (at that case you probably would have to uncomment
#   the line with No_proto_def above !)
#   No_stdarg_def = -D_NO_STDARG

#
#   If you find that MAXPATHLEN is not defined then uncomment the next line
#   No_maxpathlen_def = -DMAXPATHLEN=1024

#   I have used a focusCallback to set focus to a text widget inside  prompt
#   dialogs (& inside other dialogs) when the dialog is first managed.
#   UNFORTUNATELY this trick corrupts the dialog callback list on ONE computer.
#   It is a DEC running X11R4 and Motif 1.1.  So I think it might be a bug.
#   The corruption happens when you manage a dialog (for example Search/Go to line..)
#   & set a focus to the dialog, next take away the focus & next set a focus
#   to the dialog (using for example a pointer). At that stage the program
#   blows up ! I've tried different ways to get around that problem  and preserve
#   setting the focus to the text widget but I've failed. So if you get such
#   a problem the only work around is to define XFOCUS_BUG and rebuild asedit
#   (but you won't get the text widget focused when you first manage dialogs!
#    Define xfocus_bug as -DXFOCUS_BUG below).
#   xfocus_bug  = -DXFOCUS_BUG
#

#   Note about FUTURE Motif releases only:
#   	There is a misdesign in the current implementation of the Text
#   	widget. A method of obtaining XmNvalue by calling XtGetValues()
#   	or XtVaGetValues() (in the appropriate way) should return
#   	a pointer to internal data stored in the Text widget. In reality
#   	the Text widget responds by allocating memory and returning
#   	a copy of the text just like XmTextGetString(). Currently
#   	this data MUST be freed after use (otherwise we get memory
#   	leakage!). If that design misfeature is fixed in a feature
#   	release of the Motif toolkit we should define
#             GET_TEXT_VALUE_BUG_FIXED
#   	in the Imakefile/Makefile/source or get rid of appropriate
#   	"ifndef's" altogether ! (they appears in 2 files: asedit.c
#   	and undo.c).
#
 
      DEFINES = -D${XVERSION} $(No_proto_def) $(No_stdarg_def) $(No_maxpathlen_def) $(xfocus_bug)


#
#    END of customisation part of the Imakefile
#



      SRCS = asedit.c as_menuh.c file_rw.c clipbrd.c \
	     write_lw.c find_position.c asutil.c undo.c ht_help.c

      OBJS = asedit.o as_menuh.o file_rw.o clipbrd.o \
	     write_lw.o find_position.o asutil.o undo.o ht_help.o




#   asedit dependencies .....

asedit.o  :	asedit.h clipbrd.h asedit_icon Asedit.ad.h

as_menuh.o:	asedit.h

asutil.o  :	asedit_icon

clipbrd.o :	clipbrd.h



#
#   A rule to convert the X resource file into C declarations,
#   appropriate for inclusion as fallback resources.
#   The following rule ensures that asedit always has the latest version of its
#   resources compiled into the executable.
#

Asedit.ad.h:    ${XVERSION}.ad Imakefile
	./ad2c.script ${XVERSION}.ad > Asedit.ad.h

NormalLibraryObjectRule()
SpecialObjectRule(asedit.o,Imakefile,${STRING_INC} '-DPRINT_CMD="${Print_cmd}"')
SpecialObjectRule(ht_help.o,Imakefile,-DHELPDIR=\"${Help_dir}\")
SpecialObjectRule(file_rw.o,Imakefile,-DBACKUP_FILE_SUFFIX=\"${Backup_file_suffix}\")

ComplexProgramTarget(asedit)
AllTarget(asedit)

#
#   Install the application default file (version related!)
#
InstallAppDefaultsLong($(XVERSION),Asedit)

#   Install the help file
InstallNonExec(asedit.hlp,${Help_dir})


#   That's it !



