# @(#)makefile	19.1 (ESO-IPG) 02/25/03 14:24:05
# .COPYRIGHT:	Copyright (c) 1988 European Southern Observatory,
#						all rights reserved
# .TYPE		make file
# .NAME		$MIDASHOME/$MIDVERS/*/help/makefile
# .LANGUAGE	makefile syntax
# .ENVIRONMENT	Unix Systems. 
# .COMMENT	Creates all *.hlc files from *.hlq.
# .REMARKS 
# .AUTHOR	Carlos Guirao
# .VERSION 1.1  910715:         Implementation
# .VERSION 2.1  911015:         Creating dependencies.
# .VERSION 3.1  920331:         OBJ are defined on the internal make.
# .VERSION 4.1  920708:         IFS is defined as NEWLINE.
# .VERSION 4.2  922308:         IFS is defined as blank. 
# .VERSION 3.0  930308:		Using default.mk file
# .VERSION 3.1  940606:		Working silently.

include ../../../local/default.mk

CONTEXT= 

OBJ =
OUT =

all:
	@(IFS=' '; for OUT in `ls *.hlq | sed -e 's/_.*//'  -e 's/\.hlq//' | \
	awk '{print substr(\$$1,1,6)}' | sort -u |awk '{printf "%s ",\$$1}'`;\
	do (eval $(MAKE) -s OBJ=\"`ls $$OUT*.hlq |awk '{printf "%s ",\$$1}'`\" \
	OUT=\"$$OUT\" one)\
	done)

one: $(OUT).hlc

$(OUT).hlc: $(OBJ)
	@ rm -f $@
	@(IFS=' '; for file in $(OBJ); \
	do sed -n '/SECTION./,/\\us/p' $$file | sed '/^\\/d' | sed '2d' >> $@;\
	done )
	@echo $@

make_alll:
	@(if [ -f alll.hlz ]; then mv alll.hlz alll.hlz~; fi)
	$(CREA_ALLL) > alll.hlz

make_hlq:
	$(CREA_HLQ) $(CONTEXT)
	
clean:
	rm -f *.hlc
