#!/bin/sh
# --- Copyright University of Sussex 1994. All rights reserved. ----------
# File:             C.unix/pop/pgcomp
# Purpose:          Compile POPLOG source files (.p or .s)
# Author:           John Gibson, Jun 24 1988 (see revisions)
# Documentation:	SYSDOC * POPC

CHANGEDSOURCES=

while [ $# -ne 0 ]; do
	case "$1" in
		-cs)	CHANGEDSOURCES=true;;
		*) 		break;;
	esac
	shift
done

if [ -n "$CHANGEDSOURCES" ]; then
	popc -l `pglibr -lcs ./`
	if [ $? -eq 0 ]; then
		ls *.w > W_FILES
	fi
else
	popc $*
fi


# --- Revision History ---------------------------------------------------
# --- John Gibson, Dec 16 1994  Added -l arg to popc for -cs case
# --- John Gibson, Jul 10 1993
#		Moved to $popsys
#		popc now assumed defined as a command; removed now unnecessary options
# --- John Gibson, Jul  8 1993  Changed src.wlb to ./ in pglibr args
# --- John Gibson, Dec  8 1992
#		Removed -c -nosys args -- now supplied by popc.args
# --- Robert John Duncan, May  5 1992
#		Added explicit directory to pglibr command
# --- John Gibson, Apr  4 1992
#		Added -cs option to compile sources changed after src.wlb modules
# --- Robert John Duncan, Jan 10 1992
#		Changed always to use safepop11
# --- Aaron Sloman, Jan 14 1990 added Documentation cross reference
# --- John Gibson, Jul 17 1989
#		New popc requires arguments -c and -nosys
# --- John Gibson, May 26 1989
#		Changed tests on $? to use -ne instead of != etc
