###########################################################################
#
# Makefile system for GILDAS softwares (2003-2019).
#
# Please be careful: element order often matters in makefiles.
#
###########################################################################

include $(gagadmdir)/Makefile.def

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

DOC_IDS = imager imager-prog imager-bugs

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

include $(gagadmdir)/Makefile.doc

# Delete implicit rules for .hlp and .tex
%.hlp: %.nroff
	
%.tex: %.hlp

%.tex: $(helpdir)/%.hlp $(bindir)/hlp2tex


# Specific targets and rules: 
change_program.tex: ../lib/initclean.f90
	grep v_program ../lib/initclean.f90 | grep =*! > change_program.tex

change_display.tex: ../lib/initclean.f90
	grep v_display ../lib/initclean.f90 | grep =*! > change_display.tex

change_clean.tex: ../lib/initclean.f90
	grep v_clean ../lib/initclean.f90 | grep =*! > change_clean.tex

change_cal.tex: ../lib/initclean.f90
	grep v_cal ../lib/initclean.f90 | grep =*! > change_cal.tex

change_advanced.tex: ../lib/initclean.f90
	grep v_advanced ../lib/initclean.f90 | grep =*! > change_advanced.tex

change_bundles.tex: ../lib/initclean.f90
	grep v_bundles ../lib/initclean.f90 | grep =*! > change_bundles.tex

change_imager.tex: ../lib/initclean.f90
	grep v_imager ../lib/initclean.f90 | grep =*! > change_imager.tex

change_simu.tex: ../lib/initclean.f90
	grep v_simu  ../lib/initclean.f90 | grep =*! > change_simu.tex

#
# These do not work at all. ?
imager-help-display.hlp: imager-help-display.nroff

imager-help-clean.hlp: imager-help-clean-input.nroff		\
                       imager-help-clean-clean-list.nroff-so	\
                       imager-help-clean-clean-desc.nroff-so	\
                       imager-help-clean-uvmap-list.nroff-so	\
                       imager-help-clean-uvmap-desc.nroff-so
	nroff -Tascii imager-help-clean.nroff > imager-help-clean.hlp

imager-help-calib.hlp: imager-help-calib.nroff
	nroff -Tascii imager-help-clean.nroff > imager-help-clean.hlp

imager-help-news.hlp: imager-help-news.nroff imager-help-uvshort.nroff-so
	nroff -Tascii imager-help-news.nroff > imager-help-news.hlp

imager-help-bundles.hlp: imager-help-bundles.nroff imager-help-selfcal.nroff-so imager-help-kepler.nroff-so
	nroff -Tascii imager-help-bundles.nroff > imager-help-bundles.hlp

imager-help-imager.hlp: imager-help-imager.nroff
	nroff -Tascii imager-help-imager.nroff > imager-help-imager.hlp

imager-help-simu.hlp: imager-help-simu.nroff
	nroff -Tascii imager-help-simu.nroff > imager-help-simu.hlp


# Direct .tex files for PDF / HTML help

imager-help-display.tex: imager-help-display.nroff
	$(bindir)/nrtex  imager-help-display

imager-help-clean.tex: imager-help-clean.nroff \
	imager-help-clean-input.nroff-so imager-help-clean-clean-list.nroff-so	\
  imager-help-clean-clean-desc.nroff-so	imager-help-clean-uvmap-list.nroff-so \
  imager-help-clean-uvmap-desc.nroff-so
	$(bindir)/nrtex  imager-help-clean

imager-help-calib.tex: imager-help-calib.nroff
	$(bindir)/nrtex  imager-help-calib

imager-help-news.tex: imager-help-news.nroff \
	imager-help-uvshort.nroff-so 
	$(bindir)/nrtex  imager-help-news 

imager-help-bundles.tex: imager-help-bundles.nroff \
	imager-help-selfcal.nroff-so imager-help-kepler.nroff-so
	$(bindir)/nrtex  imager-help-bundles

imager-help-imager.tex: imager-help-imager.nroff
	$(bindir)/nrtex  imager-help-imager

imager-help-simu.tex: imager-help-simu.nroff
	$(bindir)/nrtex  imager-help-simu


###########################################################################
			
imager.pdf imager-html: imager.tex imager.bib preamble.tex \
	concepts.tex principles.tex uv-table.tex single-field.tex wide-field.tex \
	self-calibration.tex short-spacings.tex uv-plane.tex continuum.tex \
	view-show.tex all-in-one.tex	polarization.tex advanced.tex simulate.tex \
	bundles.tex app-casa.tex  imager-version.tex bugs.tex 

imager-html: imager.pdf

imager-bugs.pdf: imager-bugs.tex bugs.tex older-bugs.tex \
				changes.tex change_program.tex \
        change_display.tex change_clean.tex change_cal.tex change_advanced.tex \
        change_bundles.tex change_imager.tex change_simu.tex \
        imager-version.tex 

imager-bugs-html: imager-bugs.pdf

imager-prog.pdf imager-prog-html: imager-prog.tex imager-version.tex
###########################################################################
