File: node6.html

package info (click to toggle)
gnustep-tutorial 1.0-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 772 kB
  • ctags: 194
  • sloc: makefile: 46; perl: 6
file content (134 lines) | stat: -rw-r--r-- 4,422 bytes parent folder | download
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<!--Converted with LaTeX2HTML 99.2beta8 (1.43)
original version by:  Nikos Drakos, CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>Preamble and Postamble</TITLE>
<META NAME="description" CONTENT="Preamble and Postamble">
<META NAME="keywords" CONTENT="WritingMakefiles">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="LaTeX2HTML v99.2beta8">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">

<LINK REL="STYLESHEET" HREF="WritingMakefiles.css">

<LINK REL="next" HREF="node7.html">
<LINK REL="previous" HREF="node5.html">
<LINK REL="up" HREF="WritingMakefiles.html">
<LINK REL="next" HREF="node7.html">
</HEAD>

<BODY >
<B> Next:</B> <A NAME="tex2html74"
  HREF="node7.html">Further Reading</A>
<B>Up:</B> <A NAME="tex2html72"
  HREF="WritingMakefiles.html">Writing GNUstep Makefiles</A>
<B> Previous:</B> <A NAME="tex2html66"
  HREF="node5.html">Debugging an Application</A>
<BR> <P>

<!--End of Navigation Panel-->

<H1><A NAME="SECTION00060000000000000000">
Preamble and Postamble</A>
</H1>
You may happen to need to pass additional flags to the compiler (in
order to link with additional libraries, for example) or to be willing
to perform some additional actions after compilation or installation.  
The standard way of doing this is as follows: add a file called 
<TT>GNUmakefile.preamble</TT> to your project directory.  An example 
of a <TT>GNUmakefile.preamble</TT> is the following: 
<PRE>
ADDITIONAL_OBJCFLAGS += -Wall
</PRE>
This simply adds the <TT>-Wall</TT> flag when compiling (by the way, 
it is good practice to always use this flag).  In general, you would 
use a <TT>GNUmakefile.preamble</TT> to add any additional flags you need 
(to tell the compiler/linker to search additional directories 
upon compiling/linking, to link with additional libraries, etc). 

<P>
Now, you would want your <TT>GNUmakefile</TT> to include the contents
of your <TT>GNUmakefile.preamble</TT> before any processing.  This is
usually done as follows:
<PRE>
include $(GNUSTEP_MAKEFILES)/common.make

APP_NAME = PanelTest
PanelTest_OBJC_FILES = source.m

include GNUmakefile.preamble
include $(GNUSTEP_MAKEFILES)/application.make
</PRE>

<P>
The most important thing to notice is that the
<TT>GNUmakefile.preamble</TT> is included <I>before</I> 
<TT>application.make</TT>.  That is why is called a preamble.

<P>
Sometimes you also see people using 
<PRE>
-include GNUmakefile.preamble
</PRE>
(with a hyphen, <TT>-</TT>, prepended).  The hyphen before
<TT>include</TT> tells the make tool not to complain if the file
<TT>GNUmakefile.preamble</TT> is not found.  If you want to make sure
that the <TT>GNUmakefile.preamble</TT> is included, you should better
not use the hyphen.

<P>
If you want to perform any special operation after the GNUmakefile
package has done its work, you usually put them in a
<TT>GNUmakefile.postamble</TT> file.  The
<TT>GNUmakefile.postamble</TT> is included <I>after</I>
<TT>application.make</TT>; that is why is called a postamble:
<PRE>
include $(GNUSTEP_MAKEFILES)/common.make

APP_NAME = PanelTest
PanelTest_OBJC_FILES = source.m

include GNUmakefile.preamble
include $(GNUSTEP_MAKEFILES)/application.make
include GNUmakefile.postamble
</PRE>

<P>
Here is a concrete example of a <TT>GNUmakefile.postamble</TT>: 
<PRE>
after-install::
        $(MKDIRS) /home/nicola/Tools; \
        cd $(GNUSTEP_OBJ_DIR); \
        $(INSTALL) myTool /home/nicola/Tools;
</PRE>
(make sure you start each indented line with <TT>TAB</TT>).  This will
install the tool <TT>myTool</TT> in the directory
<TT>/home/nicola/Tools</TT> after compilation.  

<P>
You rarely need to use <TT>GNUmakefile.postamble</TT>s, and they were 
mentioned mainly to give you a complete picture.

<P>
<HR><B> Next:</B> <A NAME="tex2html74"
  HREF="node7.html">Further Reading</A>
<B>Up:</B> <A NAME="tex2html72"
  HREF="WritingMakefiles.html">Writing GNUstep Makefiles</A>
<B> Previous:</B> <A NAME="tex2html66"
  HREF="node5.html">Debugging an Application</A>

<!--End of Navigation Panel-->
<ADDRESS>
Nicola Pero
2000-10-12
</ADDRESS>
</BODY>
</HTML>