ppmk - makefile preprocessor
ppmk [ -o Makefile] Makefile.pp
ppmk is used to generate makefiles for building Agents. The input file, usually
called Makefile.pp, is platform independent and usually much shorter than the Makefile that it generates.
To process the input file, ppmk uses the pp processor. pp
copies text from the input to the output file, performing special
processing whenever it encounters a @
character. For a full description of the syntax, see the documentation of pp.
If no output file is specified with the -o option, ppmk writes the generated makefile to stdout.
The following functions are used to supply information about the targets
that the generated makefile is to contain.
- @TARGETS(target-list)
-
This should always be the first ppmk function called, although you can use other pp code above it, such as symbol definitions. @TARGETS defines the list of default targets and also includes the makefile
template.
- @PROGRAM(name, c-files, libraries)
-
This function produces a program target, called name, from the C source files specified in c-files. The program target is linked with the specified libraries.
Avoid using explicit linker flags and libraries, and be sure to use the
symbols defined by ppmk. The name of the program should not include any ``.exe'' suffix. A suffix
will be added if necessary.
You can use an optional fourth argument to specify arbitrary files on which
the program target is to depend.
- @COMPILEFLAGS(c-files, flags)
-
Produces specific targets used to build object files from C files, with
extra flags in addition to those defined in @CFLAGS.
You can use an optional third argument to specify arbitrary files on which
the object file target is to depend.
- @PPFILE(to, from, pp-flags)
-
Produces a target that uses pp to process file from and places the result in file to. During processing, all symbols defined by ppmk will be available.
You can use an optional third argument to specify arbitrary files on which
the target is to depend.
- @VERSIONFILE(filename, headerfile)
-
Produces a header file from a definition file, using pp. Only symbols defined in filename will be written to headerfile. The @VERSIONFILE function can be used only once.
You can use an optional third argument to specify additional flags to
pp.
Before reading the input file, ppmk defines a number of symbols. These can be redefined before calling the @TARGET function, although RSA Security does not recommend this.
- UNIX
-
If defined, the system is a UNIX platform.
- WIN32
-
If defined, the system is Windows NT.
- CAT_APPDIR, CAT_VARDIR, CAT_ETCDIR
-
The directories where the Agent SDK and the RSA Keon Agent Base System are
installed.
- EXPORT, CRYPT_LICENSE
-
The @EXPORT symbol will be set to
"1"
for an exportable Agent SDK with limited cryptographic strength, and to "0"
for a non-exportable Agent SDK. The @CRYPT_LICENSE symbol is set to one of the strings export and domestic.
Changing these symbols will not affect the cryptographic strength of any
Agents built.
- @SYSTEM
-
This symbol is set to the platform name, as used inside the Agent SDK. For
example, Windows NT 4.0 will be represented by NT-4.0 and Sun Solaris 2.6 on SPARC will be represented by solaris-2.6.
- @CC
-
The C compiler to be used. On UNIX systems, this can usually be redefined
to gcc, to use the GNU C Compiler.
- @COMPILER_FLAGS
-
Any C compiler flags that the Agent SDK always needs.
- @LINKER_FLAGS
-
Any linker flags that the Agent SDK always needs.
- @EXPORT_CFLAGS
-
Any C compiler flags required when using the export version of the Agent
SDK. They will be defined only in the export version.
- @PP_FLAGS
-
Flags to make pp include the set of symbols used by ppmk.
- @LIB_CAT
-
Linker flags and libraries to link with the low-level Agent SDK.
- @LIB_CATGEN
-
Linker flags and libraries to link with the high-level Agent SDK. Requires @LIB_CAT.
- @LIB_NET
-
Network libraries. Required by @LIB_CAT.
- @LIB_THREAD
-
Thread libraries. Required by @LIB_CAT, unless the
@LIB_NOTHREAD library is used.
- @LIB_NOTHREAD
-
Library used to produce a non-threaded Agent on platforms that normally
support threaded programs. Either @LIB_THREAD or
@LIB_NOTHREAD must be specified.
- @EXE
-
The suffix
".exe"
on Windows NT; an empty string on all other systems.
- @OBJ
-
The suffix used for object files on the platform. The leading dot is not
part of the suffix.
- @/
-
The directory separator used on the system. Observe that for syntactic
reasons, this must be written as @(/) in pp.
The makefile produced by ppmk will contain a number of targets in addition to those specified by @TARGETS. These are the following:
- clean
-
Deletes any files generated by targets generated by ppmk, in addition to any files listed in the @CLEANFILES symbol.
- dist
-
Produces an Agent distribution using a file called description as input. The symbol @TARGETDIR must be set to the result directory. The directory can also be specified as
a make variable on the command line.
The symbol @DISTFILES can be defined as any files on which the dist
target depends.
- Makefile
-
Calls ppmk to rebuild the makefile from Makefile.pp.
Error messages, which should be self-explanatory, from pp.
A minimal input file to ppmk can look as follows:
@TARGETS(agent)
@PROGRAM(agent, agent.c,
@LIB_CATGEN @LIB_CAT @LIB_NET @LIB_THREAD)
The file is sufficient for ppmk to produce a makefile that can compile program agent from source file agent.c, linking the program with the CAT libraries, on any platform supported by
the Agent SDK.
- CAT_APPDIR/lib/ppmk/
-
The directory that contains the pp definition files and templates used when generating the makefile.
- $HOME/.ppmk
-
UNIX only. If a .ppmk file exists in the user's home directory, this file will be read after the
predefined symbols have been loaded.
pp
make
On Windows NT, use nmake instead of make.