Go to TogaWare.com Home Page. GNU/Linux Desktop Survival Guide
by Graham Williams
Duck Duck Go

Building the C Code


Once you have your basic user interface constructed tell Glade to save the project (using the Save button--this updates the file that contains the XML description of the interface) and then to build the project (using the Build button).

Start up a terminal window, such as the gnome-terminal, and change to the project directory. There you should see an executable file called autogen.sh. This shell script takes care of the initial configuration of your package, running automake to automatically generate the appropriate support files for the configuration. It also runs the appropriate automake components leaving you with a collection of Makefiles.

$ cd Projects/gword
$ ./autogen.sh
**Warning**: I am going to run `configure' with no arguments. 
If you wish to pass any to it, please specify them on the
`./autogen.sh' command line. 

processing . 
deletefiles is 
Creating ./aclocal.m4 ... 
Running gettextize...  Ignore non-fatal messages. 
You should update your own `aclocal.m4' by adding the necessary
macro packages gettext.m4, lcmessage.m4 and progtest.m4 from
the directory `/aclocal'
Making ./aclocal.m4 writable ... 
Running aclocal  -I macros ... 
Running autoheader... 


creating Makefile
creating macros/Makefile
creating src/Makefile
creating intl/Makefile
creating po/Makefile.in
creating config.h
Now type `make' to compile the package.

You can now simply run the make command to perform the compilation (making use of the generated Makefiles). Once completed, run the command src/gword to start up your application.

$ make
$ src/gword

And that's all there is to it.

The first time you build the project all of the necessary files and sub-directories are created. From then on each time you build only the relevant files that need to be changed as a result of changes in the interface are modified.

Glade generates all the necessary files to be GNU compliant and to essentially run your application immediately (although without any callbacks the application won't do much). The primary location for your C source code is in a subdirectory called src. In there you will see 3 header files (support.h, interface.h, and callbacks.h) and 4 source files (support.c, interface.c, callbacks.c, and main.c). Of these you should never edit support.h, support.c, interface.h, and interface.c. The first pair contain code that Glade supplies to support your application and the latter two are the actual interface code. Glade manages these files. You will be making changes primarily in callbacks.c to add the code for each callback. Glade will add new callbacks to the bottom of callbacks.h and callbacks.c.

Now that you have built your interface (perhaps without any callback code just yet) you are in a position to configure, compile and run your application. The GNU automake and autoconf packages are used to simplify the management of the configuration, compilation, and installation of your application. These packages are a great help in the task of managing software projects.

Discuss the files generated by the build and how they conform to the GNU Standards.

Now on to the code to actually do the word count and the appropriate callbacks.

To recompile we simply run make again, either directly in the src directory or else in the gword directory.

Describe the make dist and make dist-check functionality.

Copyright © 1995-2018 Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
Brought to you by Togaware and the author of the open source software Rattle and wajig.
Also the author of Data Mining with Rattle and Essentials of Data Science.