# makefile for Vis5D version 4.2

# Vis5D system for visualizing five dimensional gridded data sets
# Copyright (C) 1990 - 1996 Bill Hibbard, Brian Paul, Dave Santek,
# and Andre Battaiola.
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 1, or (at your option)
# any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.


# Notes on IRIX compiler flags
#    IRIX 5.x only supports 32-bit architecture, -mips2 option not used by
#        Vis5D but could squeeze out a little extra performance.
#    IRIX 6.x supports 32 and 64-bit architectures, works only on R4000 or
#        later.  32-bit addressing is enough for Vis5D (-n32 mode).
#        Use -mips3 on all R4x00 variants.  Use -mips4 on R8000, R5000
#        and R10000.


default:
	@echo "Type one of the following:"
	@echo "	make irix4		for SGIs with IRIX 4.x"
	@echo "	make irix5		for SGIs with IRIX 5.x (using IRIS GL)"
	@echo "	make irix5-opengl	for SGIs with IRIX 5.x using OpenGL"
	@echo "	make irix6		for SGIs with IRIX 6.x and R4x00 CPU"
	@echo "	make irix6-mips4	for SGIs with IRIX 6.x and R5K, R8K or R10K CPU"
#	@echo "	make alpha-denali	for Alpha with Denali graphics"
	@echo "	make alpha-x		for Alpha with X"
	@echo "	make hp-pex		for HP with PEX"
	@echo "	make hp-x		for HP with X"
	@echo "	make ibm-opengl		for IBM RS/6000 with OpenGL"
	@echo "	make ibm-x		for IBM RS/6000 with X"
	@echo "	make linux-x		for Linux 1.2.x with X"
#	@echo "	make sunos4-x		for SunOS 4.x with X"
	@echo "	make sunos5-x		for SunOS 5.x with X"
	@echo "	make sunos5-opengl	for SunOS 5.x with OpenGL"
	@echo "	make clean		to remove unneeded files when finished"


# For debugging on SGI:
debug:
	cd lui5 ; $(MAKE) debug
	cd src ; ./mcsetup
	cd src ; $(MAKE) debug
	cd util ; $(MAKE) debug
	cd userfuncs ; ./externf_all

irix4:
	cd lui5 ; $(MAKE) irix4
	cd src ; ./mcsetup
	cd src ; $(MAKE) irix4
	cd util ; $(MAKE) irix4
	cd userfuncs ; ./externf_all
	cd import ; $(MAKE) irix4

irix5:
	cd lui5 ; $(MAKE) irix5
	cd src ; ./mcsetup
	cd src ; $(MAKE) irix5
	cd util ; $(MAKE) irix5
	cd userfuncs ; ./externf_all
	cd import ; $(MAKE) irix5

irix6:
	cd lui5 ; $(MAKE) irix6
	cd src ; ./mcsetup
	cd src ; $(MAKE) irix6
	cd util ; $(MAKE) irix6
	cd import ; $(MAKE) irix6
	cd userfuncs ; ./externf_all

irix6-mips4:
	cd lui5 ; $(MAKE) irix6
	cd src ; ./mcsetup
	cd src ; $(MAKE) irix6-mips4
	cd util ; $(MAKE) irix6
	cd import ; $(MAKE) irix6-mips4
	cd userfuncs ; ./externf_all

irix5-opengl:
	cd lui5 ; $(MAKE) irix5
	cd src ; ./mcsetup
	cd src ; $(MAKE) irix5-opengl
	cd util ; $(MAKE) irix5
	cd userfuncs ; ./externf_all
	cd import ; $(MAKE) irix5

irix5-x:
	cd lui5 ; $(MAKE) irix5
	cd Mesa ; $(MAKE) irix5
	cd src ; ./mcsetup
	cd src ; $(MAKE) irix5-mesa
	cd import ; $(MAKE) irix5

alpha-denali:
	cd lui5 ; $(MAKE) alpha
	cd src ; $(MAKE) alpha-denali
	cd util ; $(MAKE) alpha
	cd userfuncs ; ./externf_all
	cd import ; $(MAKE) alpha

alpha-x:
	cd lui5 ; $(MAKE) alpha
	cd Mesa ; $(MAKE) osf1
	cd src ; $(MAKE) alpha-mesa
	cd util ; $(MAKE) alpha
	cd userfuncs ; ./externf_all
	cd import ; $(MAKE) alpha

ibm-opengl:
	cd lui5 ; $(MAKE) ibm
	cd src ; $(MAKE) ibm-opengl
	cd util ; $(MAKE) ibm
	cd userfuncs ; ./externf_all
	cd import ; $(MAKE) ibm

ibm-x:
	cd lui5 ; $(MAKE) ibm
	cd Mesa ; $(MAKE) aix
	cd src ; $(MAKE) ibm-mesa
	cd util ; $(MAKE) ibm
	cd userfuncs ; ./externf_all
	cd import ; $(MAKE) ibm

hp-pex:
	cd lui5 ; $(MAKE) hp
	cd src ; $(MAKE) hp-pex
	cd util ; $(MAKE) hp
	cd userfuncs ; ./externf_all
	cd import ; $(MAKE) hp

hp-x:
	cd lui5 ; $(MAKE) hp
	cd Mesa ; $(MAKE) hpux
	cd src ; $(MAKE) hp-mesa
	cd util ; $(MAKE) hp
	cd userfuncs ; ./externf_all
	cd import ; $(MAKE) hp

linux-x:
	cd lui5 ; $(MAKE) linux
	cd Mesa ; $(MAKE) linux
	cd src ; $(MAKE) linux-mesa
	cd util ; $(MAKE) linux
	cd import ; $(MAKE) linux

sunos4-x:
	cd lui5 ; $(MAKE) sunos4
	cd Mesa ; $(MAKE) sunos4
	cd src ; $(MAKE) sunos4-mesa
	cd util ; $(MAKE) sunos4
	cd userfuncs ; ./externf_all
	cd import ; $(MAKE) sunos4

sunos5-x:
	cd lui5 ; $(MAKE) sunos5
	cd Mesa ; $(MAKE) sunos5
	cd src ; $(MAKE) sunos5-mesa
	cd util ; $(MAKE) sunos5
	cd userfuncs ; ./externf_all
	cd import ; $(MAKE) suno5

sunos5-opengl:
	cd lui5 ; $(MAKE) sunos5
	cd src ; $(MAKE) sunos5-opengl
	cd util ; $(MAKE) sunos5
	cd userfuncs ; ./externf_all
	cd import ; $(MAKE) suno5

foo:
	cd lui5 ; $(MAKE) foo
	cd src ; $(MAKE) foo
	cd util ; $(MAKE) foo
	cd userfuncs ; ./externf_all


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

#
# Miscellaneous makes:
#

VDIR = vis5d-4.2


# Make the Vis5D source tar file

TAR_FILES = \
	$(VDIR)/README			\
	$(VDIR)/README.ps		\
	$(VDIR)/NOTICE			\
	$(VDIR)/Makefile		\
	$(VDIR)/api.html		\
	$(VDIR)/script.html		\
	$(VDIR)/*.tcl			\
	$(VDIR)/lui5/Makefile		\
	$(VDIR)/lui5/*.[ch]		\
	$(VDIR)/src/Makefile		\
	$(VDIR)/src/mcsetup		\
	$(VDIR)/src/*.[chf]		\
	$(VDIR)/src/*[45].a		\
	$(VDIR)/util/Makefile		\
	$(VDIR)/util/*.[chfm]		\
	$(VDIR)/convert/*.[cfhm]	\
	$(VDIR)/userfuncs/README	\
	$(VDIR)/userfuncs/externf	\
	$(VDIR)/userfuncs/externf.m	\
	$(VDIR)/userfuncs/externf_all	\
	$(VDIR)/userfuncs/*.f		\
	$(VDIR)/Mesa/README		\
	$(VDIR)/Mesa/Makefile		\
	$(VDIR)/Mesa/Make-config	\
	$(VDIR)/Mesa/src/*.[ch]		\
	$(VDIR)/Mesa/src/depend		\
	$(VDIR)/Mesa/src/Makefile	\
	$(VDIR)/Mesa/src-glu/*.[ch]	\
	$(VDIR)/Mesa/src-glu/depend	\
	$(VDIR)/Mesa/src-glu/Makefile	\
	$(VDIR)/Mesa/include		\
	$(VDIR)/import/README		\
	$(VDIR)/import/Makefile		\
	$(VDIR)/import/*.[chf]		\
	$(VDIR)/contrib

# v5dimport source files:
V5DIMPORT_FILES = \
	$(VDIR)/import/Makefile		\
	$(VDIR)/import/README		\
	$(VDIR)/import/*.[chf]


tar:
	cd src ; co graphics.*.c ; co Makefile ; \
	cd ../.. ; \
	tar -cvdLf vis5d-4.2.tar $(TAR_FILES) ; \
	tar -rvf vis5d-4.2.tar $(V5DIMPORT_FILES) ; \
	compress vis5d-4.2.tar ; \
	mv vis5d-4.2.tar.Z $(VDIR)


import_tar:
	cd .. ; \
	tar -cvf v5dimport.tar $(V5DIMPORT_FILES) ; \
	compress v5dimport.tar ; \
	mv v5dimport.tar.Z $(VDIR)


# Make the Vis5D Data tar file

DATA_FILES = \
	OUTLUSAM	\
	OUTLSUPW	\
	EARTH.TOPO	\
	SCHL.v5d	\
	LAMPS.v5d
datatar:
	tar -cvdLf vis5d-data.tar $(DATA_FILES) ; \
	compress vis5d-data.tar



# Make tar file of executables for certain systems

BINARIES = \
	$(VDIR)/comp_to_v5d	\
	$(VDIR)/gr3d_to_v5d	\
	$(VDIR)/gg3d		\
	$(VDIR)/help		\
	$(VDIR)/igg3d		\
	$(VDIR)/igu3d		\
	$(VDIR)/vis5d		\
	$(VDIR)/v5dinfo		\
	$(VDIR)/v5dstats	\
	$(VDIR)/v5dedit		\
	$(VDIR)/v5dappend	\


# Make tar file of SGI IRIX 5.x binaries:
irix5_bin_tar:
	cd .. ; \
	tar -cvf vis5d.irix5.bin.tar $(BINARIES) $(VDIR)/listfonts ; \
	compress vis5d.irix5.bin.tar ; \
	mv vis5d.irix5.bin.tar.Z $(VDIR)


# Make tar file of IBM AIX binaries:
ibm_bin_tar:
	cd .. ; \
	tar -cvf vis5d.ibm.bin.tar $(BINARIES) ; \
	compress vis5d.ibm.bin.tar ; \
	mv vis5d.ibm.bin.tar.Z $(VDIR)


# Make tar file of HP HP-UX binaries:
hp_bin_tar:
	cd .. ; \
	tar -cvf vis5d.hp.bin.tar $(BINARIES) ; \
	compress vis5d.hp.bin.tar ; \
	mv vis5d.hp.bin.tar.Z $(VDIR)


# Make tar file of Alpha OSF/1 binaries:
alpha_bin_tar:
	cd .. ; \
	tar -cvf vis5d.alpha.bin.tar $(BINARIES) ; \
	compress vis5d.alpha.bin.tar ; \
	mv vis5d.alpha.bin.tar.Z $(VDIR)


# Make tar file of SunOS 5.x binaries:
sunos5_bin_tar:
	cd .. ; \
	tar -cvf vis5d.sunos5.bin.tar $(BINARIES) ; \
	compress vis5d.sunos5.bin.tar ; \
	mv vis5d.sunos5.bin.tar.Z $(VDIR)


# Make tar file of PC Linux binaries:
linux_bin_tar:
	cd .. ; \
	tar -cvf vis5d.linux.bin.tar $(BINARIES) ; \
	compress vis5d.linux.bin.tar ; \
	mv vis5d.linux.bin.tar.Z $(VDIR)



# Remove all .o files and Emacs backup files:
clean:
	cd lui5 ; $(MAKE) clean
	cd src ; $(MAKE) clean
	cd util ; $(MAKE) clean
	-rm userfuncs/*.o


# Remove everything that can be reproduced with make
really_clean:
	cd lui5 ; $(MAKE) clean
	cd src ; $(MAKE) clean
	cd util ; $(MAKE) clean
	cd Mesa ; $(MAKE) clean
	-rm -rf Mesa/lib
	-rm lui5/liblui.a util/libmain.a
	-rm $(BINARIES) listfonts


# Make backup of vis5d-4.2 directory tree
SAVE_DIR = /usr4/save/vis5d-4.2
save:
	cp Makefile		$(SAVE_DIR)
	cp lui5/Makefile	$(SAVE_DIR)/lui5
	cp lui5/*.[ch]		$(SAVE_DIR)/lui5
	cp src/Makefile		$(SAVE_DIR)/src
	cp src/*.[ch]		$(SAVE_DIR)/src
	cp util/Makefile	$(SAVE_DIR)/util
	cp util/*.[chfF]	$(SAVE_DIR)/util
#	cp import/*.[chf]	$(SAVE_DIR)/import
	cp Mesa/LICENSE		$(SAVE_DIR)/Mesa
	cp Mesa/Make*		$(SAVE_DIR)/Mesa
	cp Mesa/README		$(SAVE_DIR)/Mesa
	cp Mesa/mklib*		$(SAVE_DIR)/Mesa
	cp -r Mesa/include	$(SAVE_DIR)/Mesa
	cp Mesa/src/Makefile	$(SAVE_DIR)/Mesa/src
	cp Mesa/src/depend	$(SAVE_DIR)/Mesa/src
	cp Mesa/src/*.[ch]		$(SAVE_DIR)/Mesa/src
	cp Mesa/src-glu/Makefile	$(SAVE_DIR)/Mesa/src-glu
	cp Mesa/src-glu/depend		$(SAVE_DIR)/Mesa/src-glu
	cp Mesa/src-glu/*.[ch]		$(SAVE_DIR)/Mesa/src-glu
	cp import/Makefile	$(SAVE_DIR)/import
	cp import/*.[ch]	$(SAVE_DIR)/import

