Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > media > main > by-pkgid > 6c1629ca18f6adf273e73d0f5069fa8c > files > 301

Borges-doc-0.7.12-1mdk.noarch.rpm


#---------------------------------------------------------------
# Project         : Mandrake Linux
# Module          : Borges
# File            : Makefile.images
# Author          : Camille Bégnis
# Created On      : Mon May  1 16:25:21 2001
# Copyright       : Camille Bégnis camille@mandrakesoft.com,
#                    MandrakeSoft under the GPL license
#---------------------------------------------------------------
# This Makefile is responsible for converting all acceptable 
# input graphics into pdf for print output.

include /home/stew/rpm-rebuilder/RPM/BUILD/Borges-0.7.12/doc/Makefile.include

# Missing default image
MISSING=$(ROOTDIR)/images/missing.jpg

# The eps file format is used as an intermediate format for most 
# transformations to avoid having n² rules in here.

# copy identic files if not get EPS and convert
%.png: force
	@newer=$(shell ls -t $(wildcard $(ROOTDIR)/images/$(LANG)/$*.* $(ROOTDIR)/images/$*.*) | head -1 ); \
	if [ "$(wildcard $(ROOTDIR)/images/$(LANG)/$*.png $(ROOTDIR)/images/$*.png)" != "" ] ; then \
		if [ -e $(ROOTDIR)/images/$(LANG)/$*.png ] && [ $@ -ot $(ROOTDIR)/images/$(LANG)/$*.png ]; then \
			echo "********* Copying $(ROOTDIR)/images/$(LANG)/$*.png to $@"; \
			cp -f $(ROOTDIR)/images/$(LANG)/$*.png $@; \
		elif [ $@ -ot $(ROOTDIR)/images/$*.png ]; then \
			echo "********* Copying $(ROOTDIR)/images/$*.png to $@"; \
			cp -f $(ROOTDIR)/images/$*.png $@; \
		fi; \
	elif [ $$newer -nt $@ ] ; then \
		make $*.tmp.eps; convert $*.tmp.eps $@; rm -f $*.tmp.eps; \
	fi

%.pdf: force
	@newer=$(shell ls -t $(wildcard $(ROOTDIR)/images/$(LANG)/$*.* $(ROOTDIR)/images/$*.*) | head -1 ); \
	if [ "$(wildcard $(ROOTDIR)/images/$(LANG)/$*.pdf $(ROOTDIR)/images/$*.pdf)" != "" ] ; then \
		if [ -e $(ROOTDIR)/images/$(LANG)/$*.pdf ] && [ $@ -ot $(ROOTDIR)/images/$(LANG)/$*.pdf ]; then \
			echo "********* Copying $@"; \
			cp -f $(ROOTDIR)/images/$(LANG)/$*.pdf $@; \
		elif [ $@ -ot $(ROOTDIR)/images/$*.pdf ]; then \
			echo "********* Copying $@"; \
			cp -f $(ROOTDIR)/images/$*.pdf $@; \
		fi; \
	elif [ $$newer -nt $@ ] ; then \
		echo "********* Making $@"; \
		make $*.tmp.eps; epstopdf -o=$@ $*.tmp.eps; rm -f $*.tmp.eps; \
	fi

%.eps: %.tmp.eps
	@echo "********* Making $@"
	mv $< $@


# temporary eps files

%.tmp.eps: $(ROOTDIR)/images/$(LANG)/%.jpg
	convert $< $@
%.tmp.eps: $(ROOTDIR)/images/%.jpg
	convert $< $@

%.tmp.eps: $(ROOTDIR)/images/$(LANG)/%.dia
# dia must use the --nosplash option when no X available
# But then fails for some images...
# This is why I must use a virtual X server...
# The sleep time is needed on some machines, don't know why.
	+trap "killall Xvfb; rm -f /tmp/.X5-lock" 0; \
	Xvfb :5 -screen 0 100x100x8& sleep 5; \
	xauth add :5 . `mcookie` ;\
	DISPLAY=:5 dia -e $@ $<
	-killall Xvfb
	rm -f /tmp/.X5-lock
%.tmp.eps: $(ROOTDIR)/images/%.dia
	+trap "killall Xvfb; rm -f /tmp/.X5-lock" 0; \
	Xvfb :5 -screen 0 100x100x8& sleep 5; \
	xauth add :5 . `mcookie` ;\
	DISPLAY=:5 dia -e $@ $<
	-killall Xvfb
	rm -f /tmp/.X5-lock

%.tmp.eps: $(ROOTDIR)/images/$(LANG)/%.fig
	fig2dev -L eps $< $@
%.tmp.eps: $(ROOTDIR)/images/%.fig
	fig2dev -L eps $< $@

%.tmp.eps: $(MISSING)
	@if [ -e $(ROOTDIR)/images/$(LANG)/$*.png ]; \
		then convert $(ROOTDIR)/images/$(LANG)/$*.png $@; \
	elif [ -e $(ROOTDIR)/images/$*.png ]; then \
		 convert $(ROOTDIR)/images/$*.png $@;  \
	elif [ -e $(ROOTDIR)/images/$(LANG)/$*.eps ]; then \
		cp -f $(ROOTDIR)/images/$(LANG)/$*.eps $@; \
	elif [ -e $(ROOTDIR)/images/$*.eps ]; then \
		cp -f $(ROOTDIR)/images/$*.eps $@;  \
	else echo "******* $* missing! ********"; \
		convert $(MISSING) $@; \
		echo $* >> missing.img; \
	fi