SWIG = swig

export DESTDIR=

STAMPS = perl5-stamp
all: ${STAMPS}

install:
	make -C perl5 install

#

perl5/parted_wrap.c: parted.i Makefile
	cd perl5 && ${SWIG} -perl5 -shadow -o $(notdir $@) ../$<
 # awfull hack
#	perl -pi -e 's/PedDevice_ped_/ped_/g' $@

perl5-stamp: perl5/parted_wrap.c perl5/Makefile
	${MAKE} -C perl5 LD_RUN_PATH=""
	touch $@

perl5/Makefile: perl5/Makefile.PL
	cd perl5 && perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="${CFLAGS}"

#

python/parted_wrap.c: parted.i
  # use -shadow ?
	cd python && ${SWIG} -python -o $(notdir $@) ../$<

#

ruby/parted_wrap.c: parted.i
	cd ruby && ${SWIG} -ruby -o $(notdir $@) ../$<

#

clean:
	rm -f ${STAMPS}
	-${MAKE} -C perl5 clean

distclean:
	rm -f ${STAMPS}
	-${MAKE} -C perl5 distclean

maintclean: distclean
	rm -f */parted_wrap.c
	rm -f perl5/parted.pm
	rm -f python/parted.py
