1 | // $Id: build_tool.doxygen 1486 2008-09-09 21:17:19Z jari $ |
---|
2 | // |
---|
3 | // Copyright (C) 2008 Peter Johansson |
---|
4 | // |
---|
5 | // This file is part of the yat library, http://dev.thep.lu.se/yat |
---|
6 | // |
---|
7 | // The yat library is free software; you can redistribute it and/or |
---|
8 | // modify it under the terms of the GNU General Public License as |
---|
9 | // published by the Free Software Foundation; either version 3 of the |
---|
10 | // License, or (at your option) any later version. |
---|
11 | // |
---|
12 | // The yat library is distributed in the hope that it will be useful, |
---|
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
15 | // General Public License for more details. |
---|
16 | // |
---|
17 | // You should have received a copy of the GNU General Public License |
---|
18 | // along with this program; if not, write to the Free Software |
---|
19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
20 | // 02111-1307, USA. |
---|
21 | |
---|
22 | |
---|
23 | /** |
---|
24 | \page build_tool Build Tools |
---|
25 | |
---|
26 | \section yat-config |
---|
27 | |
---|
28 | The \c yat-config script provides information on the local version of |
---|
29 | the library. For instance the following command shows that yat was |
---|
30 | installed at prefix \c `/usr/local' |
---|
31 | |
---|
32 | \verbatim |
---|
33 | #> yat-config --prefix |
---|
34 | /usr/local |
---|
35 | \endverbatim |
---|
36 | |
---|
37 | This information can then be used in a Makefile, for example, as follows: |
---|
38 | |
---|
39 | \verbatim |
---|
40 | BIN=foo |
---|
41 | SRC=$(BIN).cc |
---|
42 | OBJECTS=$(SRC:.cc=.o) |
---|
43 | |
---|
44 | CPPFLAGS+=`yat-config --cppflags` |
---|
45 | CXXFLAGS+=`yat-config --cxxflags` |
---|
46 | LDFLAGS+=`yat-config --ldflags` |
---|
47 | LIBS+=`yat-config --libs` |
---|
48 | |
---|
49 | all: $(BIN) |
---|
50 | |
---|
51 | $(BIN): $(OBJECTS) |
---|
52 | $(CXX) $(LDFLAGS) $(OBJECTS) -o $(BIN) $(LIBS) |
---|
53 | |
---|
54 | .cc.o: |
---|
55 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@ |
---|
56 | |
---|
57 | clean:; rm -f $(OBJECTS) $(BIN) |
---|
58 | \endverbatim |
---|
59 | |
---|
60 | For further information on yat-config use \c `yat-config \c --help' |
---|
61 | |
---|
62 | \section macro Autoconf Macro |
---|
63 | |
---|
64 | For applications using autoconf there is a macro available in \c |
---|
65 | yat.m4. The macro can be called from your \c configure.ac: |
---|
66 | |
---|
67 | \verbatim |
---|
68 | YAT_CHECK_YAT([minimum-version], [action-if-found],[action-if-not-found]) |
---|
69 | \endverbatim |
---|
70 | |
---|
71 | The argument minimum-version should be the number (\c MAJOR.MINOR or |
---|
72 | \c MAJOR.MINOR.PATCH) of the version you require. If yat header files |
---|
73 | and library are not found or the version is not new enough, macro will |
---|
74 | complain and execute shell command \c action-if-not-found. A suitable |
---|
75 | \c action-if-not-found could be |
---|
76 | |
---|
77 | \verbatim |
---|
78 | AC_MSG_ERROR([could not find required version of yat]) |
---|
79 | \endverbatim |
---|
80 | |
---|
81 | If the test is successful, \c HAVE_YAT is defined and \c |
---|
82 | action-if-found is executed. The test calls \c yat-config and sets |
---|
83 | variables \c YAT_CPPFLAGS, \c YAT_CXXFLAGS, \c YAT_LDFLAGS, \c |
---|
84 | YAT_LIBS, and \c YAT_LA_FILE. These flags can then be used in the \c |
---|
85 | Makefile.am. For instance: |
---|
86 | |
---|
87 | \verbatim |
---|
88 | AM_CPPFLAGS = $(YAT_CPPFLAGS) |
---|
89 | AM_CXXFLAGS = $(YAT_CXXFLAGS) |
---|
90 | AM_LDFLAGS = $(YAT_LDFLAGS) |
---|
91 | LDADD = $(YAT_LIBS) |
---|
92 | \endverbatim |
---|
93 | |
---|
94 | or when using libtool you could use \c YAT_LA_FILE: |
---|
95 | |
---|
96 | \verbatim |
---|
97 | AM_CPPFLAGS = $(YAT_CPPFLAGS) |
---|
98 | AM_CXXFLAGS = $(YAT_CXXFLAGS) |
---|
99 | LDADD = $(YAT_LA_FILE) |
---|
100 | \endverbatim |
---|
101 | |
---|
102 | If you have yat installed with a different prefix than aclocal, for |
---|
103 | example, if yat is installed in prefix \c /usr/local and aclocal is |
---|
104 | located in /usr/bin, then you need to tell aclocal (or autoreconf) |
---|
105 | where to look for \c yat.m4 |
---|
106 | |
---|
107 | \verbatim |
---|
108 | #> aclocal -I /usr/local/share/aclocal |
---|
109 | \endverbatim |
---|
110 | |
---|
111 | */ |
---|
112 | |
---|