help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can the octave library be used for non-octave binaries?


From: John W. Eaton
Subject: Re: Can the octave library be used for non-octave binaries?
Date: Fri, 9 Nov 2001 12:11:29 -0600

On 24-Oct-2001, Stephen W. Juranich <address@hidden> wrote:

| Okay, here's a working, extremely trivial stand-alone program that uses the 
| (hopefully) minimum number of outside libraries.  I've been able to get the 
| SVD stuff working, but I couldn't make the DET class work right yet.  Right 
| now, I have to move on to preparing a proposal defense, so that will have to 
| wait. :)
| 
| Anyway, the first snip is the actual C++ code, and the second is the (GNU) 
| Makefile that made it all happen.  I don't think there's anything GNU 
specific 
| in the Makefile, but I could be wrong.  Of course, the -I and -L
| arguments will vary according to your system's setup, but you should
| be able to get the gist of it all with the following.

With 2.1.36 (or the current CVS if you want it now) you will be able to
use mkoctfile to build stand-alone executables.

So, assuming mkoctfile is in your path, your Makefile would become just

  octave_test: octave_test.o
          mkoctfile --link-stand-alone --output $@ $<

  clean:
          -rm *.o *~

  %.o : %.cc
          @echo Compiling address@hidden
          mkoctfile --compile $<

plus whatever other dependencies you need to specify for header
files, etc.  You could also have rules for Fortran and C files, and
also for generating dependency information:

  %.o : %.c
          mkoctfile --compile $<

  %.o : %.f
          mkoctfile --compile $<

  %.d : %.cc
          mkoctfile --depend $<

  %.d : %.c
          mkoctfile --depend $<

To use the dependency information, you'd add something like

  SOURCES := foo.cc bar.cc
  DEPS := $(SOURCES:.cc=.d)

  -include $(DEPS)

and GNU Make would know to try to generate the .d files so that it can
include them.

jwe



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]