#include "Axe.rules"

/* Where do you want the executables to be installed */
Bindir = ${BINDIR}

/* Where do you want the app defaults file to be installed */
Appdir = ${XAPPLOADDIR}

/* Where do you want the man page to be installed */
Mandir = ${MANDIR}

/* Where do you want the ancilliary files to be installed */
AxeLibdir = ${LIBDIR}


/* Do you have Wcl 2.2 or later (just for the Table widget) installed?   */
/* If not then the 2.5 Table widget that is provided will be compiled    */
/* If you do, and want to use it, then uncomment and modify the next two */
/* sections to say where...                                              */

/*  ...the include files are, i.e. XpIncDir/X11/Xp exists */
/* #define XpIncDir /usr/local/Wcl/include */

/* ...and where the Xp and Wc libraries are */
/*    i.e. XpLibDir/libXp.a (or .so.?.?) exists */
/* #define XpLibDir /usr/local/Wcl/lib */



/* If you want to incorporate the optional extension language feature first */
/* read the file INSTALL for more information and uncomment the next line */
/* #define Extension */

/*  ...and state where the Tcl include files are */
/* #define TclIncDir /usr/local/tcl/include */

/* ...and where the library is, i.e. TclLibDir/libtcl.a (or .so.?.?) exists */
/* #define TclLibDir /usr/local/tcl/lib */



/* Uncomment the next but one line if you want to build an Xaw3d version */
/* Please read the file INSTALL for essential information in this area */
/* #define ThreeD */

/* ... and state the pathname of the directory containing the Xaw3d headers */
/* #define Xaw3dIncDir /usr/local/Xaw3d/include/X11/Xaw3d */

/* ... and where the Xaw3d library is to be found. This can be omitted */
/* if the library is in the standard place in the installed X tree */
/* #define Xaw3dLibDir /usr/local/Xaw3d/lib */



/* Uncomment the next line if you have <sys/dir.h> rather than <dirent.h> */
/* NB It is probably also necessary to specify this under SYSV to force the*/
/*    inclusion of <sys/dir.h>. The symptons when it might be required are */
/*    characters missing from the filenames in the file selector popup.    */ 
/* #define NODIRENT */



/* Uncomment the final line if you have X11R5 patched to >= patchlevel 20 */
/* Otherwise a workaround for a bug that was fixed in that patch will be  */
/* enabled. The workaround assists regular expression query replace.      */
/* Query replace via the standard search popup will still be buggy though */
/* HAVEX11R5PL20 = -DHAVEX11R5PL20 */



/* If you know, or find, that your system doesn't have scandir/alphasort */
/* you might like to try the supplied versions to see if they work. In   */
/* which case uncomment the next line */
/* #define NOSCANDIR */



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



/*------ No need (hopefully) to change anything below this line ------*/

#if ProjectX < 5
R4ONLY_SRCS = Porthole.c
R4ONLY_OBJS = Porthole.o
#else
R5ONLY_SRCS = Viewlist.c
R5ONLY_OBJS = Viewlist.o
#endif

#ifdef XpLibDir
TABLE_INCLUDES = -I/**/XpIncDir
 TABLE_LDFLAGS = -L/**/XpLibDir
    TABLE_LIBS = -lXp -lWc
#else
    TABLE_SRCS = Table.c TableVec.c TableLoc.c
    TABLE_OBJS = Table.o TableVec.o TableLoc.o
#endif

#ifdef Extension
    EXTN_SRCS = Language.c
    EXTN_OBJS = Language.o
EXTN_INCLUDES = -I/**/TclIncDir
 EXTN_LDFLAGS = -L/**/TclLibDir 
    EXTN_LIBS = -ltcl
    EXTENSION = -DEXTENSION
#endif
    EXTN_DEPS = AxeEditor.o axe.o

#ifdef ThreeD
XAW3D_INCLUDES = -I./X11/Xaw3d
 XAW3D_LDFLAGS = -L/**/Xaw3dLibDir
    XAW3D_LIBS = -lXaw3d
         XAW3D = -DXAW3D
#endif
    XAW3D_DEPS = AxeCommand.o AxeMenuBtn.o AxeSmeBSB.o

#ifdef NOSCANDIR
  SCANDIR_SRCS = scandir.c
  SCANDIR_OBJS = scandir.o
#endif

DEFINES = ${EXTENSION} ${XAW3D} ${HAVEX11R5PL20} ${MAXPATHLEN}

SRCS = ${TABLE_SRCS} ${EXTN_SRCS} \
       AxeWindow.c AxeEditor.c AxeMenuBtn.c AxeSimMenu.c \
       AxeSmeBSB.c AxeCommand.c AxeTextDeck.c AxeText.c \
       AxeiiText.c AxeiiUndo.c AxeiiSink.c \
       FileNomWin.c FileNom.c ${R5ONLY_SRCS} ${R4ONLY_SRCS} ScrollText.c \
       NumericPad.c CtrlCodeSel.c Preference.c Confirmer.c \
       ${SCANDIR_SRCS} regexp.c insertfile.c match.c axe.c
OBJS = ${TABLE_OBJS} ${EXTN_OBJS} \
       AxeWindow.o AxeEditor.o AxeMenuBtn.o AxeSimMenu.o \
       AxeSmeBSB.o AxeTextDeck.o AxeCommand.o AxeText.o \
       AxeiiText.o AxeiiUndo.o AxeiiSink.o \
       FileNomWin.o FileNom.o ${R5ONLY_OBJS} ${R4ONLY_OBJS} ScrollText.o \
       NumericPad.o CtrlCodeSel.o Preference.o Confirmer.o \
       ${SCANDIR_OBJS} regexp.o insertfile.o match.o axe.o

/*
 * -I. comes after TABLE_INCLUDES to ensure that Table headers in ./X11/Xp
 * are not accessed instead of the locally installed ones, and before
 * EXTN_INCLUDES to ensure that the local regexp.h is used rather than
 * the one provided by Tcl, or any other.
 */
 EXTRA_INCLUDES = ${TABLE_INCLUDES} -I. ${EXTN_INCLUDES} ${XAW3D_INCLUDES}
  LOCAL_LDFLAGS = ${TABLE_LDFLAGS} ${EXTN_LDFLAGS} ${XAW3D_LDFLAGS}
LOCAL_LIBRARIES = ${TABLE_LIBS} ${EXTN_LIBS} ${XAW3D_LIBS} XawClientLibs
        DEPLIBS = XawClientDepLibs

ComplaxeProgramTarget(axe,${Bindir},${Appdir},${Mandir},${AxeLibdir})
InstallAxeDefaults(Axe,${Appdir})
InstallMultiple(axe.help.gnrl axe.help.bind axe.help.cust axe.help.pops axe.help.chng axe.help.extn axe.tcl,${AxeLibdir})

/*
 * It ought to be possible to use NullParameter in place of
 * -DDUMMY but that doesn't work everywhere, e.g. HP-UX 8.07
 */ 
SpecialObjectRule(axe.o,version.h,-DDUMMY)

#ifdef NODIRENT
SpecialObjectRule(FileNom.o,,-DNODIRENT)
#ifdef NOSCANDIR
SpecialObjectRule(scandir.o,,-DNODIRENT)
#endif
#endif

AllTarget(coaxe)
NormalProgramTarget(coaxe,coaxe.o,,${XLIB},)
InstallCoaxe(${Bindir})

#ifdef Extension
MakeAxeDefaults(${AxeLibdir},)
#else
MakeAxeDefaults(${AxeLibdir},\/\*\*\/)
#endif

#ifdef ThreeD
BuildThreeDIncludes(Xaw3dIncDir)
#endif
