cmp=/usr/bin/cmp
cp=/bin/cp
mv=/bin/mv
strip=/usr/bin/strip
ln=/bin/ln
PREFIX=/usr

all:	make_impress 
#all:	make_impress make_font3d make_pstoedit

make_font3d:
	(cd font3d;make)
	@-${strip} font3d/font3d 
	@-${cmp} font3d/font3d bin/font3d 2>/dev/null || \
		${cp} font3d/font3d bin/font3d

make_pstoedit:
	(cd pstoedit/config;./configure)
	(cd pstoedit/src;make LINK="c++ -static")
	@-${strip} pstoedit/src/pstoedit
	@-${cmp} pstoedit/src/pstoedit bin/pstoedit 2>/dev/null || \
		${cp} pstoedit/src/pstoedit bin/pstoedit
	
make_impress: 
	(cd src;make all install)

$(PREFIX)/bin/pstoedit.orig:
	@-mv $(PREFIX)/bin/pstoedit $(PREFIX)/bin/pstoedit.orig

#install: $(PREFIX)/bin/pstoedit.orig
install: 
	install -c bin/impress $(PREFIX)/bin && rm -f $(PREFIX)/bin/impress.tcl && ${ln} -s $(PREFIX)/bin/impress $(PREFIX)/bin/impress.tcl
	install -c bin/transeps $(PREFIX)/bin
	#install -c bin/font3d $(PREFIX)/bin
	#install -c bin/pstoedit $(PREFIX)/bin

clean:
	#(cd font3d;make clean)
	#(cd pstoedit/src;make clean)
	(cd src;make clean)
	rm -rf doc bin
	rm -f COPYING CHANGES README 
