build file template to define exactly how those command lines should
be handled, how the output is captured and so on.
+Sometimes, the generator file itself depends on other files, for
+example if it is a perl script that depends on other perl modules.
+This can be expressed using DEPEND like this:
+
+ DEPEND[asm/something.pl]=../perlasm/Foo.pm
+
+There may also be cases where the exact file isn't easily specified,
+but an inclusion directory still needs to be specified. INCLUDE can
+be used in that case:
+
+ INCLUDE[asm/something.pl]=../perlasm
+
NOTE: GENERATE lines are limited to one command only per GENERATE.
As a last resort, it's possible to have raw build file lines, between
generatesrc(src => "PATH/TO/tobegenerated",
generator => [ "generatingfile", ... ]
+ generator_incs => [ "INCL/PATH", ... ]
+ generator_deps => [ "dep1", ... ]
generator => [ "generatingfile", ... ]
incs => [ "INCL/PATH", ... ],
deps => [ "dep1", ... ],
expected to be the file to generate from.
generatesrc() is expected to analyse and figure out
exactly how to apply that file and how to capture
- the result. 'incs' and 'deps' are include
- directories and files that are used if $(CC) used as
- an intermediary step when generating the end product
- (the file indicated by 'src'). 'intent' indicates
- what the generated file is going to be used for.
+ the result. 'generator_incs' and 'generator_deps'
+ are include directories and files that the generator
+ file itself depends on. 'incs' and 'deps' are
+ include directories and files that are used if $(CC)
+ is used as an intermediary step when generating the
+ end product (the file indicated by 'src'). 'intent'
+ indicates what the generated file is going to be
+ used for.
src2obj - function that produces build file lines to build an
object file from source files and associated data.
GENERATE[buildinf.h]=../util/mkbuildinf.pl "$(CC) $(CFLAGS)" "$(PLATFORM)"
DEPEND[buildinf.h]=../Makefile
+ DEPEND[../util/mkbuildinf.pl]=../util/Foo.pm
This is the build.info file in 'crypto', and it tells us a little more
about what's needed to produce 'libcrypto'. LIBS is used again to
It also shows us that building the object file inferred from
'crypto/cversion.c' depends on 'crypto/buildinf.h'. Finally, it
also shows the possibility to declare how some files are generated
-using some script, in this case a perl script.
+using some script, in this case a perl script, and how such scripts
+can be declared to depend on other files, in this case a perl module.
Two things are worth an extra note:
GENERATE[crypto/buildinf.h]=util/mkbuildinf.pl "$(CC) $(CFLAGS)" "$(PLATFORM)"
DEPEND[crypto/buildinf.h]=Makefile
+ DEPEND[util/mkbuildinf.pl]=util/Foo.pm
A few notes worth mentioning:
ENGINES may be used to declare engines only.
-The indexes for SOURCE, INCLUDE and ORDINALS must only be end product
-files, such as libraries, programs or engines. The values of SOURCE
+The indexes for SOURCE and ORDINALS must only be end product files,
+such as libraries, programs or engines. The values of SOURCE
variables must only be source files (possibly generated)
-DEPEND shows a relationship between different produced files, such
-as a program depending on a library, or between an object file and
-some extra source file.
+INCLUDE and DEPEND shows a relationship between different files
+(usually produced files) or between files and directories, such as a
+program depending on a library, or between an object file and some
+extra source file.
When Configure processes the build.info files, it will take it as
truth without question, and will therefore perform very few checks.
[
"libcrypto",
],
+ "util/mkbuildinf.pl" =>
+ [
+ "util/Foo.pm",
+ ],
},
"engines" =>
[
[
"include",
],
+ "util/mkbuildinf.pl" =>
+ [
+ "util",
+ ],
}
"libraries" =>
[
generatesrc(src => "PATH/TO/tobegenerated",
generator => [ "generatingfile", ... ]
+ generator_incs => [ "INCL/PATH", ... ]
+ generator_deps => [ "dep1", ... ]
incs => [ "INCL/PATH", ... ],
deps => [ "dep1", ... ],
intent => one of "libs", "dso", "bin" );
expected to be the file to generate from.
generatesrc() is expected to analyse and figure out
exactly how to apply that file and how to capture
- the result. 'incs' and 'deps' are include
- directories and files that are used if $(CC) used as
- an intermediary step when generating the end product
- (the file indicated by 'src'). 'intent' indicates
- what the generated file is going to be used for.
+ the result. 'generator_incs' and 'generator_deps'
+ are include directories and files that the generator
+ file itself depends on. 'incs' and 'deps' are
+ include directories and files that are used if $(CC)
+ is used as an intermediary step when generating the
+ end product (the file indicated by 'src'). 'intent'
+ indicates what the generated file is going to be
+ used for.
src2obj - function that produces build file lines to build an
object file from source files and associated data.
functions defined in the build-file template.
As an example with the smaller build.info set we've seen as an
-example, producing the rules to build 'libssl' would result in the
+example, producing the rules to build 'libcrypto' would result in the
following calls:
# Note: libobj2shlib will only be called if shared libraries are
# to the implementation to decide which to use as input.
# Note 3: common.tmpl peals off the ".o" extension from all object
# files, as the platform at hand may have a different one.
- libobj2shlib(shlib => "libssl",
- lib => "libssl",
- objs => [ "ssl/tls" ],
- deps => [ "libcrypto" ]
- ordinals => [ "ssl", "util/libssl.num" ]);
+ libobj2shlib(shlib => "libcrypto",
+ lib => "libcrypto",
+ objs => [ "crypto/aes", "crypto/evp", "crypto/cversion" ],
+ deps => [ ]
+ ordinals => [ "crypto", "util/libcrypto.num" ]);
+
+ obj2lib(lib => "libcrypto"
+ objs => [ "crypto/aes", "crypto/evp", "crypto/cversion" ]);
- obj2lib(lib => "libssl"
- objs => [ "ssl/tls" ]);
+ src2obj(obj => "crypto/aes"
+ srcs => [ "crypto/aes.c" ],
+ deps => [ ],
+ incs => [ "include" ],
+ intent => "lib");
- src2obj(obj => "ssl/tls"
- srcs => [ "ssl/tls.c" ],
+ src2obj(obj => "crypto/evp"
+ srcs => [ "crypto/evp.c" ],
deps => [ ],
incs => [ "include" ],
intent => "lib");
+ src2obj(obj => "crypto/cversion"
+ srcs => [ "crypto/cversion.c" ],
+ deps => [ "crypto/buildinf.h" ],
+ incs => [ "include" ],
+ intent => "lib");
+
+ generatesrc(src => "crypto/buildinf.h",
+ generator => [ "util/mkbuildinf.pl", "\"$(CC)",
+ "$(CFLAGS)\"", "\"$(PLATFORM)\"" ],
+ generator_incs => [ "util" ],
+ generator_deps => [ "util/Foo.pm" ],
+ incs => [ ],
+ deps => [ ],
+ intent => "lib");
+
The returned strings from all those calls are then concatenated
together and written to the resulting build-file.