SHELL = /bin/sh

prefix=@prefix@
exec_prefix=@exec_prefix@
datadir=@datadir@
confdir=@confdir@
sbindir=@sbindir@

includedir=$(prefix)/include
mandir=$(prefix)/man
libdir=$(exec_prefix)/lib
bindir=$(exec_prefix)/bin

srcdir=@srcdir@
top_srcdir=@top_srcdir@
BUILDTOP=../..
VPATH=@srcdir@
CC=@CC@
INSTALL=@INSTALL@

DEBUG=-O
CFLAGS=$(DEBUG) -DDATADIR=\"$(datadir)\" -I$(top_srcdir)/h -I$(BUILDTOP)/h \
	@X_CFLAGS@ @CPPFLAGS@
LDFLAGS=$(DEBUG) -L$(BUILDTOP)/lib/zephyr -L$(BUILDTOP)/lib/dyn @ET_LDFLAGS@ \
	@X_LIBS@ @LDFLAGS@
LIBS=-lzephyr -ldyn -lXaw -lXmu -lXt @X_PRE_LIBS@ -lX11 -lXext @X_EXTRA_LIBS@ \
     @LIBS@ -lcom_err

OBJS=	interface.o resource.o destlist.o util.o bfgets.o gethomedir.o \
	dest_window.o xzwrite.o edit_window.o zephyr.o GetString.o Popup.o \
	yank.o menu_window.o logins.o

all: xzwrite

xzwrite: $(OBJS) $(BUILDTOP)/lib/zephyr/libzephyr.a \
	 $(BUILDTOP)/lib/dyn/libdyn.a @ETDEP@
	$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)

check:

install: xzwrite XZwrite
	$(INSTALL) -m 755 -s xzwrite $(bindir)
	$(INSTALL) -m 644 $(srcdir)/xzwrite.1 $(mandir)/man1
	$(INSTALL) -m 644 XZwrite $(datadir)
	$(INSTALL) -m 644 $(srcdir)/xzwrite.bitmap $(datadir)

clean:
	rm -f $(OBJS) xzwrite

$(OBJS): xzwrite.h xzwrite-proto.h $(top_srcdir)/h/sysdep.h
$(OBJS): $(BUILDTOP)/h/config.h $(BUILDTOP)/h/zephyr/zephyr.h
$(OBJS): $(BUILDTOP)/h/zephyr/zephyr_err.h
destlist.o logins.o xzwrite.o zephyr.o: $(top_srcdir)/h/dyn.h

.PHONY: all check install clean

