# Generated automatically from Makefile.in by configure.
#
# Makefile (now .in) for the documentation directory
#
# Copyright 1994,2000   rubini@gnu.org (Alessandro Rubini)
#
#################
#
# BE CAREFUL in editing:
#	due to the large number of index files, and my use of a non standard
#	info input file, any file $(TARGET).* is removed by "make clean"
#
#	I chose to use a prefix for the input file ("doc.$(TARGET)"), to ease
#	makeing clean and applying my own rules.
#
###################################################################
#
# First of all, retrieve features of makeinfo, to know if we can do images
# and --html. Also, allow MAKEINFO to be specified on the commandline to
# allow me testing with various versions.

# NOTE: it looks like semi-old versions can do images too, so CANDOIMAGES
#	is not (yet?) used


MAKEINFO = makeinfo
# According to whether this makeinfo can output html, autoconf define these
REMOVEHTMLTAGS = cat
INFOTOHTML = makeinfo --html --no-split

##############################################


TARGET = barcode
ALL    = $(TARGET).ps $(TARGET).info $(TARGET)doc.txt $(TARGET).html \
		$(TARGET).pdf 

all: $(ALL) terse

info: $(TARGET).info

$(TARGET)doc.txt: mktxt

mpage: all
	mv $(TARGET).ps $(TARGET)1.ps
	mpage -2A $(TARGET)1.ps > $(TARGET)2.ps && rm $(TARGET)1.ps

terse:
	# preserve the pdf copy
	-mv -f $(TARGET).pdf PDF 2> /dev/null && \
		rm -f *~ *.dvi *.log *.aux \
		      $(TARGET).*.bak $(TARGET).??? $(TARGET).texinfo && \
		mv PDF $(TARGET).pdf;

	# preserve the ps copy
	-mv $(TARGET).ps PS;
	-rm -f $(TARGET).??;
	-mv PS $(TARGET).ps;

clean: terse
	rm -f $(ALL) $(TARGET)_toc.html


####################################################

# These rules used to be expressed as "%.texinfo: doc.%" etc. However, this
# is gmake-specific, so I turned every % to $(TARGET), thus loosing generality
# but gaining portability. I also had to drop "$^": it worked with gmake
# and not pmake, while "$<" worked with pmake and not gmake.
# with gmake and not pmake.
#    ARub 2000-04-21

$(TARGET).texinfo: doc.$(TARGET)
	@rm -f $@ 2> /dev/null
	sed -f ./infofilter doc.$(TARGET) | $(REMOVEHTMLTAGS) > $@
	chmod 400 $@


# This rule is somewhat a rewrite of texi2dvi. I like make more than sh :-)
# This had to be rewritten too, as "$*" is different in gmake and pmake

$(TARGET).dvi: $(TARGET).texinfo

# create a spurious  index file to please silly sh (bash will work anyway)
	touch $(TARGET).oo

# get the index list
	if test "x`ls $(TARGET).?? $(TARGET).aux`" != "x"; then \
	  for i in `ls $(TARGET).?? $(TARGET).aux`; do \
	    cp $$i $$i~; \
	  done; \
	fi
	tex $(TARGET).texinfo

#check the file list, the file and if needed run TeX again
	old="`ls $(TARGET).??~ $(TARGET).aux~ | sed 's/~//g'`"; \
	new="`ls $(TARGET).?? $(TARGET).aux`"; \
	need="n"; \
	if test "$$old" != "$$new"; then need="y"; \
	else \
	  for i in  `ls $(TARGET).?? $(TARGET).aux`; do \
	    cmp -s $$i $$i~; if test $$? -ne 0; then need="y" break; fi; \
	  done; \
	fi; \
	if test "$$need" = "y"; then \
	  texindex $(TARGET).?? && tex $(TARGET).texinfo; \
	fi


$(TARGET).ps: $(TARGET).dvi
	dvips -f $(TARGET).dvi > $@

$(TARGET).pdf: $(TARGET).ps
	ps2pdf $(TARGET).ps > $@

$(TARGET).lj: $(TARGET).dvi
	dvilj -e- $(TARGET).dvi > $@

$(TARGET).info: $(TARGET).texinfo
	makeinfo $(TARGET).texinfo -o $@

$(TARGET).html: $(TARGET).texinfo
	$(INFOTOHTML) -o $@ $<

#$(TARGET).man: doc.$(TARGET)
#		manpages are created by the toplevel Makefile

$(TARGET)doc.txt: $(TARGET).info
	awk -f ./mktxt $(TARGET).info > $@







