# This file builds the examples in two subdirectories

PERL=/afs/sipb/project/perldev/p

LD_SO=`$(PERL) -MConfig -e 'print "$$Config{ld} $$Config{lddlflags}\n";'`

.PHONY: default clean all test

default: all test

%/Makefile: %/Makefile.PL
	cd $*; $(PERL) Makefile.PL

clean all test: Foo/Makefile Bar/Makefile
	cd Foo; $(MAKE) $(MFLAGS) $@
	cd Bar; $(MAKE) $(MFLAGS) $@

libhack.so: hack.o
	$(LD_SO) $^ -o $@
libhack.a: hack.o
	$(AR) cru $@ $^
htest1: htest.o libhack.so
	$(CC) $<           -L. -lhack -o $@
htest2: htest.o libhack.a
	$(CC) $< -B static -L. -lhack -o $@
hclean:
	$(RM) *.o *.so *.a htest1 htest2 *~
