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

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

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

YYY = segment/libsegment.a -ll $(XEXTRALIBS) -lm

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

BIN = $(BIN_CONTRIB_INTER)

#all:: $(BIN)/xgrasteredit
all::  $(BIN)/xgrasteredit help context

help:: 
	rm -rf $(GISBASE)/etc/xhelp/xgre
	mkdir $(GISBASE)/etc/xhelp/xgre
	cp help/* $(GISBASE)/etc/xhelp/xgre

context::
	rm -rf $(GISBASE)/etc/xhelp/xgrass/xgre
	mkdir $(GISBASE)/etc/xhelp/xgrass/xgre
	cp context/* $(GISBASE)/etc/xhelp/xgrass/xgre

OBJS = \
        foo.o \
        applybrush.o \
        allocolor.o \
        brushcat.o \
        brushcreate.o \
        brushcolor.o \
        brushdefault.o \
        brushedit.o \
        brushload.o \
        brushsave.o \
        buttonbar.o \
        cursor.o \
        elist.o \
        editcats.o \
        editcb.o \
        editrange.o \
        editundo.o \
        fileclose.o \
        fileopen.o \
        fileresume.o \
        filesave.o \
        handler.o \
        ilist.o \
        killdialogs.o \
        layout.o \
        llist.o \
        loadimage.o \
        main.o \
        menubar.o \
        msgarea.o \
        polyapply.o \
        rw_range.o \
        r_color.o \
        ras2seg.o \
        seg2ras.o \
        segfile.o \
        setmode.o \
        viewzoom.o \
        viewindex.o \
        updatemsg.o \
        xgrehelp.o \
        zoomhandler.o

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

$(XGILIB): #

$(XGDLIB): #

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);
