## ----- Install options -----
INCLUDE_DIRS = 
LIB_DIRS = -L/usr/lib/Motif1.2 -L/usr/lib/X11R5
GUI_LIBS = -lXm -lXt -lX11
LIBS = -lm
LIBRARIAN = ar
AR_FLAGS = r
RANLIB = 

## ----- General options -----
ZAF_INC_DIR = ../include
ZAF_LIB_DIR = ../lib
XPMLIB = Xpm
XPMLIB_NAME = $(ZAF_LIB_DIR)/lib$(XPMLIB).a
Z_INCLUDE_DIRS = -I. -I$(ZAF_INC_DIR) $(INCLUDE_DIRS)
Z_LIB_DIRS = -L$(ZAF_LIB_DIR) $(LIB_DIRS)
Z_LIBS = -l$(XPMLIB) $(GUI_LIBS) $(LIBS)

.SUFFIXES:
.SUFFIXES: .o .c

.c.o:
	cc $(Z_INCLUDE_DIRS) -c $<

## ----- Object files -----
XPM_OBJS = create.o \
	data.o \
	hashtab.o \
	misc.o \
	parse.o \
	scan.o \
	rgb.o \
	Attrib.o \
	CrBufFrI.o \
	CrBufFrP.o \
	CrDatFrI.o \
	CrDatFrP.o \
	CrIFrDat.o \
	CrIFrBuf.o \
	CrPFrDat.o \
	CrPFrBuf.o \
	CrIFrP.o \
	CrPFrI.o \
	Image.o \
	Info.o \
	RdFToP.o \
	RdFToI.o \
	RdFToDat.o \
	RdFToBuf.o \
	WrFFrI.o \
	WrFFrP.o \
	WrFFrDat.o \
	WrFFrBuf.o

## ----- Program -----

all: $(XPMLIB_NAME)
	cp xpm.h $(ZAF_INC_DIR)

clean:
	-rm -f *.o $(XPMLIB_NAME)

## ----- Libraries -----

$(ZAF_LIB_DIR)/lib$(XPMLIB).a: \
	$(XPM_OBJS)
	$(LIBRARIAN) $(AR_FLAGS) $@ $?
	$(RANLIB)
