Änderung einer Makefile für Matlab C++ Shared Libraries



  • Hallo,

    ich möchte eine Matlab C++ Shared Library in Torcs einzubinden. Torcs ist ein Rennsimulationsspiel. Ziel ist es Matlab-Funktionen in Torcs verwenden zu können.

    Ich habe Informationen, wie Matlab aus einer .cpp-Datei in eine ausführbare Datei umwandelt und, laut Matlab-Support, könnte ich daraus ableiten, wie ich meine Makefile verändern müsse.

    ->    TMW_ROOT              = /usr/local/MATLAB/R2011b
    ->    CC                    = g++
    ->    CC flags:
             CFLAGS             = -ansi -D_GNU_SOURCE -I/usr/local/MATLAB/R2011b/extern/include/cpp -I/usr/local/MATLAB/R2011b/extern/include -DUNIX -DX11 -DGLNXA64 -DGCC -pthread
             CDEBUGFLAGS        = -g
             COPTIMFLAGS        = -O -DNDEBUG
             CLIBS              = -Wl,-rpath-link,/usr/local/MATLAB/R2011b/bin/glnxa64 -L/usr/local/MATLAB/R2011b/runtime/glnxa64  -lmwmclmcrrt -lm
             arguments          = 
    ->    LD                    = g++
    ->    Link flags:
             LDFLAGS            = -pthread
             LDDEBUGFLAGS       = -g
             LDOPTIMFLAGS       = -O
             arguments          =  -L.
    ----------------------------------------------------------------
    
    -> g++ -c  -I. -ansi -D_GNU_SOURCE -I/usr/local/MATLAB/R2011b/extern/include/cpp -I/usr/local/MATLAB/R2011b/extern/include -DUNIX -DX11 -DGLNXA64 -DGCC -pthread  -O -DNDEBUG  "matrixdriver.cpp"
    
    -> g++ -O -pthread  -L. -o matrixdriver  matrixdriver.o -Wl,-rpath-link,/usr/local/MATLAB/R2011b/bin/glnxa64 -L/usr/local/MATLAB/R2011b/runtime/glnxa64  -lmwmclmcrrt -lm  -lmatrixp
    

    Ich habe paar kleine Tutorials für makefiles gemacht kann aber die Syntax nicht wirklich in meiner vorhandenen Makefile durchschauen, sodass ich dort selbst Veränderungen vornehmen könnte. Z.B. ist hier nichtmal angegeben welcher compiler(CC) verwendet werden soll. Hier meine Makefile:

    ##############################################################################
    #
    #    file                 : Makefile
    #    created              : Wed Dec 7 13:40:17 CET 2011
    #    copyright            : (C) 2002 DB
    #
    ##############################################################################
    
    ROBOT       = hawDB
    MODULE      = ${ROBOT}.so
    MODULEDIR   = drivers/${ROBOT}
    SOURCES     = ${ROBOT}.cpp communicationDB.cpp torcsFcnsDB.cpp parameterDB.cpp 
    
    SHIPDIR     = drivers/${ROBOT}
    SHIP        = ${ROBOT}.xml cg-nascar-rwd.rgb logo.rgb
    SHIPSUBDIRS = 
    
    PKGSUBDIRS  = ${SHIPSUBDIRS}
    src-robots-hawDB_PKGFILES = $(shell find * -maxdepth 0 -type f -print)
    src-robots-hawDB_PKGDIR   = ${PACKAGE}-${VERSION}/$(subst ${TORCS_BASE},,$(shell pwd))
    
    include ${MAKE_DEFAULT}
    

    Habt ihr eine Idee?

    Vielen Dank im Voraus:)



  • Keine Idee? Ich benötige wirklich Hilfe, also seit so frei und äussert eure Vermutungen 🙂



  • Schau mal ob es noch andere Makefiles gibt zB die die dort included wird. Siehe auch GNU/Make Handbuch.


Anmelden zum Antworten