File: node2.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 (115 lines) | stat: -rw-r--r-- 3,629 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
<!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>A First Tool</TITLE>
<META NAME="description" CONTENT="A First Tool">
<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="node3.html">
<LINK REL="previous" HREF="node1.html">
<LINK REL="up" HREF="WritingMakefiles.html">
<LINK REL="next" HREF="node3.html">
</HEAD>

<BODY >
<B> Next:</B> <A NAME="tex2html34"
  HREF="node3.html">Enabling Debugging</A>
<B>Up:</B> <A NAME="tex2html32"
  HREF="WritingMakefiles.html">Writing GNUstep Makefiles</A>
<B> Previous:</B> <A NAME="tex2html26"
  HREF="node1.html">What is it</A>
<BR> <P>

<!--End of Navigation Panel-->

<H1><A NAME="SECTION00020000000000000000">
A First Tool</A>
</H1>
Let's try it out by making a little command line tool using 
the GNUstep make package.  Let's start by creating a directory 
to hold our project.  In this directory, type the following 
extremely simple program in a file called say <TT>source.m</TT>.
<PRE>
#import &lt;Foundation/Foundation.h&gt;

int
main (void)
{ 
  NSLog (@"Executing");
  return 0;
}
</PRE>
The function <TT>NSLog</TT> simply outputs the string to 
<TT>stderr</TT>, flushing the output before continuing. 
To compile this little program as a command line tool 
called <TT>LogTest</TT>, add in the same directory a file 
called <TT>GNUmakefile</TT>, with the following contents: 
<PRE>
include $(GNUSTEP_MAKEFILES)/common.make

TOOL_NAME = LogTest
LogTest_OBJC_FILES = source.m

include $(GNUSTEP_MAKEFILES)/tool.make
</PRE>
And that's it.
At this point, you have all the usual standard GNU make options: 
typically make, make clean, make install, make distclean.  
For example, typing <TT>make</TT> in the project directory 
should compile our little tool. 
It should create a single executable <TT>LogTest</TT>, and 
put it in the subdirectory 
<PRE>
shared_obj/ix86/linux-gnu/gnu-gnu-gnu-xgps
</PRE>
(or in a similar one, according to your system).  To install the tool,
simply type <TT>make install</TT>; you usually need to be root to
install the tool on a system directory.  If you want to have it
installed in your own user GNUstep directory (eg,
<TT>/home/nicola/GNUstep</TT>), which doesn't require you to be root
and could be a better place for testing, you just need to add the line 
<PRE>
GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_USER_ROOT)
</PRE>
after including <TT>common.make</TT>, as follows: 
<PRE>
include $(GNUSTEP_MAKEFILES)/common.make
GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_USER_ROOT)

TOOL_NAME = LogTest
LogTest_OBJC_FILES = source.m

include $(GNUSTEP_MAKEFILES)/tool.make
</PRE>
  I usually do this when testing my own code and programs, and it is
very handy.

<P>
<HR><B> Next:</B> <A NAME="tex2html34"
  HREF="node3.html">Enabling Debugging</A>
<B>Up:</B> <A NAME="tex2html32"
  HREF="WritingMakefiles.html">Writing GNUstep Makefiles</A>
<B> Previous:</B> <A NAME="tex2html26"
  HREF="node1.html">What is it</A>

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