all: fg.so


SGINC=  -I/data/src/simulation/fg/simgear \
		-I/data/src/simulation/fg/simgear/simgear \
		-I/data/src/simulation/fg/simgear/simgear/nasal \
		-I/data/src/simulation/fg/simgear/simgear/threads \
		-I/data/src/simulation/fg/simgear/simgear/props \
		-I/data/src/simulation/fg/simgear/simgear/misc \
		-I/data/src/simulation/fg/simgear/simgear/serial \
		-I/data/src/simulation/fg/simgear/simgear/ephemeris \
		-I/data/src/simulation/fg/simgear/simgear/sound \
		-I/data/src/simulation/fg/simgear/simgear/bucket \
		-I/data/src/simulation/fg/simgear/simgear/hla \
		-I/data/src/simulation/fg/simgear/simgear/environment \
		-I/data/src/simulation/fg/simgear/simgear/scene \
		-I/data/src/simulation/fg/simgear/simgear/scene/model \
		-I/data/src/simulation/fg/simgear/simgear/scene/sky \
		-I/data/src/simulation/fg/simgear/simgear/scene/util \
		-I/data/src/simulation/fg/simgear/simgear/scene/tgdb \
		-I/data/src/simulation/fg/simgear/simgear/scene/material \
		-I/data/src/simulation/fg/simgear/simgear/scene/bvh \
		-I/data/src/simulation/fg/simgear/simgear/timing \
		-I/data/src/simulation/fg/simgear/simgear/xml \
		-I/data/src/simulation/fg/simgear/simgear/io \
		-I/data/src/simulation/fg/simgear/simgear/magvar \
		-I/data/src/simulation/fg/simgear/simgear/math \
		-I/data/src/simulation/fg/simgear/simgear/compatibility \
		-I/data/src/simulation/fg/simgear/simgear/route \
		-I/data/src/simulation/fg/simgear/simgear/debug \
		-I/data/src/simulation/fg/simgear/simgear/screen \
		-I/data/src/simulation/fg/simgear/simgear/structure

# -I/data/src/simulation/fg/simgear/simgear/compatibility/MIPSpro721 \
# -I/data/src/simulation/fg/simgear/simgear/compatibility/MIPSpro740 \


FGINC=  -I/data/src/simulation/fg/flightgear/src \
		-I/data/src/simulation/fg/flightgear/src \
		-I/data/src/simulation/fg/flightgear/src/Main \
		-I/data/src/simulation/fg/flightgear/src/Traffic \
		-I/data/src/simulation/fg/flightgear/src/Input \
		-I/data/src/simulation/fg/flightgear/src/Systems \
		-I/data/src/simulation/fg/flightgear/src/MultiPlayer \
		-I/data/src/simulation/fg/flightgear/src/AIModel \
		-I/data/src/simulation/fg/flightgear/src/Airports \
		-I/data/src/simulation/fg/flightgear/src/ATCDCL \
		-I/data/src/simulation/fg/flightgear/src/Aircraft \
		-I/data/src/simulation/fg/flightgear/src/Autopilot \
		-I/data/src/simulation/fg/flightgear/src/Scripting \
		-I/data/src/simulation/fg/flightgear/src/Include \
		-I/data/src/simulation/fg/flightgear/src/Scenery \
		-I/data/src/simulation/fg/flightgear/src/Sound \
		-I/data/src/simulation/fg/flightgear/src/Environment \
		-I/data/src/simulation/fg/flightgear/src/ATC \
		-I/data/src/simulation/fg/flightgear/src/Instrumentation \
		-I/data/src/simulation/fg/flightgear/src/Instrumentation/KLN89 \
		-I/data/src/simulation/fg/flightgear/src/Instrumentation/HUD \
		-I/data/src/simulation/fg/flightgear/src/Navaids \
		-I/data/src/simulation/fg/flightgear/src/Model \
		-I/data/src/simulation/fg/flightgear/src/Network \
		-I/data/src/simulation/fg/flightgear/src/Network/HLA \
		-I/data/src/simulation/fg/flightgear/src/Time \
		-I/data/src/simulation/fg/flightgear/src/FDM \
		-I/data/src/simulation/fg/flightgear/src/FDM/LaRCsim \
		-I/data/src/simulation/fg/flightgear/src/FDM/ExternalPipe \
		-I/data/src/simulation/fg/flightgear/src/FDM/YASim \
		-I/data/src/simulation/fg/flightgear/src/FDM/ExternalNet \
		-I/data/src/simulation/fg/flightgear/src/FDM/JSBSim \
		-I/data/src/simulation/fg/flightgear/src/FDM/JSBSim/initialization \
		-I/data/src/simulation/fg/flightgear/src/FDM/JSBSim/input_output \
		-I/data/src/simulation/fg/flightgear/src/FDM/JSBSim/math \
		-I/data/src/simulation/fg/flightgear/src/FDM/JSBSim/models \
		-I/data/src/simulation/fg/flightgear/src/FDM/JSBSim/models/atmosphere \
		-I/data/src/simulation/fg/flightgear/src/FDM/JSBSim/models/propulsion \
		-I/data/src/simulation/fg/flightgear/src/FDM/JSBSim/models/flight_control \
		-I/data/src/simulation/fg/flightgear/src/FDM/SP \
		-I/data/src/simulation/fg/flightgear/src/FDM/UIUCModel \
		-I/data/src/simulation/fg/flightgear/src/FDM/UIUCModel/Documentation \
		-I/data/src/simulation/fg/flightgear/src/GUI \
		-I/data/src/simulation/fg/flightgear/src/Cockpit \
		-I/data/src/simulation/fg/flightgear/src/Cockpit/built_in

INCLUDES= -I/opt/fgfs/include  -I/usr/include/dbus-1.0/
OPTS=-fPIC -g -c

# -I/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.5/include/g++-v4/ \
# -I/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.5/include/

simgear_wrap.cxx simgear.lisp:simgear.i
	swig  $(SGINC) $(INCLUDES) -c++ -cffi -generate-typedef -cwrap -swig-lisp simgear.i

simgear.cxx:simgear.i Makefile
	echo '#undef HAVE_CONFIG_H'                   < simgear.i  > simgear.cxx
	sed -n -e '/%include/s/%/#/p'                             >> simgear.cxx
	echo '#undef EXTERN'                                      >> simgear.cxx
	echo '#include "simgear_wrap.cxx"'                        >> simgear.cxx

simgear.o:simgear.cxx simgear_wrap.cxx Makefile
	g++ $(OPTS) $(SGINC) $(INCLUDES) -o simgear.o simgear.cxx


flightgear_wrap.cxx flightgear.lisp:flightgear.i
	swig $(FGINC) $(INCLUDES) -c++ -cffi -generate-typedef -cwrap -swig-lisp flightgear.i

flightgear.cxx:flightgear.i Makefile
	echo '#undef HAVE_CONFIG_H'                < flightgear.i  > flightgear.cxx
	sed -n -e '/%include/s/%/#/p'                             >> flightgear.cxx
	echo '#undef EXTERN'                                      >> flightgear.cxx
	echo 'typedef FGTextLayer::Chunk Chunk;'                  >> flightgear.cxx
	echo 'typedef FGXMLAutopilot::Component Component;'       >> flightgear.cxx
	echo '#include "flightgear_wrap.cxx"'                     >> flightgear.cxx

flightgear.o:flightgear.cxx flightgear_wrap.cxx Makefile
	g++ $(OPTS) $(SGINC) $(FGINC) $(INCLUDES) -o flightgear.o flightgear.cxx


fg.so fg.so.2.2.0:simgear.o flightgear.o
	gcc -shared -Wl,-soname,your_soname \
		-o fg.so.2.2.0 simgear.o flightgear.o
ViewGit