prefix = @prefix@
INSTALL_BINDIR	= $(prefix)/bin
INSTALL_LIBDIR	= $(prefix)/lib
INSTALL_MANDIR 	= $(prefix)/man

CC		= @CC@
INSTALL		= @INSTALL@
INSTALL_BIN 	= @INSTALL_PROGRAM@
INSTALL_FILE 	= @INSTALL_DATA@
RANLIB		= @RANLIB@

all clean:
	@for dir in libs pstext; do \
		echo Making $@ in $$dir; \
		(cd $$dir; $(MAKE) $(MFLAGS) \
			CC="$(CC)" \
			INSTALL="$(INSTALL)" \
			INSTALL_BIN="$(INSTALL_BIN)" \
			INSTALL_FILE="$(INSTALL_FILE)" \
			RANLIB="$(RANLIB)" \
			INSTALL_BINDIR="$(INSTALL_BINDIR)" \
			INSTALL_LIBDIR="$(INSTALL_LIBDIR)" \
			INSTALL_MANDIR="$(INSTALL_MANDIR)" \
		$@); \
	done

install:	all
	@for dir in pstext; do \
		echo Making $@ in $$dir; \
		(cd $$dir; $(MAKE) $(MFLAGS) \
			CC="$(CC)" \
			INSTALL="$(INSTALL)" \
			INSTALL_BIN="$(INSTALL_BIN)" \
			INSTALL_FILE="$(INSTALL_FILE)" \
			RANLIB="$(RANLIB)" \
			INSTALL_BINDIR="$(INSTALL_BINDIR)" \
			INSTALL_LIBDIR="$(INSTALL_LIBDIR)" \
			INSTALL_MANDIR="$(INSTALL_MANDIR)" \
		$@); \
	done

realclean:	clean
	-rm -f Makefile
	@for dir in libs pstext; do \
		echo Making $@ in $$dir; \
		(cd $$dir; $(MAKE) $(MFLAGS) \
			CC="$(CC)" \
			INSTALL="$(INSTALL)" \
			INSTALL_BIN="$(INSTALL_BIN)" \
			INSTALL_FILE="$(INSTALL_FILE)" \
			RANLIB="$(RANLIB)" \
			INSTALL_BINDIR="$(INSTALL_BINDIR)" \
			INSTALL_LIBDIR="$(INSTALL_LIBDIR)" \
			INSTALL_MANDIR="$(INSTALL_MANDIR)" \
		$@); \
	done
