File: z70.html

package info (click to toggle)
ebook-dev-ggad 199908-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,264 kB
  • ctags: 1,163
  • sloc: sh: 44; makefile: 35
file content (345 lines) | stat: -rw-r--r-- 12,624 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
  <head>
    <title>
      Makefile.am
    </title>
    <meta name="GENERATOR" content=
    "Modular DocBook HTML Stylesheet Version 1.45">
    <link rel="HOME" title="GTK+ / Gnome Application Development"
    href="ggad.html">
    <link rel="UP" title="Creating Your Source Tree" href= 
    "cha-source.html">
    <link rel="PREVIOUS" title="configure.in" href="z69.html">
    <link rel="NEXT" title="Relevant GNU Documentation" href= 
    "z71.html">
  </head>
  <body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink= 
  "#840084" alink="#0000FF">
    <div class="NAVHEADER">
      <table width="100%" border="0" bgcolor="#ffffff" cellpadding= 
      "1" cellspacing="0">
        <tr>
          <th colspan="4" align="center">
            <font color="#000000" size="2">GTK+ / Gnome Application
            Development</font>
          </th>
        </tr>
        <tr>
          <td width="25%" bgcolor="#ffffff" align="left">
            <a href="z69.html"><font color="#0000ff" size="2"><b>
            &lt;&lt;&lt; Previous</b></font></a>
          </td>
          <td width="25%" colspan="2" bgcolor="#ffffff" align= 
          "center">
            <font color="#0000ff" size="2"><b><a href="ggad.html">
            <font color="#0000ff" size="2"><b>
            Home</b></font></a></b></font>
          </td>
          <td width="25%" bgcolor="#ffffff" align="right">
            <a href="z71.html"><font color="#0000ff" size="2"><b>
            Next &gt;&gt;&gt;</b></font></a>
          </td>
        </tr>
      </table>
    </div>
    <div class="SECT1">
      <h1 class="SECT1">
        <a name="Z70"><tt class="FILENAME">Makefile.am</tt></a>
      </h1>
      <p>
        <tt class="APPLICATION">automake</tt> processes <tt class= 
        "FILENAME">Makefile.am</tt> to produce a
        standards-compliant <tt class="FILENAME">Makefile.in</tt>.
        <tt class="APPLICATION">automake</tt> does a lot of work
        for you: it keeps up with dependencies between source
        files, for example. It creates all the standard targets,
        such as <tt class="APPLICATION">install</tt> and <tt class= 
        "APPLICATION">clean</tt>. It also creates more complex
        targets: simply typing <tt class="APPLICATION">make
        dist</tt> creates a standard <tt class="APPLICATION">
        .tar.gz</tt> file if your <tt class="FILENAME">
        Makefile.am</tt> is correct.
      </p>
      <p>
        The <tt class="FILENAME">Makefile.am</tt> in the top source
        directory is generally very simple; here is an example:
      </p>
      <table border="0" bgcolor="#E0E0E0" width="100%">
        <tr>
          <td>
<pre class="PROGRAMLISTING">
&#13;SUBDIRS = macros po intl src pixmaps doc

## We dist autogen.sh since this is an example program
## Real-world programs do not need to distribute autogen.sh
EXTRA_DIST = \
        gnome-hello.desktop \
    autogen.sh

Applicationsdir = $(datadir)/gnome/apps/Applications
Applications_DATA = gnome-hello.desktop
&#13;
</pre>
          </td>
        </tr>
      </table>
      <p>
        The <tt class="APPLICATION">SUBDIRS</tt> line instructs <tt
        class="APPLICATION">automake</tt> to recursively look for
        <tt class="APPLICATION">Makefile.am</tt> files in the given
        subdirectories. (<a href="z72.html#SEC-.DESKTOP">the
        section called <i><tt class="APPLICATION">.desktop</tt>
        Entries</i></a> describes the remainder of the file, ignore
        it for now.) The <tt class="FILENAME">Makefile.am</tt> in
        the <tt class="FILENAME">src</tt> directory is a little
        more interesting:
      </p>
      <table border="0" bgcolor="#E0E0E0" width="100%">
        <tr>
          <td>
<pre class="PROGRAMLISTING">
&#13;
INCLUDES = -I$(top_srcdir) -I$(includedir) $(GNOME_INCLUDEDIR) \
         -DG_LOG_DOMAIN=\"GnomeHello\" -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
    -I../intl -I$(top_srcdir)/intl

bin_PROGRAMS = gnome-hello

gnome_hello_SOURCES =         \
        app.c           \
        hello.c         \
        menus.c     \
    app.h       \
    hello.h     \
    menus.h

gnome_hello_LDADD = $(GNOMEUI_LIBS) $(GNOME_LIBDIR) $(INTLLIBS)
&#13;
</pre>
          </td>
        </tr>
      </table>
      <p>
        <tt class="APPLICATION">automake</tt> understands a number
        of "magic variables" and can use them to create <tt class= 
        "APPLICATION">Makefile.in</tt>. In the small example above,
        the following variables are used:
      </p>
      <ul>
        <li>
          <p>
            <tt class="APPLICATION">INCLUDES</tt> specifies flags
            to pass to the C compiler during the compile phase (as
            opposed to the link phase). The variables used in this
            line come from the <tt class="FILENAME">
            configure.in</tt> shown in the previous section. &#13;
          </p>
        </li>
        <li>
          <p>
            <tt class="APPLICATION">bin_PROGRAMS</tt> lists the
            programs to be compiled.&#13;
          </p>
        </li>
        <li>
          <p>
            <tt class="APPLICATION">hello_SOURCES</tt> lists the
            files to be compiled and linked to create the program
            called <tt class="APPLICATION">hello</tt>; <tt class= 
            "APPLICATION">hello</tt> must be listed in <tt class= 
            "APPLICATION">bin_PROGRAMS</tt>. All files in this
            variable are automatically included in the
            distribution. &#13;
          </p>
        </li>
        <li>
          <p>
            <tt class="APPLICATION">hello_LDADD</tt> lists flags to
            be passed to the linker. In this case, Gnome library
            flags determined by <tt class="FILENAME">
            configure</tt>.&#13;
          </p>
        </li>
      </ul>
      <p>
        Several elements of the <tt class="APPLICATION">
        INCLUDES</tt> line should be used in all Gnome programs.
        <tt class="APPLICATION">G_LOG_DOMAIN</tt> should always be
        defined; error messages from checks and assertions will
        report this value, so you can determine where the error
        occurred (in your code, or in a library). <tt class= 
        "APPLICATION">GNOMELOCALEDIR</tt> is used to locate
        translation files. The <tt class="APPLICATION">intl</tt>
        directory is added to the header search path so the
        application can find the <tt class="APPLICATION">intl</tt>
        headers.
      </p>
      <p>
        There are many more complex things one can do in <tt class= 
        "FILENAME">Makefile.am</tt>; in particular, you can add <tt
        class="APPLICATION">@</tt>-bounded variables to be
        substituted by <tt class="FILENAME">configure</tt>, you can
        conditionally include portions of the <tt class="FILENAME">
        Makefile</tt> based on <tt class="FILENAME">configure</tt>
        checks, and you can build libraries. The <tt class= 
        "APPLICATION">automake</tt> manual gives more details.
      </p>
      <p>
        <a href="z70.html#TAB-MAKETARGETS">Table 1</a> summarizes
        the most interesting targets generated by <tt class= 
        "APPLICATION">automake</tt>. Of course the default target
        is <tt class="APPLICATION">all</tt>, which compiles the
        program. The GNU Coding Standards (<a href= 
        "http://www.gnu.org/prep/standards_toc.html" target=
        "_top">http://www.gnu.org/prep/standards_toc.html</a>) have
        more information about these targets and GNU makefiles in
        general.
      </p>
      <div class="TABLE">
        <a name="TAB-MAKETARGETS"></a>
        <p>
          <b>Table 1. Standard <tt class="FILENAME">make</tt>
          targets</b>
        </p>
        <table border="1" bgcolor="#E0E0E0" cellspacing="0"
        cellpadding="4" class="CALSTABLE">
          <tr>
            <th align="LEFT" valign="TOP">
              Target
            </th>
            <th align="LEFT" valign="TOP">
              Description
            </th>
          </tr>
          <tr>
            <td align="LEFT" valign="TOP">
              <tt class="APPLICATION">dist</tt>
            </td>
            <td align="LEFT" valign="TOP">
              Builds a tarball (<tt class=
              "APPLICATION">.tar.gz</tt>) for distribution
            </td>
          </tr>
          <tr>
            <td align="LEFT" valign="TOP">
              <tt class="APPLICATION">distcheck</tt>
            </td>
            <td align="LEFT" valign="TOP">
              Builds a tarball, then tries to compile it
            </td>
          </tr>
          <tr>
            <td align="LEFT" valign="TOP">
              <tt class="APPLICATION">clean</tt>
            </td>
            <td align="LEFT" valign="TOP">
              Deletes the results of compilation (object files and
              executables), but may not delete some generated files
              that come with the distribution.
            </td>
          </tr>
          <tr>
            <td align="LEFT" valign="TOP">
              <tt class="APPLICATION">install</tt>
            </td>
            <td align="LEFT" valign="TOP">
              Creates installation directories if needed, and
              copies the software into them.
            </td>
          </tr>
          <tr>
            <td align="LEFT" valign="TOP">
              <tt class="APPLICATION">uninstall</tt>
            </td>
            <td align="LEFT" valign="TOP">
              Reverses the install (deletes installed files).
            </td>
          </tr>
          <tr>
            <td align="LEFT" valign="TOP">
              <tt class="APPLICATION">distclean</tt>
            </td>
            <td align="LEFT" valign="TOP">
              Reverse the effects of the <tt class="APPLICATION">
              configure</tt> script and the <tt class=
              "APPLICATION">all</tt> target; that is, revert a
              tarball to its pristine state.
            </td>
          </tr>
          <tr>
            <td align="LEFT" valign="TOP">
              <tt class="APPLICATION">mostlyclean</tt>
            </td>
            <td align="LEFT" valign="TOP">
              Nearly the same as <tt class="APPLICATION">
              clean</tt>, but leaves some object files that most
              likely don't need to be rebuilt.
            </td>
          </tr>
          <tr>
            <td align="LEFT" valign="TOP">
              <tt class="APPLICATION">maintainer-clean</tt>
            </td>
            <td align="LEFT" valign="TOP">
              More thorough than <tt class="APPLICATION">
              clean</tt>; may delete some files that require
              special tools to rebuild, such as machine-generated
              source code.
            </td>
          </tr>
          <tr>
            <td align="LEFT" valign="TOP">
              <tt class="APPLICATION">TAGS</tt>
            </td>
            <td align="LEFT" valign="TOP">
              Creates a tag table, for use with Emacs.
            </td>
          </tr>
          <tr>
            <td align="LEFT" valign="TOP">
              <tt class="APPLICATION">check</tt>
            </td>
            <td align="LEFT" valign="TOP">
              Runs a test suite if you have one
            </td>
          </tr>
        </table>
      </div>
    </div>
    <div class="NAVFOOTER">
      <br>
      <br>
      <table width="100%" border="0" bgcolor="#ffffff" cellpadding= 
      "1" cellspacing="0">
        <tr>
          <td width="25%" bgcolor="#ffffff" align="left">
            <a href="z69.html"><font color="#0000ff" size="2"><b>
            &lt;&lt;&lt; Previous</b></font></a>
          </td>
          <td width="25%" colspan="2" bgcolor="#ffffff" align= 
          "center">
            <font color="#0000ff" size="2"><b><a href="ggad.html">
            <font color="#0000ff" size="2"><b>
            Home</b></font></a></b></font>
          </td>
          <td width="25%" bgcolor="#ffffff" align="right">
            <a href="z71.html"><font color="#0000ff" size="2"><b>
            Next &gt;&gt;&gt;</b></font></a>
          </td>
        </tr>
        <tr>
          <td colspan="2" align="left">
            <font color="#000000" size="2"><b><tt class="FILENAME">
            configure.in</tt></b></font>
          </td>
          <td colspan="2" align="right">
            <font color="#000000" size="2"><b>Relevant GNU
            Documentation</b></font>
          </td>
        </tr>
      </table>
    </div>
  </body>
</html>