[Trilinos-Users] Linking to Trilinos libraries

Pawlowski, Roger P rppawlo at sandia.gov
Mon Nov 8 09:46:07 MST 2004


Jim,

The script that generates the file trilinos_make_macros.mak is a perl 
script. Just to be safe, you might want to make this a teuchos option 
(enabled by default) and add a check for perl. Otherwise, the script 
could fail to build the file and users won't be able to find it.

Roger


Willenbring, James M wrote:

> All,
>
> Many of you expressed interest in the example Makefile that I used in 
> my configure, build and install presentation last week at the Trilinos 
> User Group meeting. I have attached the whole Makefile. The file 
> assumes that you have three installations of Trilinos. Notice that the 
> path to two out of the three installation locations are commented out. 
> This allows you to easily compile your code using different compilers 
> and in serial or mpi and make sure that you are using the proper 
> compilers, third-party libraries, etc and also assures that you are 
> linking to the proper collection of Trilinos libraries. The prefix 
> (--prefix=..) specified for each of the three installations are:
>
> /location/SERIAL_INTEL
>
> /location/SERIAL_GNU
>
> /location/LAM
>
> Using the technique shown in this Makefile, it is easy to link your 
> code to Trilinos libraries that are a part of an existing Trilinos 
> installation. trilinos_make_macros.mak supplies information about 
> compilers, flags and libraries that were used for the Trilinos 
> installation. Please note that this technique currently only works 
> when Teuchos is enabled. If your installation does not include 
> Teuchos, you can simply add –enable-teuchos to the list of arguments 
> that you pass to configure.
>
> Thanks to Ross Bartlett for developing this technique and to Heidi 
> Thornquist for proving the attached Makefile.
>
> Please contact me if you have questions.
>
> Jim
>
>------------------------------------------------------------------------
>
>HEADER    = ./
>#
># Include Trilinos header that defines pertinent compilation information
>#
>#include /location/SERIAL_INTEL/include/trilinos_make_macros.mak
>#include /location/SERIAL_GNU/include/trilinos_make_macros.mak
>include /location/LAM/include/trilinos_make_macros.mak
>#
># Linear algebra object libraries
>#
>OLIBS = $(LAPACK_LIBS) $(BLAS_LIBS)
>#
># Compilation rules
>#
>.c.o:
>	$(CC) $(CFLAGS) -c $(DEFS) $<
>
>.cpp.o:
>	$(CXX) $(CPPFLAGS) -c $(DEFS) -I$(prefix)/include $<
>
>all : RBGen.x
>
>RBGen.x : RBGen.o RBGenParams.o BurkardtFileIOHandler.o
netCDFFileIOHandler.o
>	$(CXX) $(CXXFLAGS) -o $@ $^ -L$(prefix)/lib -lnetcdf -lepetra
-lteuchos $(OLIBS) $(FLIBS)
>
>example.x : example.o
>	$(CXX) $(CXXFLAGS) -o $@ $^ -L$(prefix)/lib -lnetcdf -lepetra
-lteuchos $(OLIBS) $(FLIBS)
>
>RBGenParams.o : RBGenParams.cpp 
>
>BurkardtFileIOHandler.o : BurkardtFileIOHandler.cpp
>
>netCDFFileIOHandler.o : netCDFFileIOHandler.cpp
>
>example.o : example.cpp
>
>clean: 
>	/bin/rm -f *.o core
>
>cleanall:
>	/bin/rm -f *.o *.x core
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Trilinos-Users mailing list
>Trilinos-Users at software.sandia.gov
>http://software.sandia.gov/mailman/listinfo/trilinos-users
>  
>


-- 
==================================
Roger P. Pawlowski
Sandia National Laboratories
Dept. 9233, Computational Sciences
P.O. Box 5800, Mail Stop 0316
Albuquerque, NM 87185-0316
Work: (505) 284-3740
Fax:  (505) 284-5451 
email: rppawlo at sandia.gov
==================================




More information about the Trilinos-Users mailing list