##########################################################################
#	         The root makefile for wp2latex package			 #	
#									 #	
# Available targets are: make 		make selected modules		 #	
#                        make all	Make all + all selected modules	 #
#			 make clean	Remove all temporary files 	 #
#			 make distclean Thourough cleanup          	 #
#			 make install	Perform automatic installation   #
#                        make package   Statical build for package       #
#                        make wp2latex	Make only WordPerfect modules    #
#                        make x2latex	Make all conversion modules 	 #
##########################################################################

@SET_MAKE@
ifeq ($(MAKE),)
MAKE=make
endif

all :
	export OSTYPE && $(MAKE) -C ./sources.cc/ @SET_OSTYPE@
	$(MAKE) -C ./doc/ all

default:
	export OSTYPE && $(MAKE) -C ./sources.cc/ @SET_OSTYPE@

wp2latex:
	export OSTYPE && $(MAKE) -C ./sources.cc/ TG_WP @SET_OSTYPE@

x2latex:
	export OSTYPE && $(MAKE) -C ./sources.cc/ TG_ALL @SET_OSTYPE@

package:
	export OSTYPE && $(MAKE) -C ./sources.cc/ static @SET_OSTYPE@

static:
	export OSTYPE && $(MAKE) -C ./sources.cc/ static @SET_OSTYPE@
	$(MAKE) -C ./doc/ all

distclean: 
	$(MAKE) -C ./sources.cc/ distclean
	$(MAKE) -C ./instaler/ clean
#	$(MAKE) -C ./sources.pas/ clean
	$(MAKE) -C ./doc/ distclean
	$(MAKE) -C ./test/ clean
	rm -f *.exe *.OBJ *.obj *.o *.bak core *.gpr *.gdt *.dvi *.aux *.log *.ent *.toc
	rm -f config.status config.h out.txt
	$(MAKE) -k -C ./msvc/ clean
	rm makefile
	cp makefile.gen makefile

generic:
	make -C ./sources.cc/ generic
	make -C ./instaler/ generic
	rm makefile
	cp makefile.gen makefile

clean:
	$(MAKE) -C ./sources.cc/ clean
	$(MAKE) -C ./instaler/ clean
#	$(MAKE) -C ./sources.pas/ clean
	$(MAKE) -C ./doc/ clean
	$(MAKE) -C ./test/ clean
	rm -f *.exe *.OBJ *.obj *.o *.bak core *.gpr *.gdt *.dvi *.aux *.log *.ent *.toc *.idx
	$(MAKE) -C ./msvc/ clean
	rm -f config.status config.h
	rm -f autom4te.cache/*

install:
	instaler/install

doc:
	$(MAKE) -C ./doc/ all

test:	default
	$(MAKE) -C ./test @TEST_LTX@

bigtest:	default
	$(MAKE) -C ./test bigtest

testltx: default
	$(MAKE) -C ./test testltx

menuconfig:	instaler/menucfg.exe
	instaler/menucfg.exe sources.cc/modules.mak


#internal stuff
instaler/menucfg.exe:	instaler/menucfg.cc
	export OSTYPE && make -C ./instaler/ menucfg.exe


configure: configure.in
	autoconf
