Home | Hand Evaluation in Bridge | C Programming | Keyboard Layout |
C Project BuildingThe goal is to simplify the building and compiling of projects. This is accomplished through a standard layout of the files and a standard for a build script. Library ProjectsThe goal of a library project is to produce a library file and its header files.
The initial contents of the project directory
consists of source files (
To build the C archive, change your current directory to the
project directory, and execute a conformant build
script. This should should first create a library
Secondly, the build script should assemble the library and the header
files under into a tar archive. This archive will be called a C archive, and should have the file
extension $ tar tf org_pvv_hakonhal.car lib/liborg_pvv_hakonhal.a src/org/pvv/hakonhal/utils/ip.h src/org/pvv/hakonhal/system/net.h
An implementation may also choose to make the C archives compressed
with bzip2 ( The Structure of the Source Directory
It is possible and recommended that you put the code in a
directory structure below the source directory. For instance
if we are producing utility functions and socket routines, we put the
code under
Code in such a directory structure should generally refer to
other header files using the Fully Quallified Name, which is
the pathname relative the #include "org/pvv/hakonhal/utils/ip.h" or #include "ip.h"
All source files under Third Party's C Archives
When you are using third party C archives, copy them to the
Under the hood, the build script
might unpack a C archive $ find cars/ -type f cars/com_hotmail_arneolav_utils.car.bz2 cars/com_hotmail_arneolav_utils/lib/libcom_hotmail_arneolav_utils.a cars/com_hotmail_arneolav_utils/src/com/hotmail/arneolav/utils/io.h Customizing the Build
If the user chooses to, (s)he can define a makefile
.Makefile.g.src: CC=gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wunused -Werror -g CFLAGS=-Isrc/ -Icars/com_hotmail_arneolav_utils/src -include Makefile.user all: org_pvv_hakonhal.car.bz2
So if the user uses the math library, (s)he should create the
Makefile.user: LDLIBS+=-lm Projects with Executables
A project that wants to produce executables is supposed to be split
into a library project plus
one source file (
The program source files should be put under the The build script must ensure that all C archives' header files are included in the header search path, and ensure that all C archives' libraries are included when linking. For instance, if we got the following files: $ find . -type f -o -type l ./cars/com_hotmail_arneolav_utils.car.bz2 ./psrc/get.c ./src/org/pvv/hakonhal/utils/ip.c ./src/org/pvv/hakonhal/utils/ip.h ./src/org/pvv/hakonhal/system/net.c ./src/org/pvv/hakonhal/system/net.h
#include "org/pvv/hakonhal/system/net.h" #include "org/pvv/hakonhal/utils/ip.h" #include "com/hotmail/arneolav/utils/io.h"
Running a conformant build script builds the library
BugsThe following could become better:
|
Home | Hand Evaluation in Bridge | C Programming | Keyboard Layout |
Håkon Hallingstad |