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



CLICK HERE TO VISIT THE UPDATED SURVIVAL GUIDE

Building the C Code

Subsections

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 GNU Package Management Tools

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.

Counting the Words

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.

Packaging For Distribution

Describe the make dist and make dist-check functionality.


Support further development by purchasing the PDF version of the book.
Other online resources include the Data Science Desktop Survival Guide.
Books available on Amazon include Data Mining with Rattle and Essentials of Data Science.
Popular open source software includes rattle and wajig.
Hosted by Togaware, a pioneer of free and open source software since 1984.
Copyright © 1995-2020 Togaware Pty Ltd. Creative Commons ShareAlike V4.