Debian Codegraph @

commonTools/importing/Export_Makefile.example

raw
1 # CMAKE File for "MyApp" application building against an installed Trilinos
2
3 #This file is an adaptation of the CMakeLists.txt file that was converted from
4 #the buildAgainstTrilinos example. This Makefile was designed to be used in a
5 #flat directory structure. If you would like to run this example you will need
6 #put this file and src_file.cpp, src_file.hpp, main_file.cpp from
7 #buildAgainstTrilinos into a new directory. You will then need to set the
8 #environment variable MYAPP_TRILINOS_DIR to point to your base installation of
9 #Trilinos. Note that this example assumes that the installation of Trilinos that
10 #you point to has Epetra enabled.
11
12 # Get Trilinos as one entity
13 include $(MYAPP_TRILINOS_DIR)/include/Makefile.export.Trilinos
14
15 # Make sure to use same compilers and flags as Trilinos
16 CXX=$(Trilinos_CXX_COMPILER)
17 CC=$(Trilinos_C_COMPILER)
18 FORT=$(Trilinos_Fortran_COMPILER)
19
20 CXX_FLAGS=$(Trilinos_CXX_COMPILER_FLAGS) $(USER_CXX_FLAGS)
21 C_FLAGS=$(Trilinos_C_COMPILER_FLAGS) $(USERC_FLAGS)
22 FORT_FLAGS=$(Trilinos_Fortran_COMPILER_FLAGS) $(USER_FORT_FLAGS)
23
24 INCLUDE_DIRS=$(Trilinos_INCLUDE_DIRS) $(Trilinos_TPL_INCLUDE_DIRS)
25 LIBRARY_DIRS=$(Trilinos_LIBRARY_DIRS) $(Trilinos_TPL_LIBRARY_DIRS)
26 LIBRARIES=$(Trilinos_LIBRARIES) $(Trilinos_TPL_LIBRARIES)
27
28 LINK_FLAGS=$(Trilinos_EXTRA_LD_FLAGS)
29
30 #just assuming that epetra is turned on.
31 DEFINES=-DMYAPP_EPETRA
32
33
34 default: print_info MyApp.exe
35
36 # Echo trilinos build info just for fun
37 print_info:
38 @echo "\nFound Trilinos! Here are the details: "
39 @echo " Trilinos_VERSION = $(Trilinos_VERSION)"
40 @echo " Trilinos_PACKAGE_LIST = $(Trilinos_PACKAGE_LIST)"
41 @echo " Trilinos_LIBRARIES = $(Trilinos_LIBRARIES)"
42 @echo " Trilinos_INCLUDE_DIRS = $(Trilinos_INCLUDE_DIRS)"
43 @echo " Trilinos_LIBRARY_DIRS = $(Trilinos_LIBRARY_DIRS)"
44 @echo " Trilinos_TPL_LIST = $(Trilinos_TPL_LIST)"
45 @echo " Trilinos_TPL_INCLUDE_DIRS = $(Trilinos_TPL_INCLUDE_DIRS)"
46 @echo " Trilinos_TPL_LIBRARIES = $(Trilinos_TPL_LIBRARIES)"
47 @echo " Trilinos_TPL_LIBRARY_DIRS = $(Trilinos_TPL_LIBRARY_DIRS)"
48 @echo " Trilinos_BUILD_SHARED_LIBS = $(Trilinos_BUILD_SHARED_LIBS)"
49 @echo "End of Trilinos details\n"
50
51 # run the given test
52 test: MyApp.exe input.xml
53 ./MyApp.exe
54
55 # build the
56 MyApp.exe: libmyappLib.a
57 $(CXX) $(CXX_FLAGS) libMyappLib.a main_file.cpp -o MyApp.exe $(LINK_FLAGS) $(INCLUDE_DIRS) $(DEFINES) $(LIBRARY_DIRS) $(LIBRARIES)
58
59 libmyappLib.a: src_file.o
60 $(Trilinos_AR) cr libmyappLib.a src_file.o
61
62 src_file.o:
63 $(CXX) -c $(CXX_FLAGS) $(INCLUDE_DIRS) $(DEFINES) src_file.cpp
64
65 .PHONY: clean
66 clean:
67 rm -f *.o *.a *.exe