From 9205d3928ba4a478897f07cc582f851fd1b370f6 Mon Sep 17 00:00:00 2001 From: curt Date: Thu, 26 Jun 1997 19:08:22 +0000 Subject: [PATCH] Restructuring make, adding automatic "make dep" support. --- Aircraft/Makefile | 16 +++++--- Controls/Makefile | 14 ++++--- FDM/Makefile | 14 ++++--- LaRCsim/Makefile | 10 ++++- Main/GLTKkey.c | 9 +++-- Main/GLmain.c | 13 ++++++- Main/Makefile | 40 ++++++++++--------- Scenery/Makefile | 19 ++++++--- Simulator/Makefile | 96 +++++++++++++++++++++++++++++++++++++++++----- Slew/Makefile | 13 +++++-- Time/Makefile | 14 +++++-- Time/fg_timer.c | 9 +++-- 12 files changed, 201 insertions(+), 66 deletions(-) diff --git a/Aircraft/Makefile b/Aircraft/Makefile index 2ba423b7c..e554c8618 100644 --- a/Aircraft/Makefile +++ b/Aircraft/Makefile @@ -31,8 +31,7 @@ HFILES = aircraft.h OFILES = $(CFILES:.c=.o) CC = gcc -CFLAGS = -g -Wall -# CFLAGS = -O2 -Wall +CFLAGS = $(FG_CFLAGS) AR = ar @@ -50,6 +49,9 @@ $(TARGET): $(OFILES) $(HFILES) all: $(TARGET) +dep: + $(CC) -MM *.c > depend + clean: rm -f *.o $(TARGET) lib*.a *~ core @@ -58,15 +60,17 @@ clean: # Secondary Targets #--------------------------------------------------------------------------- -aircraft.o: aircraft.c aircraft.h - $(CC) $(CFLAGS) $(INCLUDES) -c aircraft.c +include depend -aircraft.h: ../Flight/flight.h ../Controls/controls.h - touch aircraft.h +aircraft.o: + $(CC) $(CFLAGS) $(INCLUDES) -c aircraft.c #--------------------------------------------------------------------------- # $Log$ +# Revision 1.5 1997/06/26 19:08:28 curt +# Restructuring make, adding automatic "make dep" support. +# # Revision 1.4 1997/06/25 15:39:44 curt # Minor changes to compile with rsxnt/win32. # diff --git a/Controls/Makefile b/Controls/Makefile index baa1e8bfb..7315b7ade 100644 --- a/Controls/Makefile +++ b/Controls/Makefile @@ -31,8 +31,7 @@ HFILES = controls.h OFILES = $(CFILES:.c=.o) CC = gcc -CFLAGS = -g -Wall -# CFLAGS = -O2 -Wall +CFLAGS = $(FG_CFLAGS) AR = ar @@ -50,6 +49,9 @@ $(TARGET): $(OFILES) all: $(TARGET) +dep: + $(CC) -MM *.c > depend + clean: rm -f *.o $(TARGET) lib*.a *~ core @@ -58,15 +60,17 @@ clean: # Secondary Targets #--------------------------------------------------------------------------- -controls.h: ../limits.h - touch controls.h +include depend -controls.o: controls.c controls.h ../Aircraft/aircraft.h +controls.o: $(CC) $(CFLAGS) $(INCLUDES) -c controls.c #--------------------------------------------------------------------------- # $Log$ +# Revision 1.6 1997/06/26 19:08:29 curt +# Restructuring make, adding automatic "make dep" support. +# # Revision 1.5 1997/06/25 15:39:46 curt # Minor changes to compile with rsxnt/win32. # diff --git a/FDM/Makefile b/FDM/Makefile index 26a9ea058..0082de4e8 100644 --- a/FDM/Makefile +++ b/FDM/Makefile @@ -30,8 +30,7 @@ CFILES = flight.c OFILES = $(CFILES:.c=.o) CC = gcc -CFLAGS = -g -Wall -# CFLAGS = -O2 -Wall +CFLAGS = $(FG_CFLAGS) AR = ar @@ -49,6 +48,9 @@ $(TARGET): $(OFILES) all: $(TARGET) +dep: + $(CC) -MM *.c > depend + clean: rm -f *.o $(TARGET) lib*.a *~ core @@ -57,15 +59,17 @@ clean: # Secondary Targets #--------------------------------------------------------------------------- -flight.h: Slew/slew.h LaRCsim/ls_interface.h - touch flight.h +include depend -flight.o: flight.c flight.h +flight.o: $(CC) $(CFLAGS) $(INCLUDES) -c flight.c #--------------------------------------------------------------------------- # $Log$ +# Revision 1.6 1997/06/26 19:08:30 curt +# Restructuring make, adding automatic "make dep" support. +# # Revision 1.5 1997/06/25 15:39:46 curt # Minor changes to compile with rsxnt/win32. # diff --git a/LaRCsim/Makefile b/LaRCsim/Makefile index 9b25a2c9c..d8c527375 100644 --- a/LaRCsim/Makefile +++ b/LaRCsim/Makefile @@ -22,8 +22,7 @@ CFILES = $(LaRCsimFILES) $(NavionFILES) $(InterfaceFILES) OFILES = $(CFILES:.c=.o) CC = gcc -CFLAGS = -g -# CFLAGS = -O2 +CFLAGS = $(FG_CFLAGS) AR = ar @@ -44,6 +43,9 @@ simtest: $(TARGET) LaRCsim.o all: $(TARGET) +dep: + $(CC) -MM *.c > depend + clean: rm -f *.o $(TARGET) *~ core @@ -52,10 +54,14 @@ clean: # Secondary Targets #--------------------------------------------------------------------------- +include depend #--------------------------------------------------------------------------- # $Log$ +# Revision 1.4 1997/06/26 19:08:30 curt +# Restructuring make, adding automatic "make dep" support. +# # Revision 1.3 1997/06/21 17:12:50 curt # Capitalized subdirectory names. # diff --git a/Main/GLTKkey.c b/Main/GLTKkey.c index a6b6efc50..36595607f 100644 --- a/Main/GLTKkey.c +++ b/Main/GLTKkey.c @@ -30,7 +30,7 @@ #include "gltk.h" #include "GLTKkey.h" -#include "../aircraft/aircraft.h" +#include "../Aircraft/aircraft.h" /* Handle keyboard events */ @@ -75,9 +75,12 @@ GLenum GLTKkey(int k, GLenum mask) { /* $Log$ -/* Revision 1.3 1997/06/21 17:12:52 curt -/* Capitalized subdirectory names. +/* Revision 1.4 1997/06/26 19:08:32 curt +/* Restructuring make, adding automatic "make dep" support. /* + * Revision 1.3 1997/06/21 17:12:52 curt + * Capitalized subdirectory names. + * * Revision 1.2 1997/05/23 15:40:24 curt * Added GNU copyright headers. * Fog now works! diff --git a/Main/GLmain.c b/Main/GLmain.c index 0b9483a0f..02cbcb708 100644 --- a/Main/GLmain.c +++ b/Main/GLmain.c @@ -273,7 +273,11 @@ void fgUpdateTimeDepCalcs(int multi_loop) { void fgInitTimeDepCalcs() { /* initialize timer */ + +#ifdef USE_ITIMER fgTimerInit( 1.0 / DEFAULT_TIMER_HZ, fgUpdateTimeDepCalcs ); +#endif USE_ITIMER + } @@ -416,6 +420,8 @@ int main( int argc, char *argv[] ) { f = ¤t_aircraft.flight; + printf("Flight Gear: prototype code to test OpenGL, LaRCsim, and VRML\n\n"); + #ifdef GLUT /* initialize GLUT */ glutInit(&argc, argv); @@ -553,9 +559,12 @@ int main( int argc, char *argv[] ) { /* $Log$ -/* Revision 1.22 1997/06/25 15:39:47 curt -/* Minor changes to compile with rsxnt/win32. +/* Revision 1.23 1997/06/26 19:08:33 curt +/* Restructuring make, adding automatic "make dep" support. /* + * Revision 1.22 1997/06/25 15:39:47 curt + * Minor changes to compile with rsxnt/win32. + * * Revision 1.21 1997/06/22 21:44:41 curt * Working on intergrating the VRML (subset) parser. * diff --git a/Main/Makefile b/Main/Makefile index f60c695f5..a682d7a65 100644 --- a/Main/Makefile +++ b/Main/Makefile @@ -28,12 +28,9 @@ TARGET=fgfs0 CC = gcc -# STD_FLAGS = -O2 -Wall -STD_CFLAGS = -g -Wall - #--------------------------------------------------------------------------- -# Define the high level GL interface library +# This is overridden in the top level Makefile, if make is run from there. #--------------------------------------------------------------------------- # For GLUT @@ -53,15 +50,15 @@ INTERFACE_FILES = GLUTkey.c #--------------------------------------------------------------------------- # For OpenGL -GRAPHICS_LIBS = -lGLU -lGL -lXmu -lX11 +# GRAPHICS_LIBS = -lGLU -lGL -lXmu -lX11 # For Mesa -# MESA_LIBS = -L/usr/lib/mesa -lMesatk -lMesaaux -lMesaGLU -lMesaGL -# X11_LIBS = -L/usr/X11R6/lib -lXext -lXmu -lXi -lX11 -# GRAPHICS_LIBS = $(MESA_LIBS) $(X11_LIBS) +MESA_LIBS = -L/usr/lib/mesa -lMesatk -lMesaaux -lMesaGLU -lMesaGL +X11_LIBS = -L/usr/X11R6/lib -lXext -lXmu -lXi -lX11 +GRAPHICS_LIBS = $(MESA_LIBS) $(X11_LIBS) -CFLAGS = $(STD_CFLAGS) $(INTERFACE_FLAGS) +CFLAGS = $(FG_CFLAGS) $(INTERFACE_FLAGS) LIBS = $(INTERFACE_LIBS) $(GRAPHICS_LIBS) -lm -lfl CFILES = GLmain.c $(INTERFACE_FILES) mesh2GL.c @@ -82,6 +79,9 @@ $(TARGET): $(OFILES) $(AFILES) all: $(TARGET) +dep: + $(CC) -MM *.c > depend + clean: rm -f *.o $(TARGET) lib*.a *~ core @@ -90,22 +90,26 @@ clean: # Secondary Targets #--------------------------------------------------------------------------- -GLmain.o: GLmain.c GLUTkey.h ../Aircraft/aircraft.h ../Scenery/scenery.h \ - ../Timer/fg_timer.h - $(CC) $(CFLAGS) $(INCLUDES) -c GLmain.c +include depend -GLUTkey.o: GLUTkey.c GLUTkey.h ../Aircraft/aircraft.h - $(CC) $(CFLAGS) $(INCLUDES) -c GLUTkey.c +GLmain.o: + $(CC) $(CFLAGS) -c GLmain.c -GLTKkey.o: GLTKkey.c GLTKkey.h ../Aircraft/aircraft.h - $(CC) $(CFLAGS) $(INCLUDES) -c GLTKkey.c +GLUTkey.o: + $(CC) $(CFLAGS) -c GLUTkey.c -mesh2GL.o: mesh2GL.c ../Scenery/mesh.h - $(CC) $(CFLAGS) $(INCLUDES) -c mesh2GL.c +GLTKkey.o: + $(CC) $(CFLAGS) -c GLTKkey.c + +mesh2GL.o: + $(CC) $(CFLAGS) -c mesh2GL.c #--------------------------------------------------------------------------- # $Log$ +# Revision 1.16 1997/06/26 19:08:33 curt +# Restructuring make, adding automatic "make dep" support. +# # Revision 1.15 1997/06/25 15:39:47 curt # Minor changes to compile with rsxnt/win32. # diff --git a/Scenery/Makefile b/Scenery/Makefile index b0e0e3a87..93cc63f2e 100644 --- a/Scenery/Makefile +++ b/Scenery/Makefile @@ -31,8 +31,7 @@ HFILES = OFILES = $(CFILES:.c=.o) CC = gcc -CFLAGS = -g -Wall -# CFLAGS = -O2 -Wall +CFLAGS = $(FG_CFLAGS) AR = ar @@ -43,11 +42,14 @@ INCLUDES = # Primary Targets #--------------------------------------------------------------------------- -all: $(TARGET) - $(TARGET): $(OFILES) $(HFILES) $(AR) rv $(TARGET) $(OFILES) +all: $(TARGET) + +dep: + $(CC) -MM *.c > depend + clean: rm -f *.o $(TARGET) lib*.a *~ core @@ -56,15 +58,20 @@ clean: # Secondary Targets #--------------------------------------------------------------------------- -common.o: common.c common.h +include depend + +common.o: $(CC) $(CFLAGS) -c common.c -mesh.o: mesh.c mesh.h common.h +mesh.o: $(CC) $(CFLAGS) -c mesh.c #--------------------------------------------------------------------------- # $Log$ +# Revision 1.10 1997/06/26 19:08:34 curt +# Restructuring make, adding automatic "make dep" support. +# # Revision 1.9 1997/06/25 15:39:48 curt # Minor changes to compile with rsxnt/win32. # diff --git a/Simulator/Makefile b/Simulator/Makefile index 209a8c960..eaf1bc3d6 100644 --- a/Simulator/Makefile +++ b/Simulator/Makefile @@ -24,30 +24,105 @@ #--------------------------------------------------------------------------- +#--------------------------------------------------------------------------- +# Choose your weapon +#--------------------------------------------------------------------------- + CC = gcc +export CC +#--------------------------------------------------------------------------- +# Global Compile Options +# +# You may set FG_CFLAGS to include any of the following options depending on +# your environment: +# +# -g - Compile with debugging symbols +# +# -Wall - Enable full compiler warnings +# +# -O2 - Enable compiler optimization +# +# -DUSE_ITIMER - Use setitimer(), getitimer(), and signal() to mimic +# a real time system and call the flight model routines +# at a regular interval, rather than between screen updates +# which can be highly variable. This can make the flight +# much smoother. +#--------------------------------------------------------------------------- + +FG_CFLAGS = -g -Wall -DUSE_ITIMER +export FG_CFLAGS + + +#--------------------------------------------------------------------------- +# Uncomment one of the following sections depending on your system +# +# You may set FG_GRAPHICS to include any of the following options depending +# on your environment: +#--------------------------------------------------------------------------- + +#--------------------------------------------------------------------------- +# SGI IRIX with the GLUT toolkit +# +# INTERFACE_FLAGS = -DGLUT +# INTERFACE_LIBS = -lglut +# INTERFACE_FILES = GLUTkey.c +# GRAPHICS_LIBS = -lGLU -lGL -lXmu -lX11 +#--------------------------------------------------------------------------- + +#--------------------------------------------------------------------------- +# Linux/Mesa with the GLUT toolkit +# +INTERFACE_FLAGS = -DGLUT +INTERFACE_LIBS = -lglut +INTERFACE_FILES = GLUTkey.c +MESA_LIBS = -L/usr/lib/mesa -lMesatk -lMesaaux -lMesaGLU -lMesaGL +X11_LIBS = -L/usr/X11R6/lib -lXext -lXmu -lXi -lX11 +GRAPHICS_LIBS = $(MESA_LIBS) $(X11_LIBS) +#--------------------------------------------------------------------------- + +#--------------------------------------------------------------------------- +# Windows 95/NT with the GLUT toolkit +# +# INTERFACE_FLAGS = -DGLUT +# INTERFACE_LIBS = -lglut +# INTERFACE_FILES = GLUTkey.c +# GRAPHICS_LIBS = -lGLU -lGL +#--------------------------------------------------------------------------- + +export INTERFACE_FLAGS INTERFACE_LIBS GRAPHICS_LIBS + + +#--------------------------------------------------------------------------- +# You shouldn't need to modify anything beyond this point +#--------------------------------------------------------------------------- + SUBSUBDIRS = Flight/LaRCsim Flight/Slew Scenery/ParseScn Scenery/ParseVrml SUBDIRS = Aircraft Controls Flight mat3 Scenery Timer MAIN = OpenGL -all: - for dir in $(SUBSUBDIRS) $(SUBDIRS) $(MAIN); do \ - ( cd $$dir; make CC=$(CC) ) ; \ +all: + for dir in $(SUBSUBDIRS) $(SUBDIRS); do \ + ( cd $$dir; $(MAKE) ) ; \ done - - -install: - for dir in $(SUBSUBDIRS) $(SUBDIRS) $(MAIN); do \ - ( cd $$dir; make CC=$(CC) install) ; \ + for dir in $(MAIN); do \ + ( cd $$dir; $(MAKE) ) ; \ done +dep: + for dir in $(SUBSUBDIRS) $(SUBDIRS); do \ + ( cd $$dir; $(MAKE) dep ) ; \ + done + for dir in $(MAIN); do \ + ( cd $$dir; $(MAKE) dep ) ; \ + done clean: -rm -f *~ for dir in $(SUBSUBDIRS) $(SUBDIRS) $(MAIN); do \ - (cd $$dir; make clean) ; \ + (cd $$dir; $(MAKE) clean) ; \ done @@ -59,6 +134,9 @@ tar: clean #--------------------------------------------------------------------------- # $Log$ +# 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. # diff --git a/Slew/Makefile b/Slew/Makefile index 6faec02e6..a14915c99 100644 --- a/Slew/Makefile +++ b/Slew/Makefile @@ -30,8 +30,7 @@ CFILES = slew.c OFILES = $(CFILES:.c=.o) CC = gcc -CFLAGS = -g -Wall -# CFLAGS = -O2 -Wall +CFLAGS = $(FG_CFLAGS) AR = ar @@ -49,6 +48,9 @@ $(TARGET): $(OFILES) all: $(TARGET) +dep: + $(CC) -MM *.c > depend + clean: rm -f *.o $(TARGET) lib*.a *~ core @@ -57,12 +59,17 @@ clean: # Secondary Targets #--------------------------------------------------------------------------- -slew.o: slew.c slew.h ../../Aircraft/aircraft.h ../../Controls/controls.h +include depend + +slew.o: $(CC) $(CFLAGS) $(INCLUDES) -c slew.c #--------------------------------------------------------------------------- # $Log$ +# Revision 1.4 1997/06/26 19:08:31 curt +# Restructuring make, adding automatic "make dep" support. +# # Revision 1.3 1997/06/25 15:39:46 curt # Minor changes to compile with rsxnt/win32. # diff --git a/Time/Makefile b/Time/Makefile index c835efe2c..b04827ea4 100644 --- a/Time/Makefile +++ b/Time/Makefile @@ -31,9 +31,7 @@ HFILES = fg_timer.h OFILES = $(CFILES:.c=.o) CC = gcc -# CFLAGS = -g -Wall -DUSE_ITIMER -CFLAGS = -g -Wall -# CFLAGS = -O2 -Wall +CFLAGS = $(FG_CFLAGS) AR = ar @@ -51,6 +49,9 @@ $(TARGET): $(OFILES) all: $(TARGET) +dep: + $(CC) -MM *.c > depend + clean: rm -f *.o $(TARGET) lib*.a *~ core @@ -59,12 +60,17 @@ clean: # Secondary Targets #--------------------------------------------------------------------------- -fg_timer.o: fg_timer.c fg_timer.h +include depend + +fg_timer.o: $(CC) $(CFLAGS) $(INCLUDES) -c fg_timer.c #--------------------------------------------------------------------------- # $Log$ +# Revision 1.4 1997/06/26 19:08:37 curt +# Restructuring make, adding automatic "make dep" support. +# # Revision 1.3 1997/06/25 17:46:58 curt # Make itimer support optional. # diff --git a/Time/fg_timer.c b/Time/fg_timer.c index 71a196019..0b07037ef 100644 --- a/Time/fg_timer.c +++ b/Time/fg_timer.c @@ -35,7 +35,7 @@ unsigned long int fgSimTime; -#ifdef HAVE_ITIMER +#ifdef USE_ITIMER static struct itimerval t, ot; static void (*callbackfunc)(int multi_loop); @@ -109,9 +109,12 @@ int fgGetTimeInterval() { /* $Log$ -/* Revision 1.4 1997/06/25 15:39:49 curt -/* Minor changes to compile with rsxnt/win32. +/* Revision 1.5 1997/06/26 19:08:38 curt +/* Restructuring make, adding automatic "make dep" support. /* + * Revision 1.4 1997/06/25 15:39:49 curt + * Minor changes to compile with rsxnt/win32. + * * Revision 1.3 1997/06/17 16:52:04 curt * Timer interval stuff now uses gettimeofday() instead of ftime() * -- 2.39.2