########################################################################
#                 copyright 2001, Amoco Production Company             #
#                             All Rights Reserved                      #
#                     an affiliate of BP America Inc.                  #
########################################################################

#
#	gmake makefile for various make utilities
#
#	some (or all) of these buggers have been stolen from 'cake'.
#
include ${DEPTROOT}/etc/gmake.init

sunCCFlags	:=	-O

# CSrcs		:=	ccincl.c ccincl_s.c
CSrcs		:=	ccincl.c
LexSrcs		:=	ccincl_s.l

PRGM		:=	${LocalBin}/ccincl

SafeFiles	:=	Makefile ${CSrcs} ${wildcard *.l} ${wildcard *.h}

${PRGM}: ${CObjs} ${LexObjs}
	${LinkC} -o $@ ${CObjs} ${LexObjs}

include ${TArchDir}/included.files

${TArchDir}/included.files: ${AllSrcs}
	-${FindIncludes}

.PHONY:	all safe targets remotes

targets:	${PRGM}

all:	safe targets remotes

safe:	.safe.${jdate}.Z

.safe.${jdate}.Z:	${SafeFiles}
	${MakeSafe}

remotes:	RemoteCopies RemoteMakes

install:	RemoteCopies RemoteMakes
		shadowexec -v ${MAKE} && touch RemoteMakes

RemoteCopies:	${SafeFiles}
		shadowcopy -v $? && touch RemoteCopies

RemoteMakes:	${SafeFiles}
		shadowexec -v ${MAKE} && touch RemoteMakes

clean:
	-rm ${TArchDir}/included.files ${AllObjs} \
	RemoteCopies RemoteMakes ${wildcard ShdCpy*}

#	the ${PRGM} was removed from the clean target because most folks
#	would like to keep it around for building test codes, compiling
#	partial updates, etc.

#
#	storage area:  everything beyond here is commented out.
#
ifdef ULTIMATEPOWER

base:		base.o pattern_s.o
		cc -o base base.o pattern_s.o

later:		later.c
		cc -o later later.c

need:		need.c
		cc -o need need.c

needed:		needed.c
		cc -o needed needed.c

refs:		refs.o pattern_s.o
		cc -o refs refs.o pattern_s.o

sub:		sub.c
		cc -o sub sub.c

subcmd:		subcmd.c
		cc -o subcmd subcmd.c

usrc:		usrc.c
		cc -o usrc usrc.c

gsrc:		gsrc.c
		cc -o gsrc gsrc.c

pattern_s.c:	pattern_s.l
		lex pattern_s.l
		@mv lex.yy.c pattern_s.c

clean:		
		-rm Make_errs *.o *_s.c

gclean:		
		-rm *_s.c
endif
#
#	End of commented-out region.
#
