#---------------------------------------------------------------------------
# Toplevel Project Makefile
#
# Written by Curtis Olson, started May 1997.
#
# Copyright (C) 1997  Curtis L. Olson  - curt@infoplane.com
#
# 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 2 of the License, 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.
#
# $Id: Makefile,v 1.44 1998/03/09 22:52:53 curt Exp $
# (Log is kept at end of this file)
#---------------------------------------------------------------------------


include $(FG_ROOT_SRC)/commondefs

SUBSUBDIRS = Flight/LaRCsim Flight/Slew
SUBDIRS = Aircraft Astro Cockpit Controls Flight Joystick Math Scenery \
	Time Weather XGL
MAIN = Main
ORDEREDDIRS = $(SUBSUBDIRS) $(SUBDIRS) $(MAIN)

all: 
	for dir in $(ORDEREDDIRS); do \
	    ( cd $$dir; $(MAKE) ) ; \
	done

depend:
	for dir in $(ORDEREDDIRS); do \
	    ( echo "Making depend in $$dir"; \
	      cd $$dir; $(CC) $(CFLAGS) $(CCDEPFLAG) *.c > depend ) ; \
	done

Makefile-os2:
	cat Makefile | perl mkmfos2.pl > Makefile.os2; \
	for dir in $(ORDEREDDIRS); do \
	    ( echo "Making Makefile.os2 in $$dir"; \
	      cat $$dir/Makefile | perl mkmfos2.pl > $$dir/Makefile.os2; \
	      cat $$dir/depend   | perl mkmfos2.pl > $$dir/depend.os2) ; \
	done

clean:
	-rm -f *.os2 *~
	-rm -f $(FG_ROOT_LIB)/*.a $(FG_ROOT_LIB)/stamp_libs
	for dir in $(ORDEREDDIRS); do \
	    (cd $$dir; $(MAKE) clean) ; \
	done

clobber:
	-rm -f *.os2 *~
	-rm -f $(FG_ROOT_LIB)/*.a $(FG_ROOT_LIB)/stamp_libs
	for dir in $(ORDEREDDIRS); do \
	    (cd $$dir; $(MAKE) clobber) ; \
	done

source-tar: clean
	(cd ../..; \
	$(TAR) cvzf source-$(FG_VERSION).tar.gz FlightGear/fgtop \
	FlightGear/COPYING FlightGear/Docs FlightGear/Src FlightGear/Lib)

source-zip: clean
	(cd ../..; \
	zip -r source-$(FG_VERSION).zip FlightGear/fgtop \
	FlightGear/COPYING FlightGear/Docs FlightGear/Src FlightGear/Lib)

scenery-tar:
	(cd ../..; \
	$(TAR) cvzf scenery-$(FG_VERSION).tar.gz FlightGear/Scenery/*.dat \
	FlightGear/Scenery/*/*/*.obj)

scenery-zip:
	(cd ../..; \
	zip -r scenery-$(FG_VERSION).zip FlightGear/Scenery/*.dat \
	FlightGear/Scenery/*/*/*.obj)

bin-tar: all
	cp Main/fg-$(FG_VERSION) README Thanks runfg ..
	$(RM) -f ../fg$(FG_VERSION_MAJOR)
	$(LN) ../fg-$(FG_VERSION) ../fg$(FG_VERSION_MAJOR)
	(cd ../..; \
	$(TAR) cvzf bin-$(FG_VERSION).tar.gz FlightGear/fgtop \
	FlightGear/fg-$(FG_VERSION) FlightGear/fg$(FG_VERSION_MAJOR) \
	FlightGear/runfg FlightGear/COPYING FlightGear/Docs FlightGear/README \
	FlightGear/Thanks)

bin-zip: 
	cp Main/fg$(FG_VERSION_MAJOR).exe README Thanks \
	runfg.bat ../Win32/glut.dll ../Win32/cygwinb19.dll ..
	(cd ../..; \
	zip -r bin-$(FG_VERSION).zip FlightGear/fgtop \
	FlightGear/fg$(FG_VERSION_MAJOR).exe FlightGear/runfg.bat \
	FlightGear/cygwinb19.dll FlightGear/glut.dll FlightGear/COPYING \
	FlightGear/Docs FlightGear/README FlightGear/Thanks )

bin-exp-zip: 
	cp Main/fg$(FG_VERSION_MAJOR).exe Main/cygwin.dll README Thanks \
	runfg.bat ../Win32/*.dll ..
	(cd ../..; \
	zip -r bin-exp-$(FG_VERSION).zip FlightGear/fgtop \
	FlightGear/fg$(FG_VERSION_MAJOR).exe FlightGear/runfg.bat \
	FlightGear/cygwin.dll FlightGear/COPYING FlightGear/Docs \
	FlightGear/README FlightGear/Thanks FlightGear/glu.dll \
	FlightGear/glut.dll FlightGear/msvcrt.dll FlightGear/opengl.dll)


#---------------------------------------------------------------------------
# $Log: Makefile,v $
# Revision 1.44  1998/03/09 22:52:53  curt
# Misc. configuration tweaks.
#
# Revision 1.43  1998/02/19 13:05:43  curt
# Incorporated some HUD tweaks from Michelle America.
# Tweaked the sky's sunset/rise colors.
# Other misc. tweaks.
#
# Revision 1.42  1998/02/18 15:07:02  curt
# Tweaks to build with SGI OpenGL (and therefor hopefully other accelerated
# drivers will work.)
#
# Revision 1.41  1998/02/09 22:56:28  curt
# Removed "depend" files from cvs control.  Other minor make tweaks.
#
# Revision 1.40  1998/02/01 03:39:53  curt
# Minor tweaks.
#
# Revision 1.39  1998/01/27 00:47:41  curt
# Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
# system and commandline/config file processing code.
#
# Revision 1.38  1998/01/22 22:03:22  curt
# Tweaks.
#
# Revision 1.37  1998/01/19 19:42:58  curt
# More misc. tweaks for rpk make merge.
#
# Revision 1.36  1998/01/19 19:26:51  curt
# Merged in make system changes from Bob Kuehne <rpk@sgi.com>
# This should simplify things tremendously.
#
# Revision 1.35  1998/01/07 03:18:14  curt
# Created the Astro/ subdirctory for stuff high in the sky ...
#
# Revision 1.34  1997/12/18 23:32:28  curt
# First stab at sky dome actually starting to look reasonable. :-)
#
# Revision 1.33  1997/12/17 23:13:17  curt
# Changes and tweaks to go to version 0.19 (Plus tweaks to Solaris support)
#
# Revision 1.32  1997/12/15 23:54:25  curt
# Add xgl wrappers for debugging.
# Generate terrain normals on the fly.
#
# Revision 1.31  1997/12/15 20:59:08  curt
# Misc. tweaks.
#
# Revision 1.30  1997/12/10 01:19:42  curt
# Tweaks for verion 0.15 release.
#
# Revision 1.29  1997/10/30 12:38:35  curt
# Working on new scenery subsystem.
#
# Revision 1.28  1997/10/28 19:35:40  curt
# Organizational changes.
#
# Revision 1.27  1997/09/23 00:29:27  curt
# Tweaks to get things to compile with gcc-win32.
#
# Revision 1.26  1997/09/04 02:17:18  curt
# Shufflin' stuff.
#
# Revision 1.25  1997/08/25 20:27:21  curt
# Merged in initial HUD and Joystick code.
#
# Revision 1.24  1997/08/16 12:22:17  curt
# Tweaks for new version.
#
# Revision 1.23  1997/08/13 20:22:55  curt
# Renamed OpenGL/ to GLUT/
#
# Revision 1.22  1997/07/31 22:52:21  curt
# Working on redoing internal coordinate systems & scenery transformations.
#
# Revision 1.21  1997/07/30 16:12:38  curt
# Moved fg_random routines from Util/ to Math/
#
# Revision 1.20  1997/07/20 02:19:09  curt
# First stab at a system to generate os2 makefiles automatically.
#
# Revision 1.19  1997/07/19 23:04:46  curt
# Added an initial weather section.
#
# Revision 1.18  1997/07/19 22:36:28  curt
# Added Utils/ subdirectory
#
# Revision 1.17  1997/07/18 23:41:20  curt
# Tweaks for building with Cygnus Win32 compiler.
#
# Revision 1.16  1997/07/07 20:59:47  curt
# Working on scenery transformations to enable us to fly fluidly over the
# poles with no discontinuity/distortion in scenery.
#
# Revision 1.15  1997/07/05 20:43:27  curt
# renamed mat3 directory to Math so we could add other math related routines.
#
# Revision 1.14  1997/06/29 21:19:16  curt
# Working on scenery management system.
#
# Revision 1.13  1997/06/28 00:49:02  curt
# Tweaking Makefile structure ..
#
# Revision 1.12  1997/06/27 21:37:59  curt
# Working on Makefile structure.
#
# Revision 1.11  1997/06/27 20:03:31  curt
# Working on Makefile structure.
#
# Revision 1.10  1997/06/26 19:08:22  curt
# Restructuring make, adding automatic "make dep" support.
#
# Revision 1.9  1997/06/22 21:44:40  curt
# Working on intergrating the VRML (subset) parser.
#
# Revision 1.8  1997/06/21 17:52:22  curt
# Continue directory shuffling ... everything should be compilable/runnable
# again.
#
# Revision 1.7  1997/06/21 17:12:38  curt
# Capitalized subdirectory names.
#
# Revision 1.6  1997/06/16 19:32:50  curt
# Starting to add general timer support.
#
# Revision 1.5  1997/05/30 19:26:56  curt
# The LaRCsim flight model is starting to look like it is working.
#
# Revision 1.4  1997/05/29 02:31:43  curt
# Update subdirectory structure.
#
# Revision 1.3  1997/05/23 15:40:04  curt
# Added GNU copyright headers.
#
# Revision 1.2  1997/05/23 00:35:09  curt
# Trying to get fog to work ...
#
# Revision 1.1  1997/05/16 15:51:13  curt
# Initial revision.
#
