#
# sample Makefile
#
LD = ${ld}
LD_SHARED = ${ld_shared}
PERL = ${perl}
RM_F = ${rm_f}
SO = ${so}
OPS2C = -I..${slash}lib ..${slash}build_tools${slash}ops2c.pl


# add your dynamic oplibs here

all: myops_ops$(SO) myops_ops_cg$(SO) myops_ops_cgp$(SO) \
    myops_ops_prederef$(SO) myops_ops_switch$(SO)

.SUFFIXES: .ops .c $(SO)

# preserve .c if needed
.PRECIOUS: %_ops.c %_ops_cgp.c %_ops_cg.c %_ops_prederef.c %_ops_switch.c

%_ops.c  : %.ops
	$(PERL) $(OPS2C) C --dynamic $<

%_ops_cgp.c  : %.ops
	$(PERL) $(OPS2C) CGP --dynamic $<

%_ops_cg.c  : %.ops
	$(PERL) $(OPS2C) CGoto --dynamic $<

%_ops_prederef.c  : %.ops
	$(PERL) $(OPS2C) CPrederef --dynamic $<

%_ops_switch.c  : %.ops
	$(PERL) $(OPS2C) CSwitch --dynamic $<

%$(SO) : %.c
	$(LD) $(LD_SHARED) $(LD_SHARED_FLAGS) $(LDFLAGS) -o $@ \
		-I..${slash}include \
		-L..${slash}blib${slash}lib -lparrot $<
	$(PERL) -MFile::Copy=cp -e ${PQ}cp q|$@|, q|../runtime/parrot/dynext/$@|${PQ}

clean :
	$(RM_F) *.c *.h *$(SO)

realclean: clean
	$(RM_F) Makefile

distclean: realclean

cvsclean: realclean
