GROFF_LIBDIR = /usr/local/share/groff
GROFF_FONTDIR = $(GROFF_LIBDIR)/font
GROFF_FONTPATH = .:$(GROFF_FONTDIR):/usr/local/lib/font:/usr/lib/font
DPIS = 75 100

PROGRAMS = gxditview xtotroff
DEPLIBS = XawClientDepLibs
LOCAL_LIBRARIES = XawClientLibs
SRCS1 = xditview.c Dvi.c draw.c font.c lex.c page.c \
        parse.c XFontName.c DviChar.c device.c
OBJS1 = xditview.o Dvi.o draw.o font.o lex.o page.o \
        parse.o XFontName.o DviChar.o device.o
SRCS2 = xtotroff.c XFontName.c DviChar.c
OBJS2 = xtotroff.o XFontName.o DviChar.o
INCLUDES = -I$(TOOLKITSRC) -I$(TOP)
MATHLIB = -lm
DEFINES = $(SIGNAL_DEFINES) -DFONTPATH=\"$(GROFF_FONTPATH)\" # -DX_NOT_STDC_ENV

ComplexProgramTarget_1(gxditview,$(LOCAL_LIBRARIES),$(MATHLIB))
NormalProgramTarget(xtotroff,$(OBJS2),$(DEPXLIB),$(XLIB), /**/)

InstallAppDefaults(GXditview)

fonts: xtotroff DESC FontMap
	@dir=`pwd`; \
	fonts=`sed -e 's/[	 ].*//' FontMap`; \
	for dpi in $(DPIS); do \
	  echo Making devX$$dpi; \
	  test -d ../devX$$dpi || mkdir ../devX$$dpi; \
	  rm -f ../devX$$dpi/DESC; \
	  sed -e "s/res 75/res $$dpi/" DESC >../devX$$dpi/DESC; \
	  (cd ../devX$$dpi; \
	  rm -f Makefile.sub; \
	  echo DEV=X$$dpi >Makefile.sub; \
	  echo DEVFILES=DESC $$fonts >>Makefile.sub; \
	  $$dir/xtotroff -g -r $$dpi -s 10 $$dir/FontMap); \
	  echo Making devX$$dpi-12; \
	  test -d ../devX$$dpi-12 || mkdir ../devX$$dpi-12; \
	  rm -f ../devX$$dpi-12/DESC; \
	  sed -e "s/res 75/res $$dpi/" -e 's/unitwidth 10/unitwidth 12/' DESC \
	    >../devX$$dpi-12/DESC; \
	  (cd ../devX$$dpi-12; \
	  rm -f Makefile.sub; \
	  echo DEV=X$$dpi-12 >Makefile.sub; \
	  echo DEVFILES=DESC $$fonts >>Makefile.sub; \
	  $$dir/xtotroff -g -r $$dpi -s 12 $$dir/FontMap); \
	done

GXditview-ad.h: GXditview.ad
	/bin/sh ad2c GXditview.ad >GXditview-ad.h

extraclean: clean
	-rm -f junk tmp grot old Makefile

FORCE:
