This document describes the Makefile file conventions for the
Campcaster
project. See also the generic description of the file
conventions in the Campcaster
project. This document does not describe the mandatory targets for
Makefiles, see the build environment
description for such details.
Makefiles are always named Makefile. In case they are
input files for automake or autoconf, they can be named Makefile.in
or Makefile.am.
Structure
Makefiles are partitioned by using the following 80 column wide
partitioning comment:
#------------------------------------------------------------------------------- # This is the title of the partition #-------------------------------------------------------------------------------
The file has the
following mandatory structure:
Header
General command definitions
Basic directory and file definitions
Configuration parameters
Dependencies
Targets
Specific targets
Pattern rules
Header
The header holds all information mandated by the generic guidelines, but
starting with the Makefile comment character #. Note the
80
column wide partitioning delimiter enclosing the header.
#------------------------------------------------------------------------------- # Copyright (c) 2004 Media Development Loan Fund # # This file is part of the Campcaster project. # https://www.campware.org/ # To report bugs, send an e-mail to [email protected] # # Campcaster is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Campcaster is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Campcaster; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # # Author : $Author: paul $ # Version : $Revision: 2373 $ # Location : $URL: svn://code.campware.org/campcaster/trunk/campcaster/doc/developmentEnvironment/makefileConventions.html $ #-------------------------------------------------------------------------------
General command definitions
This section contains definitions to commands used when executing the
make targets within this Makefile. All the commands should be collected
here, and a variable defined for them. This insures easy overview of
the commands the Makefile uses, and also makes it easy to migrate to
new commands, or the same commands in different locations.
No external commands may be directly referenced outside this section.
Sample
A sample general command definitions section follows.
This section contains definitions for the directories and files
referenced in this Makefile. All directories referenced from the
Makefile, and all external files referenced by the Makefile should be
collected here. This insures easy adoption in case some external
directories or files change.
No directories or external files may be directory referenced outside
this section.
When referencing other Campcaster modules, typically the following
variables are defined for them:
This section contains the parameters passed to the building tools
(compiler, linker, etc.) When invoking building tools, they should be
parametrized by the definitions made here.
Sample
A sample configuration parameters section follows.
The dependencies section lists the objects that are build by implicit
rules, and that main targets depend on. This is the place where all
object files are listed, basically, for each library or executable.
No object files that are built by this Makefile should be directly
referred to outside this section.
This section lists all the explicit, external targets for the makefile.
For a list of targets required, see the description
of the build environment. All targets in this section are marked as
.PHONY, as these targets are not building the files they are named
after.
No explicit targets should be defined in the Makefile outside this
directory.
This section defines the targets for files to be built by the Makefile.
These are the targets that specify how files are built, but are not
covered by pattern rules.