LIBES = $(D_LIB) $(DISPLAYLIB) $(RASTERLIB) $(EDITLIB) $(VASKLIB) $(GISLIB)
DEPLIBS= $(DEPD_LIB) $(DEPDISPLAYLIB) $(DEPRASTERLIB) $(DEPVASKLIB) $(DEPEDITLIB) $(DEPGISLIB)
OFILES  =\
	add_mult.o\
	ask_weight.o\
	assign.o\
	colors.o\
	choose_map.o\
	execute.o\
	dots.o\
	falloc.o\
	gets.o\
	getc.o\
	histo.o\
	list_anal.o\
	list_cats.o\
	list_maps.o\
	sav_rec.o\
	weighted.o\
	y.tab.o\
	lex.yy.o\
	set_sigs.o\
	write_supp.o


all: pgm shell help
shell: $(BIN_INTER)/r.weight
pgm: $(ETC)/r.weight

$(ETC)/r.weight: $(OFILES) $(DEPLIBS)
	$(CC) $(LDFLAGS) -o $@ $(OFILES) $(LIBES) $(CURSES) $(MATHLIB) $(XDRLIB) $(LEXLIB)

$(BIN_INTER)/r.weight: weight.sh
	rm -f $@ ; cp $? $@ ; chmod 0755 $@

help:
	rm -rf $(TXT)/WEIGHT
	mkdir $(TXT)/WEIGHT
#	cp HELP_TEXT/* $(TXT)/WEIGHT
	(cd HELP_TEXT/ ; tar -cvf - * | (cd $(TXT)/WEIGHT ; tar -xvf - 2>/dev/null ) ; true )

clean:
	-rm -f y.tab.c y.tab.h lex.yy.c y.tab.o lex.yy.o

#
#
# PARSER
y.tab.c:     yes_no.h gis_pars.y
	$(YACC) -d gis_pars.y

lex.yy.c:     gis_lxcl.l y.tab.h
	$(LEX) -t gis_lxcl.l > $@

y.tab.h: y.tab.c

add_mult.o: include.h
assign.o: include.h
choose_map.o: include.h
choose_map.o: yes_no.h
execute.o: include.h
y.tab.o: include.h
list_anal.o: include.h
list_cats.o: include.h
sav_rec.o: include.h
weighted.o: include.h
weighted.o:    yes_no.h 

$(DEPLIBS): #
$(DEPVASKLIB): #

print:
	pr *.h *.l *.y *.c | lpr
