# -*- mode: makefile; -*-
# Do not edit, this is file generated by m4 from Makefile.4sim.m4 and 
#  copied to the simulations while installation! 
# Make your changes in Makefile.conf.
#  E.g. add there files to compile or custom libs and so on.

# File:       Makefile for lpzrobots simulations
# Author:     Georg Martius  <georg.martius at web.de>
# Date:       Oct 2009




 




EXEC = start
# add files to compile in the conf file
include Makefile.conf

CFILES = $(addsuffix .cpp, $(FILES))
OFILES = $(addsuffix .o, $(FILES))

# the CFGOPTS are set by the opt and dbg target
CFGOPTS=
INC    += -I.
BASELIBS = $(shell ode_robots-config $(CFGOPTS) --static --libs) $(shell selforg-config $(CFGOPTS) --static --libs) 
BASELIBSSHARED := $(shell ode_robots-config $(CFGOPTS) --libs) $(shell selforg-config $(CFGOPTS) --libs)


LIBSELFORG=$(shell selforg-config $(CFGOPTS) --libfile)
LIBSELFORGSHARED:=$(shell selforg-config $(CFGOPTS) --solibfile)
SELFORGSRCPREFIX=$(shell selforg-config $(CFGOPTS) --srcprefix)

LIBODEROBOTS=$(shell ode_robots-config $(CFGOPTS) --libfile)
LIBODEROBOTSSHARED:=$(shell ode_robots-config $(CFGOPTS) --solibfile)
ODEROBOTSSRCPREFIX=$(shell ode_robots-config $(CFGOPTS) --srcprefix)




LIBS  += $(BASELIBS) $(ADDITIONAL_LIBS)

INC   += -I.

CXX = g++
CPPFLAGS = -Wall -pipe -Wno-deprecated $(INC) $(shell selforg-config $(CFGOPTS) --cflags) \
  $(shell ode_robots-config $(CFGOPTS) --intern --cflags) 

normal: libode_robots 
	$(MAKE) $(EXEC)
opt:    libode_robots_opt 
	$(MAKE) CFGOPTS=--opt EXEC=$(EXEC)_opt $(EXEC)_opt
dbg:    libode_robots_dbg 
	$(MAKE) CFGOPTS=--dbg EXEC=$(EXEC)_dbg $(EXEC)_dbg
shared:  libode_robots_shared 
	$(MAKE) BASELIBS="$(BASELIBSSHARED)" LIBSELFORG="$(LIBSELFORGSHARED)" \
		LIBODEROBOTS="$(LIBODEROBOTSSHARED)" $(EXEC)

$(EXEC): Makefile Makefile.depend $(OFILES) $(LIBODEROBOTS) $(LIBSELFORG)
	$(CXX) $(CPPFLAGS) $(OFILES) $(LIBS) -o $(EXEC)

libode_robots:	
	cd $(ODEROBOTSSRCPREFIX) && $(MAKE) lib

libode_robots_dbg:	
	cd $(ODEROBOTSSRCPREFIX) && $(MAKE) dbg

libode_robots_opt:	
	cd $(ODEROBOTSSRCPREFIX) && $(MAKE) opt

libode_robots_shared:	
	cd $(ODEROBOTSSRCPREFIX) && $(MAKE) shared


Makefile.depend: 
	makedepend -- $(CPPFLAGS) -- $(CFILES) -f- > Makefile.depend 2>/dev/null

depend: 
	makedepend -- $(CPPFLAGS) -- $(CFILES)  -f- > Makefile.depend 2>/dev/null

tags: 
	etags $(find -name "*.[ch]")

cleandist: clean-all
clean-all: clean
	cd $(ODEROBOTSSRCPREFIX) && make clean-all
	cd $(SELFORGSRCPREFIX) && make clean-all


clean:
	rm -f $(EXEC) $(EXEC)_dbg $(EXEC)_opt *.o Makefile.depend

-include Makefile.depend
