1 | // $Id: build_tool.doxygen 2384 2010-12-22 14:03:36Z peter $ |
---|
2 | // |
---|
3 | // Copyright (C) 2008 Jari Häkkinen, Peter Johansson |
---|
4 | // Copyright (C) 2009, 2010 Peter Johansson |
---|
5 | // |
---|
6 | // This file is part of the yat library, http://dev.thep.lu.se/yat |
---|
7 | // |
---|
8 | // The yat library is free software; you can redistribute it and/or |
---|
9 | // modify it under the terms of the GNU General Public License as |
---|
10 | // published by the Free Software Foundation; either version 3 of the |
---|
11 | // License, or (at your option) any later version. |
---|
12 | // |
---|
13 | // The yat library is distributed in the hope that it will be useful, |
---|
14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
16 | // General Public License for more details. |
---|
17 | // |
---|
18 | // You should have received a copy of the GNU General Public License |
---|
19 | // along with yat. If not, see <http://www.gnu.org/licenses/>. |
---|
20 | |
---|
21 | |
---|
22 | /** |
---|
23 | \page build_tool Build Tools |
---|
24 | |
---|
25 | \section yat-config |
---|
26 | |
---|
27 | The \c yat-config script provides information on the local version of |
---|
28 | the library. For instance the following command shows that yat was |
---|
29 | installed at prefix \c `/usr/local' |
---|
30 | |
---|
31 | \verbatim |
---|
32 | #> yat-config --prefix |
---|
33 | /usr/local |
---|
34 | \endverbatim |
---|
35 | |
---|
36 | This information can then be used in a Makefile, for example, as follows: |
---|
37 | |
---|
38 | \verbatim |
---|
39 | BIN=foo |
---|
40 | SRC=$(BIN).cc |
---|
41 | OBJECTS=$(SRC:.cc=.o) |
---|
42 | |
---|
43 | CPPFLAGS+=`yat-config --cppflags` |
---|
44 | CXXFLAGS+=`yat-config --cxxflags` |
---|
45 | LDFLAGS+=`yat-config --ldflags` |
---|
46 | LIBS+=`yat-config --libs` |
---|
47 | |
---|
48 | all: $(BIN) |
---|
49 | |
---|
50 | $(BIN): $(OBJECTS) |
---|
51 | $(CXX) $(LDFLAGS) $(OBJECTS) -o $(BIN) $(LIBS) |
---|
52 | |
---|
53 | .cc.o: |
---|
54 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@ |
---|
55 | |
---|
56 | clean:; rm -f $(OBJECTS) $(BIN) |
---|
57 | \endverbatim |
---|
58 | |
---|
59 | From yat 0.6 an alternative \c CBLAS library can be specified using \c |
---|
60 | YAT_CBLAS_LIB environment variable. By default the \c CBLAS library |
---|
61 | detected during configuration of yat is used. |
---|
62 | |
---|
63 | For further information on yat-config use \c `yat-config \c --help' |
---|
64 | |
---|
65 | \since New in yat 0.5 |
---|
66 | |
---|
67 | \section macro Autoconf Macro |
---|
68 | |
---|
69 | For applications using autoconf there is a macro available in \c |
---|
70 | yat.m4. The macro can be called from your \c configure.ac: |
---|
71 | |
---|
72 | \verbatim |
---|
73 | YAT_CHECK_YAT([minimum-version], [action-if-found], [action-if-not-found]) |
---|
74 | \endverbatim |
---|
75 | |
---|
76 | The argument minimum-version should be the number (\c MAJOR.MINOR or |
---|
77 | \c MAJOR.MINOR.PATCH) of the version you require. If yat header files |
---|
78 | and library are not found or the version is not new enough, macro will |
---|
79 | complain and execute shell command \c action-if-not-found. A suitable |
---|
80 | \c action-if-not-found could be |
---|
81 | |
---|
82 | \verbatim |
---|
83 | AC_MSG_ERROR([could not find required version of yat]) |
---|
84 | \endverbatim |
---|
85 | |
---|
86 | If the test is successful, \c HAVE_YAT is defined and \c |
---|
87 | action-if-found is executed. The test calls \c yat-config and sets |
---|
88 | variables \c YAT_CPPFLAGS, \c YAT_CXXFLAGS, \c YAT_LDFLAGS, \c |
---|
89 | YAT_LIBS, and \c YAT_LA_FILE. These flags can then be used in the \c |
---|
90 | Makefile.am. For instance: |
---|
91 | |
---|
92 | \verbatim |
---|
93 | AM_CPPFLAGS = $(YAT_CPPFLAGS) |
---|
94 | AM_CXXFLAGS = $(YAT_CXXFLAGS) |
---|
95 | AM_LDFLAGS = $(YAT_LDFLAGS) |
---|
96 | LDADD = $(YAT_LIBS) |
---|
97 | \endverbatim |
---|
98 | |
---|
99 | \note this macro assumes that \c yat-config has been installed; \c |
---|
100 | yat-config was introduced in yat \b 0.5 and consequently this macro |
---|
101 | \b does \b not work with yat \b 0.4.x (or older). |
---|
102 | |
---|
103 | */ |
---|
104 | |
---|