#
# Imakefile for xpaint
#

XPAINT_TOP = ./
#include "Local.config"

DEFINES = $(XPM_INCLUDE) $(EXTRA_DEFINES)

#define PassCDebugFlags CDEBUGFLAGS=DefaultCDebugFlags

#########################
# Nothing to change below here

XPSRC = main.c menu.c operation.c graphic.c misc.c \
        fileName.c fontSelect.c colorEdit.c \
        pattern.c hash.c palette.c fatBitsEdit.c  \
        dialog.c protocol.c size.c text.c cutCopyPaste.c \
	image.c imageComp.c color.c readRC.c \
	iprocess.c help.c typeConvert.c grab.c
XPOBJ = main.o menu.o operation.o graphic.o misc.o \
        fileName.o fontSelect.o colorEdit.o \
        pattern.o hash.o palette.o fatBitsEdit.o \
        dialog.o protocol.o size.o text.o cutCopyPaste.o \
	image.o imageComp.o color.o readRC.o \
	iprocess.o help.o typeConvert.o grab.o

OPSRC = pencilOp.c boxOp.c lineOp.c circleOp.c  \
        brushOp.c fontOp.c arcOp.c polyOp.c fillOp.c \
        selectOp.c sprayOp.c blobOp.c
OPOBJ = pencilOp.o boxOp.o lineOp.o circleOp.o  \
        brushOp.o fontOp.o arcOp.o polyOp.o fillOp.o \
        selectOp.o sprayOp.o blobOp.o

XPWIDSRC = Paint.c Colormap.c PaintRegion.c PaintUndo.c PaintEvent.c 
XPWIDOBJ = Paint.o Colormap.o PaintRegion.o PaintUndo.o PaintEvent.o 

SRCS = $(XPSRC) $(OPSRC) $(XPWIDSRC) $(RWSRC)
OBJS = $(XPOBJ) $(OPOBJ) $(XPWIDOBJ) $(RWOBJ)

HDRS = Colormap.h ColormapP.h hash.h Paint.h \
	PaintP.h palette.h xpaint.h menu.h \
	text.h cutCopyPaste.h image.h patchlevel.h \
	misc.h rc.h ops.h

SYS_LIBRARIES = XawClientLibs -lm

#ifdef SGIArchitecture
SGI_LIB = -limage
#endif

DEPLIBS = always
LOCAL_LIBRARIES = rw/librw.a $(XPM_LIB) $(TIFF_LIB) $(SGI_LIB) $(JPEG_LIB)

SUBDIRS = rw xpm libtiff

XCOMM all::	  .msgPrinted
XCOMM install:: .msgPrinted
XCOMM
XCOMM .msgPrinted:
XCOMM	@echo
XCOMM	@echo "** By default TIFF support is compiled into XPaint, if you do not have"
XCOMM	@echo "** the TIFF libraries installed on you system, or they are installed"
XCOMM	@echo "** in another directory that where XPaint looks for them.  Read the file"
XCOMM	@echo "** 'TiffMSG' for information on how to change/update the library information."
XCOMM	@echo
XCOMM	@touch .msgPrinted

ComplexProgramTarget(xpaint)
InstallAppDefaults(XPaint)

NamedMakeSubdirs(always, $(SUBDIRS))
MakefileSubdirs($(SUBDIRS) bitmaps)
CleanSubdirs($(SUBDIRS))

# Other targets...

clean::
	rm -f XPaint.ad.h DefaultRC.txt.h Help.txt.h

includes:: XPaint.ad.h DefaultRC.txt.h Help.txt.h

XPaint.ad.h: XPaint.ad
	./ad2c.script $? > $@
DefaultRC.txt.h: DefaultRC
	./ad2c.script $? > $@
Help.txt.h: Help.txt
	sed 's/^$$/ /' < $? | ./ad2c.script > $@

main.o: XPaint.ad.h
readRC.o: DefaultRC.txt.h
help.o: Help.txt.h

TEXT = README INSTALL TODO Operator.doc xpaint.man DefaultRC Help.txt TiffMSG
MISC = Imakefile Makefile.std ad2c.script XPaint.ad Local.config

#
#  The following lines are in order, so that make does them
#    in the right order, WILL NOT PARRALiZE
#

makelist:: 
	-$(RM) filelist
	@touch filelist

makelist:: 
	sh -c 'for i in '"$(TEXT) $(SRCS) $(MISC) $(HDRS)"' ; do \
		echo $(CURRENT_DIR)/$$i >> $(TOP)/filelist ; done '

NamedTargetSubdirs(makelist, $(SUBDIRS) bitmaps, , , makelist)


kit: makelist
	sh -c 'sum="`cat filelist`" ; makekit -oMANIFEST MANIFEST $$sum'

tar: makelist
	sh -c 'cd .. ; tar cf - `sed -e "s:^./::" -e "s:^:xpaint/:" xpaint/filelist` | compress > xx.tar.Z'
