1 Configurations of OpenSSL target platforms
2 ==========================================
4 Target configurations are a collection of facts that we know about
5 different platforms and their capabilities. We organise them in a
6 hash table, where each entry represent a specific target.
8 In each table entry, the following keys are significant:
10 inherit_from => Other targets to inherit values from.
11 Explained further below. [1]
12 template => Set to 1 if this isn't really a platform
13 target. Instead, this target is a template
14 upon which other targets can be built.
15 Explained further below. [1]
17 sys_id => System identity for systems where that
18 is difficult to determine automatically.
20 cc => The compiler command, usually one of "cc",
21 "gcc" or "clang". This command is normally
22 also used to link object files and
23 libraries into the final program.
24 cflags => Flags that are used at all times when
26 debug_cflags => Extra compilation flags used when making a
27 debug build (when Configure receives the
28 --debug option). Typically something like
30 release_cflags => Extra compilation flags used when making a
31 release build (when Configure receives the
32 --release option, or doesn't receive the
33 --debug option). Typically something like
35 thread_cflags => Extra compilation flags used when
36 compiling with threading enabled.
37 Explained further below. [2]
38 shared_cflag => Extra compilation flags used when
39 compiling for shared libraries, typically
40 something like "-fPIC".
42 (linking is a complex thing, see [3] below)
43 ld => Linker command, usually not defined
44 (meaning the compiler command is used
46 (NOTE: this is here for future use, it's
48 lflags => Flags that are used when linking apps.
49 shared_ldflag => Flags that are used when linking shared
51 plib_lflags => Extra linking flags to appear just before
52 the libraries on the command line.
53 ex_libs => Extra libraries that are needed when
56 debug_lflags => Like debug_cflags, but used when linking.
57 release_lflags => Like release_cflags, but used when linking.
59 ar => The library archive command, the default is
61 (NOTE: this is here for future use, it's
63 arflags => Flags to be used with the library archive
66 ranlib => The library archive indexing command, the
67 default is 'ranlib' it it exists.
69 unistd => An alternative header to the typical
70 '<unistd.h>'. This is very rarely needed.
72 shared_extension => File name extension used for shared
74 obj_extension => File name extension used for object files.
75 On unix, this defaults to ".o" (NOTE: this
76 is here for future use, it's not
78 exe_extension => File name extension used for executable
79 files. On unix, this defaults to "" (NOTE:
80 this is here for future use, it's not
83 dso_scheme => The type of dynamic shared objects to build
84 for. This mostly comes into play with
85 engines, but can be used for other purposes
86 as well. Valid values are "DLFCN"
87 (dlopen() et al), "DLFCN_NO_H" (for systems
88 that use dlopen() et al but do not have
89 fcntl.h), "DL" (shl_load() et al), "WIN32"
91 perlasm_scheme => The perlasm method used to created the
92 assembler files used when compiling with
93 assembler implementations.
94 shared_target => The shared library building method used.
95 This is a target found in Makefile.shared.
96 build_scheme => The scheme used to build up a Makefile.
97 In its simplest form, the value is a string
98 with the name of the build scheme.
99 The value may also take the form of a list
100 of strings, if the build_scheme is to have
101 some options. In this case, the first
102 string in the list is the name of the build
104 Currently recognised build schemes are
105 "mk1mf" and "unixmake" and "unified".
106 For the "unified" build scheme, this item
107 *must* be an array with the first being the
108 word "unified" and the second being a word
109 to identify the platform family.
111 multilib => On systems that support having multiple
112 implementations of a library (typically a
113 32-bit and a 64-bit variant), this is used
114 to have the different variants in different
117 bn_ops => Building options (was just bignum options
118 in the earlier history of this option,
119 hence the name). This a string of words
120 that describe properties on the designated
121 target platform, such as the type of
122 integers used to build up the bitnum,
123 different ways to implement certain ciphers
124 and so on. To fully comprehend the
125 meaning, the best is to read the affected
129 BN_LLONG use 'unsigned long long' in
130 some bignum calculations.
131 This has no value when
133 SIXTY_FOUR_BIT_LONG is given.
134 RC4_CHAR makes the basic RC4 unit of
135 calculation an unsigned char.
136 SIXTY_FOUR_BIT processor registers
138 32 bits, long long is
140 SIXTY_FOUR_BIT_LONG processor registers
143 THIRTY_TWO_BIT processor registers
145 EXPORT_VAR_AS_FN for shared libraries,
149 cpuid_asm_src => assembler implementation of cpuid code as
150 well as OPENSSL_cleanse().
152 bn_asm_src => Assembler implementation of core bignum
155 ec_asm_src => Assembler implementation of core EC
157 des_asm_src => Assembler implementation of core DES
158 encryption functions.
159 Defaults to 'des_enc.c fcrypt_b.c'
160 aes_asm_src => Assembler implementation of core AES
162 Defaults to 'aes_core.c aes_cbc.c'
163 bf_asm_src => Assembler implementation of core BlowFish
165 Defaults to 'bf_enc.c'
166 md5_asm_src => Assembler implementation of core MD5
168 sha1_asm_src => Assembler implementation of core SHA1,
169 functions, and also possibly SHA256 and
171 cast_asm_src => Assembler implementation of core CAST
173 Defaults to 'c_enc.c'
174 rc4_asm_src => Assembler implementation of core RC4
176 Defaults to 'rc4_enc.c rc4_skey.c'
177 rmd160_asm_src => Assembler implementation of core RMD160
179 rc5_asm_src => Assembler implementation of core RC5
181 Defaults to 'rc5_enc.c'
182 wp_asm_src => Assembler implementation of core WHIRLPOOL
184 cmll_asm_src => Assembler implementation of core CAMELLIA
186 Defaults to 'camellia.c cmll_misc.c cmll_cbc.c'
187 modes_asm_src => Assembler implementation of cipher modes,
188 currently the functions gcm_gmult_4bit and
190 padlock_asm_src => Assembler implementation of core parts of
191 the padlock engine. This is mandatory on
192 any platform where the padlock engine might
196 [1] as part of the target configuration, one can have a key called
197 'inherit_from' that indicate what other configurations to inherit
198 data from. These are resolved recursively.
200 Inheritance works as a set of default values that can be overriden
201 by corresponding key values in the inheriting configuration.
203 Note 1: any configuration table can be used as a template.
204 Note 2: pure templates have the attribute 'template => 1' and
205 cannot be used as build targets.
207 If several configurations are given in the 'inherit_from' array,
208 the values of same attribute are concatenated with space
209 separation. With this, it's possible to have several smaller
210 templates for different configuration aspects that can be combined
211 into a complete configuration.
213 instead of a scalar value or an array, a value can be a code block
214 of the form 'sub { /* your code here */ }'. This code block will
215 be called with the list of inherited values for that key as
216 arguments. In fact, the concatenation of strings is really done
217 by using 'sub { join(" ",@_) }' on the list of inherited values.
225 ignored => "This should not appear in the end result",
234 inherit_from => [ "foo", "bar" ],
235 hehe => sub { join(" ",(@_,"!!!")) },
239 The entry for "laughter" will become as follows after processing:
248 [2] OpenSSL is built with threading capabilities unless the user
249 specifies 'no-threads'. The value of the key 'thread_cflags' may
250 be "(unknown)", in which case the user MUST give some compilation
253 [3] OpenSSL has three types of things to link from object files or
256 - shared libraries; that would be libcrypto and libssl.
257 - shared objects (sometimes called dynamic libraries); that would
259 - applications; those are apps/openssl and all the test apps.
261 Very roughly speaking, linking is done like this (words in braces
262 represent the configuration settings documented at the beginning
266 {ld} $(CFLAGS) {shared_ldflag} -shared -o libfoo.so \
267 -Wl,--whole-archive libfoo.a -Wl,--no-whole-archive \
268 {plib_lflags} -lcrypto {ex_libs}
271 {ld} $(CFLAGS) {shared_ldflag} -shared -o libeng.so \
272 blah1.o blah2.o {plib_lflags} -lcrypto {ex_libs}
275 {ld} $(CFLAGS) {lflags} -o app \
276 app1.o utils.o {plib_lflags} -lssl -lcrypto {ex_libs}
279 Historically, the target configurations came in form of a string with
280 values separated by colons. This use is deprecated. The string form
283 "target" => "{cc}:{cflags}:{unistd}:{thread_cflag}:{sys_id}:{lflags}:{bn_ops}:{cpuid_obj}:{bn_obj}:{ec_obj}:{des_obj}:{aes_obj}:{bf_obj}:{md5_obj}:{sha1_obj}:{cast_obj}:{rc4_obj}:{rmd160_obj}:{rc5_obj}:{wp_obj}:{cmll_obj}:{modes_obj}:{padlock_obj}:{perlasm_scheme}:{dso_scheme}:{shared_target}:{shared_cflag}:{shared_ldflag}:{shared_extension}:{ranlib}:{arflags}:{multilib}"
289 The build.info files that are spread over the source tree contain the
290 minimum information needed to build and distribute OpenSSL. It uses a
291 simple and yet fairly powerful language to determine what needs to be
292 built, from what sources, and other relationships between files.
294 For every build.info file, all file references are relative to the
295 directory of the build.info file for source files, and the
296 corresponding build directory for built files if the build tree
297 differs from the source tree.
299 When processed, every line is processed with the perl module
300 Text::Template, using the delimiters "{-" and "-}". The hashes
301 %config and %target are passed to the perl fragments, along with
302 $sourcedir and $builddir, which are the locations of the source
303 directory for the current build.info file and the corresponding build
304 directory, all relative to the top of the build tree.
306 To begin with, things to be built are declared by setting specific
315 Note that the files mentioned for PROGRAMS, LIBS and ENGINES *must* be
316 without extensions. The build file templates will figure them out.
318 For each thing to be built, it is then possible to say what sources
322 SOURCE[foo]=foo.c common.c
323 SOURCE[bar]=bar.c extra.c common.c
325 It's also possible to tell some other dependencies:
327 DEPEND[foo]=libsomething
328 DEPEND[libbar]=libsomethingelse
330 (it could be argued that 'libsomething' and 'libsomethingelse' are
331 source as well. However, the files given through SOURCE are expected
332 to be located in the source tree while files given through DEPEND are
333 expected to be located in the build tree)
335 For some libraries, we maintain files with public symbols and their
336 slot in a transfer vector (important on some platforms). It can be
339 ORDINALS[libcrypto]=crypto
341 The value is not the name of the file in question, but rather the
342 argument to util/mkdef.pl that indicates which file to use.
344 One some platforms, shared libraries come with a name that's different
345 from their static counterpart. That's declared as follows:
347 SHARED_NAME[libfoo]=cygfoo-{- $config{shlibver} -}
349 The example is from Cygwin, which has a required naming convention.
351 Sometimes, it makes sense to rename an output file, for example a
354 RENAME[libfoo]=libbar
356 That lines has "libfoo" get renamed to "libbar". While it makes no
357 sense at all to just have a rename like that (why not just use
358 "libbar" everywhere?), it does make sense when it can be used
359 conditionally. See a little further below for an example.
361 For any file to be built, it's also possible to tell what extra
362 include paths the build of their source files should use:
366 It's possible to have raw build file lines, between BEGINRAW and
367 ENDRAW lines as follows:
369 BEGINRAW[Makefile(unix)]
370 haha.h: {- $builddir -}/Makefile
371 echo "/* haha */" > haha.h
372 ENDRAW[Makefile(unix)]
374 The word withing square brackets is the build_file configuration item
375 or the build_file configuration item followed by the second word in the
376 build_scheme configuration item for the configured target within
377 parenthesis as shown above. For example, with the following relevant
380 build_file => "build.ninja"
381 build_scheme => [ "unified", "unix" ]
383 ... these lines will be considered:
385 BEGINRAW[build.ninja]
386 build haha.h: echo "/* haha */" > haha.h
389 BEGINRAW[build.ninja(unix)]
390 build hoho.h: echo "/* hoho */" > hoho.h
391 ENDRAW[build.ninja(unix)]
393 See the documentation further up for more information on configuration
396 Finally, you can have some simple conditional use of the build.info
397 information, looking like this:
407 The expression in square brackets is interpreted as a string in perl,
408 and will be seen as true if perl thinks it is, otherwise false. For
409 example, the above would have "something" used, since 1 is true.
411 Together with the use of Text::Template, this can be used as
412 conditions based on something in the passed variables, for example:
414 IF[{- $config{no_shared} -}]
416 SOURCE[libcrypto]=...
424 # VMS has a cultural standard where all libraries are prefixed.
425 # For OpenSSL, the choice is 'ossl_'
426 IF[{- $config{target} =~ /^vms/ -}]
427 RENAME[libcrypto]=ossl_libcrypto
428 RENAME[libssl]=ossl_libssl
432 Build-file programming with the "unified" build system
433 ======================================================
435 "Build files" are called "Makefile" on Unix-like operating systems,
436 "descrip.mms" for MMS on VMS, "makefile" for nmake on Windows, etc.
438 To use the "unified" build system, the target configuration needs to
439 set the three items 'build_scheme', 'build_file' and 'build_command'.
440 In the rest of this section, we will assume that 'build_scheme' is set
441 to "unified" (see the configurations documentation above for the
444 For any name given by 'build_file', the "unified" system expects a
445 template file in Configurations/ named like the build file, with
446 ".tmpl" appended, or in case of possible ambiguity, a combination of
447 the second 'build_scheme' list item and the 'build_file' name. For
448 example, if 'build_file' is set to "Makefile", the template could be
449 Configurations/Makefile.tmpl or Configurations/unix-Makefile.tmpl.
450 In case both Configurations/unix-Makefile.tmpl and
451 Configurations/Makefile.tmpl are present, the former takes
454 The build-file template is processed with the perl module
455 Text::Template, using "{-" and "-}" as delimiters that enclose the
456 perl code fragments that generate configuration-dependent content.
457 Those perl fragments have access to all the hash variables from
460 The build-file template is expected to define at least the following
461 perl functions in a perl code fragment enclosed with "{-" and "-}".
462 They are all expected to return a string with the lines they produce.
464 src2dep - function that produces build file lines to get the
465 dependencies for an object file into a dependency
468 It's called like this:
470 src2dep(obj => "PATH/TO/objectfile",
471 srcs => [ "PATH/TO/sourcefile", ... ],
472 incs => [ "INCL/PATH", ... ]);
474 'obj' has the dependent object file as well as
475 object file the dependencies are for; it's *without*
476 extension, src2dep() is expected to add that.
477 'srcs' has the list of source files to build the
478 object file, with the first item being the source
479 file that directly corresponds to the object file.
480 'incs' is a list of include file directories.
482 src2obj - function that produces build file lines to build an
483 object file from source files and associated data.
485 It's called like this:
487 src2obj(obj => "PATH/TO/objectfile",
488 srcs => [ "PATH/TO/sourcefile", ... ],
489 deps => [ "dep1", ... ],
490 incs => [ "INCL/PATH", ... ]);
492 'obj' has the intended object file *without*
493 extension, src2obj() is expected to add that.
494 'srcs' has the list of source files to build the
495 object file, with the first item being the source
496 file that directly corresponds to the object file.
497 'deps' is a list of dependencies. 'incs' is a list
498 of include file directories.
500 obj2lib - function that produces build file lines to build a
501 static library file ("libfoo.a" in Unix terms) from
506 obj2lib(lib => "PATH/TO/libfile",
507 objs => [ "PATH/TO/objectfile", ... ]);
509 'lib' has the intended library file name *without*
510 extension, obj2lib is expected to add that. 'objs'
511 has the list of object files (also *without*
512 extension) to build this library.
514 libobj2shlib - function that produces build file lines to build a
515 shareable object library file ("libfoo.so" in Unix
516 terms) from the corresponding static library file
521 libobj2shlib(shlib => "PATH/TO/shlibfile",
522 lib => "PATH/TO/libfile",
523 objs => [ "PATH/TO/objectfile", ... ],
524 deps => [ "PATH/TO/otherlibfile", ... ],
525 ordinals => [ "word", "/PATH/TO/ordfile" ]);
527 'lib' has the intended library file name *without*
528 extension, libobj2shlib is expected to add that.
529 'shlib' has the correcponding shared library name
530 *without* extension. 'deps' has the list of other
531 libraries (also *without* extension) this library
532 needs to be linked with. 'objs' has the list of
533 object files (also *without* extension) to build
534 this library. 'ordinals' MAY be present, and when
535 it is, its value is an array where the word is
536 "crypto" or "ssl" and the file is one of the ordinal
537 files util/libeay.num or util/ssleay.num in the
540 This function has a choice; it can use the
541 corresponding static library as input to make the
542 shared library, or the list of object files.
544 obj2dynlib - function that produces build file lines to build a
545 dynamically loadable library file ("libfoo.so" on
546 Unix) from object files.
550 obj2dynlib(lib => "PATH/TO/libfile",
551 objs => [ "PATH/TO/objectfile", ... ],
552 deps => [ "PATH/TO/otherlibfile",
555 This is almost the same as libobj2shlib, but the
556 intent is to build a shareable library that can be
557 loaded in runtime (a "plugin"...). The differences
558 are subtle, one of the most visible ones is that the
559 resulting shareable library is produced from object
562 obj2bin - function that produces build file lines to build an
563 executable file from object files.
567 obj2bin(bin => "PATH/TO/binfile",
568 objs => [ "PATH/TO/objectfile", ... ],
569 deps => [ "PATH/TO/libfile", ... ]);
571 'bin' has the intended executable file name
572 *without* extension, obj2bin is expected to add
573 that. 'objs' has the list of object files (also
574 *without* extension) to build this library. 'deps'
575 has the list of library files (also *without*
576 extension) that the programs needs to be linked
579 in2script - function that produces build file lines to build a
580 script file from some input.
584 in2script(script => "PATH/TO/scriptfile",
585 sources => [ "PATH/TO/infile", ... ]);
587 'script' has the intended script file name.
588 'sources' has the list of source files to build the
589 resulting script from.
591 In all cases, file file paths are relative to the build tree top, and
592 the build file actions run with the build tree top as current working
595 Make sure to end the section with these functions with a string that
596 you thing is apropriate for the resulting build file. If nothing
597 else, end it like this:
599 ""; # Make sure no lingering values end up in the Makefile