75 |
>Create a minimal project, e.g. calc</A |
>Create a minimal project, e.g. calc</A |
76 |
></H1 |
></H1 |
77 |
><P |
><P |
78 |
>In this section you will to start a small project, |
>In this section you will to start a small project, |
79 |
using the sample application calc, which is part of your DejaGnu distribution</P |
using the sample application calc, which is part of your DejaGnu distribution</P |
80 |
><DIV |
><DIV |
81 |
CLASS="SECT2" |
CLASS="SECT2" |
97 |
><TD |
><TD |
98 |
><PRE |
><PRE |
99 |
CLASS="PROGRAMLISTING" |
CLASS="PROGRAMLISTING" |
100 |
>set tool calc |
>set tool calc |
101 |
set srcdir . |
set srcdir . |
102 |
set objdir /home/dgt/dejagnu.test</PRE |
set objdir /home/dgt/dejagnu.test</PRE |
103 |
></TD |
></TD |
104 |
></TR |
></TR |
146 |
></TR |
></TR |
147 |
></TABLE |
></TABLE |
148 |
><P |
><P |
149 |
>autoconf is another part of the auto-tools. |
>autoconf is another part of the auto-tools. |
150 |
Run it to generate configure based on information contained in configure.in.</P |
Run it to generate configure based on information contained in configure.in.</P |
151 |
><TABLE |
><TABLE |
152 |
BORDER="0" |
BORDER="0" |
161 |
></TR |
></TR |
162 |
></TABLE |
></TABLE |
163 |
><P |
><P |
164 |
>autoheader is another part of the auto-tools. |
>autoheader is another part of the auto-tools. |
165 |
Run it to generate calc.h.in. </P |
Run it to generate calc.h.in. </P |
166 |
><TABLE |
><TABLE |
167 |
BORDER="0" |
BORDER="0" |
176 |
></TR |
></TR |
177 |
></TABLE |
></TABLE |
178 |
><P |
><P |
179 |
>The Makefile.am of this example was developed as port of the DejaGnu |
>The Makefile.am of this example was developed as port of the DejaGnu |
180 |
distribution. |
distribution. |
181 |
Adapt Makefile.am for this test. Replace the line |
Adapt Makefile.am for this test. Replace the line |
182 |
“#noinst_PROGRAMS = calc” to |
“#noinst_PROGRAMS = calc” to |
183 |
“bin_PROGRAMS = calc”. |
“bin_PROGRAMS = calc”. |
184 |
Change the RUNTESTDEFAULTFLAGS from |
Change the RUNTESTDEFAULTFLAGS from |
185 |
“$$srcdir/testsuite” to |
“$$srcdir/testsuite” to |
186 |
“./testsuite”.</P |
“./testsuite”.</P |
187 |
><P |
><P |
188 |
>Running automake at this point contains a series of warning in its output as shown in the following example:</P |
>Running automake at this point contains a series of warning in its output as shown in the following example:</P |
204 |
><PRE |
><PRE |
205 |
CLASS="PROGRAMLISTING" |
CLASS="PROGRAMLISTING" |
206 |
>dgt:~/dejagnu.test$ automake --add-missing |
>dgt:~/dejagnu.test$ automake --add-missing |
207 |
automake: configure.in: installing `./install-sh' |
automake: configure.in: installing `./install-sh' |
208 |
automake: configure.in: installing `./mkinstalldirs' |
automake: configure.in: installing `./mkinstalldirs' |
209 |
automake: configure.in: installing `./missing' |
automake: configure.in: installing `./missing' |
210 |
automake: Makefile.am: installing `./INSTALL' |
automake: Makefile.am: installing `./INSTALL' |
211 |
automake: Makefile.am: required file `./NEWS' not found |
automake: Makefile.am: required file `./NEWS' not found |
212 |
automake: Makefile.am: required file `./README' not found |
automake: Makefile.am: required file `./README' not found |
213 |
automake: Makefile.am: installing `./COPYING' |
automake: Makefile.am: installing `./COPYING' |
214 |
automake: Makefile.am: required file `./AUTHORS' not found |
automake: Makefile.am: required file `./AUTHORS' not found |
215 |
automake: Makefile.am: required file `./ChangeLog' not found |
automake: Makefile.am: required file `./ChangeLog' not found |
216 |
configure.in: 4: required file `./calc.h.in' not found |
configure.in: 4: required file `./calc.h.in' not found |
217 |
Makefile.am:6: required directory ./doc does not exist</PRE |
Makefile.am:6: required directory ./doc does not exist</PRE |
218 |
></TD |
></TD |
219 |
></TR |
></TR |
220 |
></TABLE |
></TABLE |
221 |
></DIV |
></DIV |
222 |
><P |
><P |
223 |
>Create a empty directory doc and empty files |
>Create a empty directory doc and empty files |
224 |
INSTALL, NEWS, README, AUTHORS, ChangeLog and COPYING. |
INSTALL, NEWS, README, AUTHORS, ChangeLog and COPYING. |
225 |
The default COPYING will point to the GNU Public License (GPL). |
The default COPYING will point to the GNU Public License (GPL). |
226 |
In a real project it would be time to add some meaningfull text in each file.</P |
In a real project it would be time to add some meaningfull text in each file.</P |
227 |
><P |
><P |
243 |
><TD |
><TD |
244 |
><PRE |
><PRE |
245 |
CLASS="PROGRAMLISTING" |
CLASS="PROGRAMLISTING" |
246 |
>dgt:~/dejagnu.test$ ./configure |
>dgt:~/dejagnu.test$ ./configure |
247 |
creating cache ./config.cache |
creating cache ./config.cache |
248 |
checking whether to enable maintainer-specific portions of Makefiles... no |
checking whether to enable maintainer-specific portions of Makefiles... no |
249 |
checking for a BSD compatible install... /usr/bin/install -c |
checking for a BSD compatible install... /usr/bin/install -c |
250 |
checking whether build environment is sane... yes |
checking whether build environment is sane... yes |
251 |
checking whether make sets ${MAKE}... yes |
checking whether make sets ${MAKE}... yes |
252 |
checking for working aclocal... found |
checking for working aclocal... found |
253 |
checking for working autoconf... found |
checking for working autoconf... found |
254 |
checking for working automake... found |
checking for working automake... found |
255 |
checking for working autoheader... found |
checking for working autoheader... found |
256 |
checking for working makeinfo... found |
checking for working makeinfo... found |
257 |
checking for gcc... gcc checking whether the C compiler (gcc ) works... yes |
checking for gcc... gcc checking whether the C compiler (gcc ) works... yes |
258 |
checking whether the C compiler (gcc ) is a cross-compiler... no |
checking whether the C compiler (gcc ) is a cross-compiler... no |
259 |
checking whether we are using GNU C... yes |
checking whether we are using GNU C... yes |
260 |
checking whether gcc accepts -g... yes |
checking whether gcc accepts -g... yes |
261 |
checking for a BSD compatible install... /usr/bin/install -c |
checking for a BSD compatible install... /usr/bin/install -c |
262 |
checking how to run the C preprocessor... gcc -E |
checking how to run the C preprocessor... gcc -E |
263 |
checking for stdlib.h... yes |
checking for stdlib.h... yes |
264 |
checking for strcmp... yes |
checking for strcmp... yes |
265 |
updating cache ./config.cache |
updating cache ./config.cache |
266 |
creating ./config.status |
creating ./config.status |
267 |
creating Makefile creating calc.h</PRE |
creating Makefile creating calc.h</PRE |
268 |
></TD |
></TD |
269 |
></TR |
></TR |
270 |
></TABLE |
></TABLE |
271 |
></DIV |
></DIV |
272 |
><P |
><P |
273 |
>If you are familiar with GNU software, |
>If you are familiar with GNU software, |
274 |
this output should not contain any surprise to you. |
this output should not contain any surprise to you. |
275 |
Any errors should be easy to fix for such a simple program.</P |
Any errors should be easy to fix for such a simple program.</P |
276 |
><P |
><P |
277 |
>Build the calc executable:</P |
>Build the calc executable:</P |
292 |
><TD |
><TD |
293 |
><PRE |
><PRE |
294 |
CLASS="PROGRAMLISTING" |
CLASS="PROGRAMLISTING" |
295 |
>dgt:~/dejagnu.test$ make |
>dgt:~/dejagnu.test$ make |
296 |
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -c calc.c |
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -c calc.c |
297 |
gcc -g -O2 -o calc calc.o</PRE |
gcc -g -O2 -o calc calc.o</PRE |
298 |
></TD |
></TD |
299 |
></TR |
></TR |
300 |
></TABLE |
></TABLE |
301 |
></DIV |
></DIV |
302 |
><P |
><P |
303 |
>You prepared a few files and then called some commands. |
>You prepared a few files and then called some commands. |
304 |
Respecting the right order assures a automatic and correctly compiled calc program. The following example resumes the correct order.</P |
Respecting the right order assures a automatic and correctly compiled calc program. The following example resumes the correct order.</P |
305 |
><DIV |
><DIV |
306 |
CLASS="EXAMPLE" |
CLASS="EXAMPLE" |
340 |
><TD |
><TD |
341 |
><PRE |
><PRE |
342 |
CLASS="PROGRAMLISTING" |
CLASS="PROGRAMLISTING" |
343 |
>dgt:~/dejagnu.test$ ./calc |
>dgt:~/dejagnu.test$ ./calc |
344 |
calc: version |
calc: version |
345 |
Version: 1.1 |
Version: 1.1 |
346 |
calc:<I |
calc:<I |
347 |
CLASS="EMPHASIS" |
CLASS="EMPHASIS" |
348 |
> </I |
> </I |
349 |
>add 3 4 |
>add 3 4 |
350 |
7 |
7 |
351 |
calc: multiply 3 4<I |
calc: multiply 3 4<I |
352 |
CLASS="EMPHASIS" |
CLASS="EMPHASIS" |
353 |
> </I |
> </I |
354 |
> |
> |
355 |
12 |
12 |
356 |
calc: multiply 2 4<I |
calc: multiply 2 4<I |
357 |
CLASS="EMPHASIS" |
CLASS="EMPHASIS" |
358 |
> </I |
> </I |
359 |
> |
> |
360 |
12 |
12 |
361 |
calc: quit </PRE |
calc: quit </PRE |
362 |
></TD |
></TD |
363 |
></TR |
></TR |
365 |
><P |
><P |
366 |
>Look at the intentional bug that 2 times 4 equals 12.</P |
>Look at the intentional bug that 2 times 4 equals 12.</P |
367 |
><P |
><P |
368 |
>The tests run by DejaGnu need a file called site.exp, |
>The tests run by DejaGnu need a file called site.exp, |
369 |
which is automatically generated if we call “make site.exp”. |
which is automatically generated if we call “make site.exp”. |
370 |
This was the purpose of the “AUTOMAKE_OPTIONS = dejagnu” in Makefile.am.</P |
This was the purpose of the “AUTOMAKE_OPTIONS = dejagnu” in Makefile.am.</P |
371 |
><DIV |
><DIV |
372 |
CLASS="EXAMPLE" |
CLASS="EXAMPLE" |
385 |
><TD |
><TD |
386 |
><PRE |
><PRE |
387 |
CLASS="PROGRAMLISTING" |
CLASS="PROGRAMLISTING" |
388 |
>dgt: make site.exp |
>dgt: make site.exp |
389 |
dgt:~/dejagnu.test$ make site.exp |
dgt:~/dejagnu.test$ make site.exp |
390 |
Making a new site.exp file...</PRE |
Making a new site.exp file...</PRE |
391 |
></TD |
></TD |
392 |
></TR |
></TR |
453 |
></DIV |
></DIV |
454 |
></BODY |
></BODY |
455 |
></HTML |
></HTML |
|
> |
|
456 |
|
> |