# Makefile. All source files used in overlay
# Last modified: by Wm Randolph Franklin (wrf) on speed.ecse.rpi.edu at Wed Apr  8 17:16:13 1992
#	%W%	%G%	

# gcc doesn't like the sunview include files.  Must use cc for those routines.
# To compile sunview plotting inside overlay, set a macro called USESUNVIEW.

# C,H: These files refer to overlay, not to select_polygon etc.  C also
# excludes, e.g. testhash.


C = overlay.c myerror.c extract_edges.c hash.c calc_areas.c grid.c \
    calc_edge_eqns.c intersect_edges.c print.c \
    read_pgraph.c locate_vertices_in_other_map.c \
    scale_vertices.c accumulate_areas.c timers.c malloc2.c start_graphics.c

H = overlay.h

# tgrindable files, not part of overlay.

C2 = testhash.c select_polygon.c

# All Files worth listing, except those worth tgrinding.

L = README Makefile db/sq db/di db/us2 db/jul

O = overlay.o myerror.o extract_edges.o hash.o calc_areas.o grid.o \
    calc_edge_eqns.o intersect_edges.o print.o \
    read_pgraph.o locate_vertices_in_other_map.o   \
    scale_vertices.o accumulate_areas.o timers.o malloc2.o start_graphics.o

CC = acc

CFLAGS= -g
CFLAGS=  -cg89 -fast -libmil

# Swap if using sunview.
#LDFLAGS= -lcore -lsuntool -lsunwindow -lpixrect -lm
LDFLAGS= -lm

LD_LIBRARY_PATH= /usr/lang/SC1.0:/usr/lib

overlay: updatemoddate $O
	$(CC) $(CFLAGS) -o overlay $O $(LDFLAGS)


lint: 
	lint $C

$O: $H

updatemoddate:
	echo  '#define LASTMODDATE "' `date` '"' > lastmoddate.h


start_graphics.o: start_graphics.c
	cc -c -g start_graphics.c -o start_graphics.o

testhash: testhash.o hash.o myerror.o
	cc -o testhash testhash.o hash.o myerror.o

hashlint:
	lint testhash.c hash.c

indent:
	-for f in $C $H ;\
	do \
	echo Indenting $$f ;\
	indent $$f ;\
	done

clean:
	rm2 $O *.BAK overlay

vgrind:
	-for f in $C $H ;\
	do \
	echo Vgrinding $$f ;\
	indent -troff $$f | ptroff -mindent ;\
	done
	


select_polygon: overlay.h select_polygon.c myerror.o
	$(CC) $(CFLAGS) select_polygon.c myerror.o $(LDFLAGS) -o select_polygon


tags:
	etags $C $H

tar:
	tar cf overlay.tar README Makefile $C $H select_polygon.c db/README db/us2

print:
	tgrind $H $C $(C2)
	enscript -2r $L
