######################################

# Set BINDIR to the directory that should contain uvapc.

BINDIR=/usr/uva/bin

# Set LIBDIR to the directory that should contain the pascal
# library and pcomp.  Be sure to also edit the #defined macro LIBDIR
# in uvapc/uvapc.c if you change this.

LIBDIR=/usr/uva/lib

# Set OWNER to the user that should own the uvapc files.

OWNER=bin

# Set GROUP to the group that should own the uvapc files.

GROUP=bin

# Set STRIP to "strip" if you want to save lots of disk space at the
# expense of not being able to run the debugger sdb on pcomp and uvapc.
# To not strip, set STRIP to "echo".

STRIP=strip

####### Do not make changes below this line #######

install:
	cd 3b; make; $(STRIP) pcomp
	cd rt; make 
	cd uvapc; make; $(STRIP) uvapc
	set -e;\
	test -d $(BINDIR) || { \
		mkdir $(BINDIR);\
		chmod 744 $(BINDIR);\
		chgrp $(GROUP) $(BINDIR);\
		chown $(OWNER) $(BINDIR);\
	};\
	test -d $(LIBDIR) || { \
		mkdir $(LIBDIR);\
		chmod 744 $(LIBDIR);\
		chgrp $(GROUP) $(LIBDIR);\
		chown $(OWNER) $(LIBDIR);\
	};\
	test -d $(LIBDIR)/libp || { \
		mkdir $(LIBDIR)/libp;\
		chmod 744 $(LIBDIR)/libp;\
		chgrp $(GROUP) $(LIBDIR)/libp;\
		chown $(OWNER) $(LIBDIR)/libp;\
	};\
	cp 3b/pcomp rt/libuvapc.a $(LIBDIR);\
	cp rt/libp/libuvapc.a $(LIBDIR)/libp;\
	cp uvapc/uvapc $(BINDIR);\
	cd $(LIBDIR);\
	chmod 711 pcomp;\
	chmod 644 libuvapc.a libp/libuvapc.a;\
	chgrp $(GROUP) pcomp libuvapc.a libp/libuvapc.a;\
	chown $(OWNER) pcomp libuvapc.a libp/libuvapc.a;\
	cd $(BINDIR);\
	chmod 711 uvapc;\
	chgrp $(GROUP) uvapc;\
	chown $(OWNER) uvapc;\
	exit 0
clean:
	/bin/rm -f 3b/pcomp 3b/*.o rt/*.[ao] rt/libp/*.[ao] uvapc/uvapc uvapc/*.o
