/* Uncomment this 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 */


/* 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 */

/* If you don't have nawk, gawk (GNU awk), or awk that has the gsub */
/* function, set this to the name of an awk program that has it. */
/* (Older versions of awk don't have it.) */
/* If you don't specify an awk program, they are tried in this order: */
/* nawk, gawk, awk. */
/* #define AwkCmd gawk */


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


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


        DEFINES = ${MAXPATHLEN}
        DEPLIBS = XawClientDepLibs
LOCAL_LIBRARIES = XawClientLibs
  SYS_LIBRARIES = -lm
       INCLUDES = -I.
           SRCS = graphics.c oberfl.c modify.c io_trans.c objects.c \
                  FileNom.c FileNomWin.c ScrollText.c \
                  ${R5ONLY_SRCS} ${R4ONLY_SRCS} match.c ${SCANDIR_SRCS}
           OBJS = graphics.o oberfl.o modify.o yyscan.o io_trans.o objects.o \
                  FileNom.o FileNomWin.o ScrollText.o \
                  ${R5ONLY_OBJS} ${R4ONLY_OBJS} match.o ${SCANDIR_OBJS}

ComplexProgramTarget(xtexcad)
InstallAppDefaults(XTeXcad)

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

oberfl.o: resources.h

/* if no AwkCmd was given, try hard to find a suitable one */
#ifdef AwkCmd
AWK = AwkCmd
#else
#define AwkTest(p) p -f ./res2fb.awk < /dev/null >/dev/null 2>/dev/null
AWK =	if AwkTest(nawk); then awk=nawk; \
	elif AwkTest(gawk); then awk=gawk; \
	else awk=awk; fi; \
	$$awk
#endif

resources.h: XTeXcad.ad
	$(AWK) -f ./res2fb.awk < XTeXcad.ad > resources.h

clean::
	$(RM) resources.h
