#
# Warning: the cpp used on this machine replaces
# all newlines and multiple tabs/spaces in a macro
# expansion with a single space.  Imake tries to
# compensate for this, but is not always
# successful.
#

#
# This makefile is automatically generated by imake... do not modify
# or you may lose your changes when imake generates makefiles again.
# Ignore this message if you are not using imake.
#

            TOP = ../..
             AS = as

              CC = cc
            CPP = /lib/cpp
             LD = ld
           LINT = lint
        INSTALL = install
           TAGS = ctags
             RM = rm -f
             MV = mv
             LN = ln -s
         RANLIB = ranlib
             AR = ar clq
             LS = ls
       LINTOPTS = -axz
    LINTLIBFLAG = -C
           MAKE = make
    STD_DEFINES =

      CDEBUGFLAGS = -O
        DESTDIR =

        PATHSEP = /
         DEPEND = $(DEPENDSRC)/makedepend
          IMAKE = $(IMAKESRC)/imake
            RGB = $(RGBSRC)/rgb
         CFLAGS = $(CDEBUGFLAGS) $(INCLUDES) $(STD_DEFINES) $(DEFINES)
      LINTFLAGS = $(LINTOPTS) $(INCLUDES) $(STD_DEFINES) $(DEFINES) -DLINT
        LDFLAGS = $(CDEBUGFLAGS) $(SYS_LIBRARIES) $(SYSAUX_LIBRARIES)
   INSTUIDFLAGS = -m 4755
   INSTLIBFLAGS = -m 0664
   INSTINCFLAGS = -m 0444
   INSTMANFLAGS = -m 0444
   INSTAPPFLAGS = -m 0444

      USRLIBDIR = /ai/lib/X11
         BINDIR = /ai/bin/X11
         LIBDIR = /ai/share/X11
     LINTLIBDIR = $(LIBDIR)/lint
         INCDIR = $(LIBDIR)/include
        FONTDIR = $(LIBDIR)/fonts
         UWMDIR = $(LIBDIR)/uwm
         MANDIR = /ai/man/manx
    XAPPLOADDIR = $(LIBDIR)/app-defaults
         ADMDIR = /var/log/X11

      CLIENTSRC = $(TOP)/clients
        DEMOSRC = $(TOP)/demos
         LIBSRC = $(TOP)/lib
        FONTSRC = $(TOP)/fonts
     INCLUDESRC = $(TOP)/X11
      SERVERSRC = $(TOP)/server
        UTILSRC = $(TOP)/util
     EXAMPLESRC = $(TOP)/examples
     CONTRIBSRC = $(TOP)/contrib
         DOCSRC = $(TOP)/doc
      DEPENDSRC = $(UTILSRC)/makedepend
       IMAKESRC = $(UTILSRC)/imake
       IRULESRC = $(UTILSRC)/imake.includes
         RGBSRC = $(UTILSRC)/rgb
        XLIBSRC = $(LIBSRC)/X
     TOOLKITSRC = $(LIBSRC)/Xt
     AWIDGETSRC = $(LIBSRC)/Xaw
     OLDXLIBSRC = $(LIBSRC)/oldX
   EXTENSIONSRC = $(TOP)/extensions
        XMANSRC = $(DOCSRC)/Xlib/Xman
   EXTENSIONLIB = $(EXTENSIONSRC)/lib/libXext.a
           XLIB = $(XLIBSRC)/libX11.a
        OLDXLIB = $(OLDXLIBSRC)/liboldX.a
       XTOOLLIB = $(TOOLKITSRC)/libXt.a
         XAWLIB = $(AWIDGETSRC)/libXaw.a
       LINTXLIB = $(XLIBSRC)/llib-lX11.ln
      LINTXTOOL = $(TOOLKITSRC)/llib-lXt.ln
        LINTXAW = $(AWIDGETSRC)/llib-lXaw.ln
       INCLUDES = -I$(TOP)
      MACROFILE = Sun.macros
      IMAKE_CMD = $(NEWTOP)$(IMAKE) -TImake.tmpl \
			-I$(NEWTOP)$(IRULESRC) \
			-s Makefile
         RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a \
			tags TAGS make.log

#
#	Xtroff ImakeFile
#
#	make [all]	compiles the programs in this directory
#	make install	makes and installs everything, including the fonts
#			and width tables for the default sun device. Yuk.
#	make xfonts	makes and installs the scaled (& converted) fonts
#			for X Windows
#	make width	Installs the devsun width info and runs makedev
#	make clean	cleans this directory
#
#	The following two defines might need to be changed.  The VFONTS
#	definition points towards the directory containing the Sun modified
#	Berkeley versatec font catalog.  These bits of these fonts are used
#	as the default screen font.  See the file fontstuff/MakeSunFonts for
#	more details.
#
#	The RSTFONTS definition points to the RST (Imagen) font
#	files.  If you don't have an Imagen printer then you won't need to
#	worry about these bits.  If you do have an Imagen printer then you
#	may want to see the file fontstuff/MakeImagenFonts for a way of getting
#	more accurate bits on the screen.  If you don't want to worry about
#	the fonts (and I don't blame you) then SunTroff will use the
#	Versatec fonts described above.
#
#	The SUNTROFF_FONTS points to the directory where the fonts
#	sit. It has subdirectories of the form 'dev'$DEVICE for each
#	typesetter's fonts - devsun is the default for the scaled
#	versatec fonts, devimp is for imagen, etc.
#	Make sure you comment out the "compressdir" for suntroff, or if your
#	X server is not able to load compressed fonts(most can).
VFONTS=/usr/lib/vfont
RSTFONTS=/usr/uturing/ron/rst
# Xfonts go here - wish the X11 server could read vfonts like
# the X10 server used to.
SUNTROFF_FONTS=/local/share/X11/fonts
#DEVICE=imp	#imagen
DEVICE=sun	#versatec - other printers like lw.
WIDTHDIR=/local/share/troff
MAKEDEV=/local/src/v8troff/troff/makedev
#	Percent MUST be two digits
#	For the imagen, percent is 120 / 300, i.e 40.
#PERCENT=40
#	For versatec fonts, which we use for laserwriters etc.,
#	percent should be 120/200. i.e. 66. We use 50 for a better
#	error margin.
PERCENT=50
#	For lots of debugging info, especially FONTDEBUG.
#DEBUG=-DFONTDEBUG -DWINDOWDEBUG -DTYPEDEBUG -DDEBUG
#CDEBUGFLAGS=-g
DEBUG=
CDEBUGFLAGS=-O

# 	Define -DNOADJUST is you don't want the adjustment of character
#	positions to make the X font match the troff font more closely.
#	It looks better if you don't define it, but if you have exact fonts,
#	or are experimenting...
# 	We have Menu/Menu.o, checkitem/CheckItem.o and menuitem/MenuItem.o
# 	installed as XtStuff - In fact, we keep all three (Menu. checkitem,
#	menuitem) in one directory to make matters simpler.
#	Window is straight from Chris Peterson's xman program.
CFLAGS = $(CDEBUGFLAGS) -DFONTDIR=\"${WIDTHDIR}\" \
	-DBITDIR=\"${SUNTROFF_FONTS}\" $(DEBUG) \
	-I./bitmaps -I./XtStuff -DNOADJUST
# These should be defined in an Imake.tmpl - except that the
# normal Imake.tmpl insists on these being compiled in the
# X directory tree.
XAWLIB=$(USRLIBDIR)/libXaw.a
XTOOLLIB=$(USRLIBDIR)/libXt.a
XLIB=$(USRLIBDIR)/libX11.a
MATHLIB=-lm

FC = fc
XTSTUFF = 	XtStuff/libXtStuff.a
OBJS1 =		xwindows.o suntroff.o parse.o font.o draw.o \
		fixpoint.o curves.o
SRCS1 =		xwindows.c suntroff.c parse.c font.c draw.c \
		fixpoint.c curves.c
PROGRAMS = 	xtroff
PREVIEWER = 	xtroff

 OBJS = $(OBJS1) $(OBJS2) $(OBJS3)
 SRCS = $(SRCS1) $(SRCS2) $(SRCS3)

all:: $(PROGRAMS)

xtroff: $(OBJS1) $(XTSTUFF) $(XAWLIB) $(XTOOLLIB) $(XLIB)
	$(RM) $@
	$(CC) -o $@ $(OBJS1) $(XTSTUFF) $(XAWLIB) $(XTOOLLIB) $(XLIB) $(LDFLAGS) $(MATHLIB)

install:: xtroff
	$(INSTALL) -c $(INSTALLFLAGS) xtroff $(BINDIR)

install:: xtroff.man
	$(INSTALL) -c $(INSTMANFLAGS) xtroff.man $(MANDIR)/xtroff.x
relink::
	$(RM) $(PROGRAMS)
	$(MAKE) $(MFLAGS) $(PROGRAMS)

depend:: $(DEPEND)

depend::
	$(DEPEND) -s "# DO NOT DELETE" $(CFLAGS) $(SRCS)

$(DEPEND):
	@echo "making $(DEPENDSRC)"; \
	cd $(DEPENDSRC); $(MAKE)

clean::
	$(RM) $(PROGRAMS)

$(XTSTUFF):
		cd XtStuff; make $(MFLAGS)

xfonts:
		-mkdir $(SUNTROFF_FONTS)
		cd fontstuff; make $(MFLAGS) CFLAGS="$(CFLAGS)" \
			VFONTS=$(VFONTS) \
			RSTFONTS=$(RSTFONTS) PREVIEWER=$(PREVIEWER) \
			FC=$(FC) PERCENT=$(PERCENT) \
			SUNTROFF_FONTS=$(SUNTROFF_FONTS) \
			DEVICE=dev$(DEVICE)
#		compressdir $(SUNTROFF_FONTS)

width:
		cp -r devsun ${WIDTHDIR};
		cd ${WIDTHDIR}/devsun;  \
		${MAKEDEV} DESC;	\
		rm -f [a-zA-Z] [a-zA-Z][a-zA-Z]

install::	xfonts width

clean::
		cd XtStuff ; make $(MFLAGS) clean
		cd fontstuff ; make $(MFLAGS) clean

depend::
		cd XtStuff; make $(MFLAGS) depend

Makefile::
		cd XtStuff ; make Makefile

tar:
		make clean
		-rm /tmp/xtroff.tar.Z
		cd ..; tar cvfX - xtroff/ExcludeFiles ./xtroff \
			| compress > /tmp/xtroff.tar.Z

lint:
	lint -abz $(SRCS) $(LDFLAGS) -lXaw -lXt -lX11 -lm $(LINTFLAGS)

clean::
	$(RM_CMD) \#*

Makefile:: $(IMAKE)

Makefile:: Imakefile \
	$(IRULESRC)/Imake.tmpl \
	$(IRULESRC)/Imake.rules \
	$(IRULESRC)/$(MACROFILE)
	-$(RM) Makefile.bak; $(MV) Makefile Makefile.bak
	$(IMAKE_CMD) -DTOPDIR=$(TOP)

$(IMAKE):
	@echo "making $(IMAKESRC)"; \
	cd $(IMAKESRC); $(MAKE)

tags::
	$(TAGS) -w *.[ch]
	$(TAGS) -xw *.[ch] > TAGS

install::
	@echo "install done"

Makefiles::

