# ------------------------------------------------------------------------
# Makefile for synchronization examples
# ------------------------------------------------------------------------
#
# Modifications: (most recent first)
#
# 02/19/02 RD	added '[[typed_]double_]handshake' examples
# 02/15/02 RD	added 'queue' and 'typed_queue' examples
# 02/13/02 RD	initial version


# --- macros -------------------------------------------------------------

ALL	=	barrier			\
		critical_section	\
		mutex			\
		semaphore		\
		token			\
		queue			\
		typed_queue		\
		handshake		\
		double_handshake	\
		typed_double_handshake

SCC	= scrc
SCCOPT	= -vv -w -g
RM	= rm -f


# --- SpecC rules --------------------------------------------------------

.SUFFIXES:
.SUFFIXES:	.sc .cc .o

.sc.cc:
	$(SCC) $* -sc2cch $(SCCOPT)

.cc.o:
	$(SCC) $* -cc2o $(SCCOPT)

.o:
	$(SCC) $* -o2out $(SCCOPT)

.cc:
	$(SCC) $* -cc2out $(SCCOPT)

.sc:
	$(SCC) $* -sc2out $(SCCOPT)


# --- targets ------------------------------------------------------------

all:	$(ALL)
	$(SCC) c_bit64_queue -sc2sc $(SCCOPT) -sl -o c_bit64_queue_dbg.sc
	$(SCC) c_packet_double_handshake -sc2sc $(SCCOPT) -sl \
		-o c_packet_double_handshake_dbg.sc

clean:
	-$(RM) *.bak *.BAK
	-$(RM) *.si *.cc *.h *.o
	-$(RM) $(ALL) *.exe
	-$(RM) *_dbg.sc

test:	$(ALL)
	set -e;					\
	for file in $(ALL); do ./$$file ; done


# --- EOF ----------------------------------------------------------------
