EXTRA_CFLAGS = $(XCFLAGS) $(XINCPATH) $(XMINCPATH)

BOGUS = $(VECTLIB) $(GISLIB) $(DISPLAYLIB)

XXX = $(XMLIBPATH) $(XMLIB) $(XLIBPATH) -lXext $(XTLIBPATH) $(XTLIB) \
 $(XLIB)

YYY = -ll $(XEXTRALIBS) -lm

LIBS = $(BOGUS) $(XGDLIB) $(XGILIB) $(XXX) $(XPMLIB) $(BOGUS) $(YYY)

SABERLIBS = $(XPMLIB) $(BOGUS) $(XGDLIB) $(XGILIB) $(XXX) $(BOGUS) $(YYY)

all:: clean $(BIN)/xgdisplay 

clean:
	rm -f lex.c grammar.c y.tab.h

OBJS = \
	args.o \
	band.o \
	barattr.o \
	barbox.o \
	barscale.o \
	chlist.o \
	client.o \
	coloropt.o \
	crtecolor.o \
	drawgrid.o \
	exit.o \
	font.o \
	getcat.o \
	getdatafh.o \
	grammar.o \
	grid.o \
	gridbox.o \
	gridgadg.o \
	handler.o \
	highlight.o \
	layout.o \
	labelbox.o \
	legend.o \
	lex.o \
	linewgadg.o \
	menubar.o \
	menucb.o \
	main.o \
        mode.o \
        objbutton.o \
        object.o \
        popup.o \
	qrastpl.o \
	qrasttext.o \
	queryraster.o \
	redrwarea.o \
        ruler.o \
        scroll.o \
	selpixpl.o \
	sitegadg.o \
	siteicon.o \
	stdsite.o \
	stdsitepl.o \
        toolbox.o \
        units.o \
	upbarbox.o \
	upgridbox.o \
	uprastpl.o \
	xwd.o


$(BIN)/xgdisplay: $(OBJS) $(XGILIB) $(XGDLIB)
	$(CC) -o $@ $(LDFLAGS) $(XLDFLAGS) $(EXTRA_LDFLAGS) $(OBJS) $(LIBS)

$(XGILIB): #

$(XGDLIB): #

lex.c: y.tab.h

y.tab.h: grammar.c

grammar.c: grammar.y
	rm -f grammar.c
	yacc -d grammar.y
	mv y.tab.c grammar.c

saber_src:
	#load *.c ../../src/libes/Xgd/*.c -Bstatic $(CFLAGS) $(EXTRA_CFLAGS) $(VECT_INCLUDE) $(SABERLIBS) $(EXTRA_LDFLAGS)

checkin:
	@(if test -d RCS; then \
	echo "attempting checkin..."; \
	else \
	echo "oops...first time?...making RCS directory"; mkdir -p RCS; \
	fi; \
	for i in $(RCS) ;\
	do (echo Working on $$i; EXISTS="0"; \
	if test -f RCS/$$i,v; then  \
	EXISTS="1" ; \
	fi; \
	if test "$$EXISTS" = "1"; then \
	ci -l0.0.0 -f -m"auto checkin: `date`" -t./ci.txt $$i; \
	chmod 664 $$i; \
	else \
	ci -l0.0 -f -m"auto checkin: `date`" -t./ci.txt $$i; \
	chmod 664 $$i; \
	fi;);  \
	done);
