1 1.1 christos Design document for the unified scheme data 2 1.1 christos =========================================== 3 1.1 christos 4 1.1 christos How are things connected? 5 1.1 christos ------------------------- 6 1.1 christos 7 1.1 christos The unified scheme takes all its data from the `build.info` files seen 8 1.1 christos throughout the source tree. These files hold the minimum information 9 1.1 christos needed to build end product files from diverse sources. See the 10 1.1 christos section on `build.info` files below. 11 1.1 christos 12 1.1 christos From the information in `build.info` files, `Configure` builds up an 13 1.1 christos information database as a hash table called `%unified_info`, which is 14 1.1 christos stored in configdata.pm, found at the top of the build tree (which may 15 1.1 christos or may not be the same as the source tree). 16 1.1 christos 17 1.1 christos [`Configurations/common.tmpl`](common.tmpl) uses the data from `%unified_info` to 18 1.1 christos generate the rules for building end product files as well as 19 1.1 christos intermediary files with the help of a few functions found in the 20 1.1 christos build-file templates. See the section on build-file templates further 21 1.1 christos down for more information. 22 1.1 christos 23 1.1 christos build.info files 24 1.1 christos ---------------- 25 1.1 christos 26 1.1 christos As mentioned earlier, `build.info` files are meant to hold the minimum 27 1.1 christos information needed to build output files, and therefore only (with a 28 1.1 christos few possible exceptions [1]) have information about end products (such 29 1.1 christos as scripts, library files and programs) and source files (such as C 30 1.1 christos files, C header files, assembler files, etc). Intermediate files such 31 1.1 christos as object files are rarely directly referred to in `build.info` files (and 32 1.1 christos when they are, it's always with the file name extension `.o`), they are 33 1.1 christos inferred by `Configure`. By the same rule of minimalism, end product 34 1.1 christos file name extensions (such as `.so`, `.a`, `.exe`, etc) are never mentioned 35 1.1 christos in `build.info`. Their file name extensions will be inferred by the 36 1.1 christos build-file templates, adapted for the platform they are meant for (see 37 1.1 christos sections on `%unified_info` and build-file templates further down). 38 1.1 christos 39 1.1 christos The variables `PROGRAMS`, `LIBS`, `MODULES` and `SCRIPTS` are used to declare 40 1.1 christos end products. There are variants for them with `_NO_INST` as suffix 41 1.1 christos (`PROGRAM_NO_INST` etc) to specify end products that shouldn't get installed. 42 1.1 christos 43 1.1 christos The variables `SOURCE`, `DEPEND`, `INCLUDE` and `DEFINE` are indexed by a 44 1.1 christos produced file, and their values are the source used to produce that 45 1.1 christos particular produced file, extra dependencies, include directories 46 1.1 christos needed, or C macros to be defined. 47 1.1 christos 48 1.1 christos All their values in all the `build.info` throughout the source tree are 49 1.1 christos collected together and form a set of programs, libraries, modules and 50 1.1 christos scripts to be produced, source files, dependencies, etc etc etc. 51 1.1 christos 52 1.1 christos Let's have a pretend example, a very limited contraption of OpenSSL, 53 1.1 christos composed of the program `apps/openssl`, the libraries `libssl` and 54 1.1 christos `libcrypto`, an module `engines/ossltest` and their sources and 55 1.1 christos dependencies. 56 1.1 christos 57 1.1 christos # build.info 58 1.1 christos LIBS=libcrypto libssl 59 1.1 christos INCLUDE[libcrypto]=include 60 1.1 christos INCLUDE[libssl]=include 61 1.1 christos DEPEND[libssl]=libcrypto 62 1.1 christos 63 1.1 christos This is the top directory `build.info` file, and it tells us that two 64 1.1 christos libraries are to be built, the include directory `include/` shall be 65 1.1 christos used throughout when building anything that will end up in each 66 1.1 christos library, and that the library `libssl` depend on the library 67 1.1 christos `libcrypto` to function properly. 68 1.1 christos 69 1.1 christos # apps/build.info 70 1.1 christos PROGRAMS=openssl 71 1.1 christos SOURCE[openssl]=openssl.c 72 1.1 christos INCLUDE[openssl]=.. ../include 73 1.1 christos DEPEND[openssl]=../libssl 74 1.1 christos 75 1.1 christos This is the `build.info` file in `apps/`, one may notice that all file 76 1.1 christos paths mentioned are relative to the directory the `build.info` file is 77 1.1 christos located in. This one tells us that there's a program to be built 78 1.1 christos called `apps/openss` (the file name extension will depend on the 79 1.1 christos platform and is therefore not mentioned in the `build.info` file). It's 80 1.1 christos built from one source file, `apps/openssl.c`, and building it requires 81 1.1 christos the use of `.` and `include/` include directories (both are declared 82 1.1 christos from the point of view of the `apps/` directory), and that the program 83 1.1 christos depends on the library `libssl` to function properly. 84 1.1 christos 85 1.1 christos # crypto/build.info 86 1.1 christos LIBS=../libcrypto 87 1.1 christos SOURCE[../libcrypto]=aes.c evp.c cversion.c 88 1.1 christos DEPEND[cversion.o]=buildinf.h 89 1.1 christos 90 1.1 christos GENERATE[buildinf.h]=../util/mkbuildinf.pl "$(CC) $(CFLAGS)" "$(PLATFORM)" 91 1.1 christos DEPEND[buildinf.h]=../Makefile 92 1.1 christos DEPEND[../util/mkbuildinf.pl]=../util/Foo.pm 93 1.1 christos 94 1.1 christos This is the `build.info` file in `crypto/`, and it tells us a little more 95 1.1 christos about what's needed to produce `libcrypto`. LIBS is used again to 96 1.1 christos declare that `libcrypto` is to be produced. This declaration is 97 1.1 christos really unnecessary as it's already mentioned in the top `build.info` 98 1.1 christos file, but can make the info file easier to understand. This is to 99 1.1 christos show that duplicate information isn't an issue. 100 1.1 christos 101 1.1 christos This `build.info` file informs us that `libcrypto` is built from a few 102 1.1 christos source files, `crypto/aes.c`, `crypto/evp.c` and `crypto/cversion.c`. 103 1.1 christos It also shows us that building the object file inferred from 104 1.1 christos `crypto/cversion.c` depends on `crypto/buildinf.h`. Finally, it 105 1.1 christos also shows the possibility to declare how some files are generated 106 1.1 christos using some script, in this case a perl script, and how such scripts 107 1.1 christos can be declared to depend on other files, in this case a perl module. 108 1.1 christos 109 1.1 christos Two things are worth an extra note: 110 1.1 christos 111 1.1 christos `DEPEND[cversion.o]` mentions an object file. DEPEND indexes is the 112 1.1 christos only location where it's valid to mention them 113 1.1 christos 114 1.1 christos # ssl/build.info 115 1.1 christos LIBS=../libssl 116 1.1 christos SOURCE[../libssl]=tls.c 117 1.1 christos 118 1.1 christos This is the build.info file in `ssl/`, and it tells us that the 119 1.1 christos library `libssl` is built from the source file `ssl/tls.c`. 120 1.1 christos 121 1.1 christos # engines/build.info 122 1.1 christos MODULES=dasync 123 1.1 christos SOURCE[dasync]=e_dasync.c 124 1.1 christos DEPEND[dasync]=../libcrypto 125 1.1 christos INCLUDE[dasync]=../include 126 1.1 christos 127 1.1 christos MODULES_NO_INST=ossltest 128 1.1 christos SOURCE[ossltest]=e_ossltest.c 129 1.1 christos DEPEND[ossltest]=../libcrypto.a 130 1.1 christos INCLUDE[ossltest]=../include 131 1.1 christos 132 1.1 christos This is the `build.info` file in `engines/`, telling us that two modules 133 1.1 christos called `engines/dasync` and `engines/ossltest` shall be built, that 134 1.1 christos `dasync`'s source is `engines/e_dasync.c` and `ossltest`'s source is 135 1.1 christos `engines/e_ossltest.c` and that the include directory `include/` may 136 1.1 christos be used when building anything that will be part of these modules. 137 1.1 christos Also, both modules depend on the library `libcrypto` to function 138 1.1 christos properly. `ossltest` is explicitly linked with the static variant of 139 1.1 christos the library `libcrypto`. Finally, only `dasync` is being installed, as 140 1.1 christos `ossltest` is only for internal testing. 141 1.1 christos 142 1.1 christos When `Configure` digests these `build.info` files, the accumulated 143 1.1 christos information comes down to this: 144 1.1 christos 145 1.1 christos LIBS=libcrypto libssl 146 1.1 christos SOURCE[libcrypto]=crypto/aes.c crypto/evp.c crypto/cversion.c 147 1.1 christos DEPEND[crypto/cversion.o]=crypto/buildinf.h 148 1.1 christos INCLUDE[libcrypto]=include 149 1.1 christos SOURCE[libssl]=ssl/tls.c 150 1.1 christos INCLUDE[libssl]=include 151 1.1 christos DEPEND[libssl]=libcrypto 152 1.1 christos 153 1.1 christos PROGRAMS=apps/openssl 154 1.1 christos SOURCE[apps/openssl]=apps/openssl.c 155 1.1 christos INCLUDE[apps/openssl]=. include 156 1.1 christos DEPEND[apps/openssl]=libssl 157 1.1 christos 158 1.1 christos MODULES=engines/dasync 159 1.1 christos SOURCE[engines/dasync]=engines/e_dasync.c 160 1.1 christos DEPEND[engines/dasync]=libcrypto 161 1.1 christos INCLUDE[engines/dasync]=include 162 1.1 christos 163 1.1 christos MODULES_NO_INST=engines/ossltest 164 1.1 christos SOURCE[engines/ossltest]=engines/e_ossltest.c 165 1.1 christos DEPEND[engines/ossltest]=libcrypto.a 166 1.1 christos INCLUDE[engines/ossltest]=include 167 1.1 christos 168 1.1 christos GENERATE[crypto/buildinf.h]=util/mkbuildinf.pl "$(CC) $(CFLAGS)" "$(PLATFORM)" 169 1.1 christos DEPEND[crypto/buildinf.h]=Makefile 170 1.1 christos DEPEND[util/mkbuildinf.pl]=util/Foo.pm 171 1.1 christos 172 1.1 christos A few notes worth mentioning: 173 1.1 christos 174 1.1 christos `LIBS` may be used to declare routine libraries only. 175 1.1 christos 176 1.1 christos `PROGRAMS` may be used to declare programs only. 177 1.1 christos 178 1.1 christos `MODULES` may be used to declare modules only. 179 1.1 christos 180 1.1 christos The indexes for `SOURCE` must only be end product files, such as 181 1.1 christos libraries, programs or modules. The values of `SOURCE` variables must 182 1.1 christos only be source files (possibly generated). 183 1.1 christos 184 1.1 christos `INCLUDE` and `DEPEND` shows a relationship between different files 185 1.1 christos (usually produced files) or between files and directories, such as a 186 1.1 christos program depending on a library, or between an object file and some 187 1.1 christos extra source file. 188 1.1 christos 189 1.1 christos When `Configure` processes the `build.info` files, it will take it as 190 1.1 christos truth without question, and will therefore perform very few checks. 191 1.1 christos If the build tree is separate from the source tree, it will assume 192 1.1 christos that all built files and up in the build directory and that all source 193 1.1 christos files are to be found in the source tree, if they can be found there. 194 1.1 christos `Configure` will assume that source files that can't be found in the 195 1.1 christos source tree (such as `crypto/bildinf.h` in the example above) are 196 1.1 christos generated and will be found in the build tree. 197 1.1 christos 198 1.1 christos The `%unified_info` database 199 1.1 christos ---------------------------- 200 1.1 christos 201 1.1 christos The information in all the `build.info` get digested by `Configure` and 202 1.1 christos collected into the `%unified_info` database, divided into the following 203 1.1 christos indexes: 204 1.1 christos 205 1.1 christos depends => a hash table containing 'file' => [ 'dependency' ... ] 206 1.1 christos pairs. These are directly inferred from the DEPEND 207 1.1 christos variables in build.info files. 208 1.1 christos 209 1.1 christos modules => a list of modules. These are directly inferred from 210 1.1 christos the MODULES variable in build.info files. 211 1.1 christos 212 1.1 christos generate => a hash table containing 'file' => [ 'generator' ... ] 213 1.1 christos pairs. These are directly inferred from the GENERATE 214 1.1 christos variables in build.info files. 215 1.1 christos 216 1.1 christos includes => a hash table containing 'file' => [ 'include' ... ] 217 1.1 christos pairs. These are directly inferred from the INCLUDE 218 1.1 christos variables in build.info files. 219 1.1 christos 220 1.1 christos install => a hash table containing 'type' => [ 'file' ... ] pairs. 221 1.1 christos The types are 'programs', 'libraries', 'modules' and 222 1.1 christos 'scripts', and the array of files list the files of 223 1.1 christos that type that should be installed. 224 1.1 christos 225 1.1 christos libraries => a list of libraries. These are directly inferred from 226 1.1 christos the LIBS variable in build.info files. 227 1.1 christos 228 1.1 christos programs => a list of programs. These are directly inferred from 229 1.1 christos the PROGRAMS variable in build.info files. 230 1.1 christos 231 1.1 christos scripts => a list of scripts. There are directly inferred from 232 1.1 christos the SCRIPTS variable in build.info files. 233 1.1 christos 234 1.1 christos sources => a hash table containing 'file' => [ 'sourcefile' ... ] 235 1.1 christos pairs. These are indirectly inferred from the SOURCE 236 1.1 christos variables in build.info files. Object files are 237 1.1 christos mentioned in this hash table, with source files from 238 1.1 christos SOURCE variables, and AS source files for programs and 239 1.1 christos libraries. 240 1.1 christos 241 1.1 christos shared_sources => 242 1.1 christos a hash table just like 'sources', but only as source 243 1.1 christos files (object files) for building shared libraries. 244 1.1 christos 245 1.1 christos As an example, here is how the `build.info` files example from the 246 1.1 christos section above would be digested into a `%unified_info` table: 247 1.1 christos 248 1.1 christos our %unified_info = ( 249 1.1 christos "depends" => 250 1.1 christos { 251 1.1 christos "apps/openssl" => 252 1.1 christos [ 253 1.1 christos "libssl", 254 1.1 christos ], 255 1.1 christos "crypto/buildinf.h" => 256 1.1 christos [ 257 1.1 christos "Makefile", 258 1.1 christos ], 259 1.1 christos "crypto/cversion.o" => 260 1.1 christos [ 261 1.1 christos "crypto/buildinf.h", 262 1.1 christos ], 263 1.1 christos "engines/dasync" => 264 1.1 christos [ 265 1.1 christos "libcrypto", 266 1.1 christos ], 267 1.1 christos "engines/ossltest" => 268 1.1 christos [ 269 1.1 christos "libcrypto.a", 270 1.1 christos ], 271 1.1 christos "libssl" => 272 1.1 christos [ 273 1.1 christos "libcrypto", 274 1.1 christos ], 275 1.1 christos "util/mkbuildinf.pl" => 276 1.1 christos [ 277 1.1 christos "util/Foo.pm", 278 1.1 christos ], 279 1.1 christos }, 280 1.1 christos "modules" => 281 1.1 christos [ 282 1.1 christos "engines/dasync", 283 1.1 christos "engines/ossltest", 284 1.1 christos ], 285 1.1 christos "generate" => 286 1.1 christos { 287 1.1 christos "crypto/buildinf.h" => 288 1.1 christos [ 289 1.1 christos "util/mkbuildinf.pl", 290 1.1 christos "\"\$(CC)", 291 1.1 christos "\$(CFLAGS)\"", 292 1.1 christos "\"$(PLATFORM)\"", 293 1.1 christos ], 294 1.1 christos }, 295 1.1 christos "includes" => 296 1.1 christos { 297 1.1 christos "apps/openssl" => 298 1.1 christos [ 299 1.1 christos ".", 300 1.1 christos "include", 301 1.1 christos ], 302 1.1 christos "engines/ossltest" => 303 1.1 christos [ 304 1.1 christos "include" 305 1.1 christos ], 306 1.1 christos "libcrypto" => 307 1.1 christos [ 308 1.1 christos "include", 309 1.1 christos ], 310 1.1 christos "libssl" => 311 1.1 christos [ 312 1.1 christos "include", 313 1.1 christos ], 314 1.1 christos "util/mkbuildinf.pl" => 315 1.1 christos [ 316 1.1 christos "util", 317 1.1 christos ], 318 1.1 christos } 319 1.1 christos "install" => 320 1.1 christos { 321 1.1 christos "modules" => 322 1.1 christos [ 323 1.1 christos "engines/dasync", 324 1.1 christos ], 325 1.1 christos "libraries" => 326 1.1 christos [ 327 1.1 christos "libcrypto", 328 1.1 christos "libssl", 329 1.1 christos ], 330 1.1 christos "programs" => 331 1.1 christos [ 332 1.1 christos "apps/openssl", 333 1.1 christos ], 334 1.1 christos }, 335 1.1 christos "libraries" => 336 1.1 christos [ 337 1.1 christos "libcrypto", 338 1.1 christos "libssl", 339 1.1 christos ], 340 1.1 christos "programs" => 341 1.1 christos [ 342 1.1 christos "apps/openssl", 343 1.1 christos ], 344 1.1 christos "sources" => 345 1.1 christos { 346 1.1 christos "apps/openssl" => 347 1.1 christos [ 348 1.1 christos "apps/openssl.o", 349 1.1 christos ], 350 1.1 christos "apps/openssl.o" => 351 1.1 christos [ 352 1.1 christos "apps/openssl.c", 353 1.1 christos ], 354 1.1 christos "crypto/aes.o" => 355 1.1 christos [ 356 1.1 christos "crypto/aes.c", 357 1.1 christos ], 358 1.1 christos "crypto/cversion.o" => 359 1.1 christos [ 360 1.1 christos "crypto/cversion.c", 361 1.1 christos ], 362 1.1 christos "crypto/evp.o" => 363 1.1 christos [ 364 1.1 christos "crypto/evp.c", 365 1.1 christos ], 366 1.1 christos "engines/e_dasync.o" => 367 1.1 christos [ 368 1.1 christos "engines/e_dasync.c", 369 1.1 christos ], 370 1.1 christos "engines/dasync" => 371 1.1 christos [ 372 1.1 christos "engines/e_dasync.o", 373 1.1 christos ], 374 1.1 christos "engines/e_ossltest.o" => 375 1.1 christos [ 376 1.1 christos "engines/e_ossltest.c", 377 1.1 christos ], 378 1.1 christos "engines/ossltest" => 379 1.1 christos [ 380 1.1 christos "engines/e_ossltest.o", 381 1.1 christos ], 382 1.1 christos "libcrypto" => 383 1.1 christos [ 384 1.1 christos "crypto/aes.c", 385 1.1 christos "crypto/cversion.c", 386 1.1 christos "crypto/evp.c", 387 1.1 christos ], 388 1.1 christos "libssl" => 389 1.1 christos [ 390 1.1 christos "ssl/tls.c", 391 1.1 christos ], 392 1.1 christos "ssl/tls.o" => 393 1.1 christos [ 394 1.1 christos "ssl/tls.c", 395 1.1 christos ], 396 1.1 christos }, 397 1.1 christos ); 398 1.1 christos 399 1.1 christos As can be seen, everything in `%unified_info` is fairly simple suggest 400 1.1 christos of information. Still, it tells us that to build all programs, we 401 1.1 christos must build `apps/openssl`, and to build the latter, we will need to 402 1.1 christos build all its sources (`apps/openssl.o` in this case) and all the 403 1.1 christos other things it depends on (such as `libssl`). All those dependencies 404 1.1 christos need to be built as well, using the same logic, so to build `libssl`, 405 1.1 christos we need to build `ssl/tls.o` as well as `libcrypto`, and to build the 406 1.1 christos latter... 407 1.1 christos 408 1.1 christos Build-file templates 409 1.1 christos -------------------- 410 1.1 christos 411 1.1 christos Build-file templates are essentially build-files (such as `Makefile` on 412 1.1 christos Unix) with perl code fragments mixed in. Those perl code fragment 413 1.1 christos will generate all the configuration dependent data, including all the 414 1.1 christos rules needed to build end product files and intermediary files alike. 415 1.1 christos At a minimum, there must be a perl code fragment that defines a set of 416 1.1 christos functions that are used to generates specific build-file rules, to 417 1.1 christos build static libraries from object files, to build shared libraries 418 1.1 christos from static libraries, to programs from object files and libraries, 419 1.1 christos etc. 420 1.1 christos 421 1.1 christos generatesrc - function that produces build file lines to generate 422 1.1 christos a source file from some input. 423 1.1 christos 424 1.1 christos It's called like this: 425 1.1 christos 426 1.1 christos generatesrc(src => "PATH/TO/tobegenerated", 427 1.1 christos generator => [ "generatingfile", ... ] 428 1.1 christos generator_incs => [ "INCL/PATH", ... ] 429 1.1 christos generator_deps => [ "dep1", ... ] 430 1.1 christos incs => [ "INCL/PATH", ... ], 431 1.1 christos deps => [ "dep1", ... ], 432 1.1 christos intent => one of "libs", "dso", "bin" ); 433 1.1 christos 434 1.1 christos 'src' has the name of the file to be generated. 435 1.1 christos 'generator' is the command or part of command to 436 1.1 christos generate the file, of which the first item is 437 1.1 christos expected to be the file to generate from. 438 1.1 christos generatesrc() is expected to analyse and figure out 439 1.1 christos exactly how to apply that file and how to capture 440 1.1 christos the result. 'generator_incs' and 'generator_deps' 441 1.1 christos are include directories and files that the generator 442 1.1 christos file itself depends on. 'incs' and 'deps' are 443 1.1 christos include directories and files that are used if $(CC) 444 1.1 christos is used as an intermediary step when generating the 445 1.1 christos end product (the file indicated by 'src'). 'intent' 446 1.1 christos indicates what the generated file is going to be 447 1.1 christos used for. 448 1.1 christos 449 1.1 christos src2obj - function that produces build file lines to build an 450 1.1 christos object file from source files and associated data. 451 1.1 christos 452 1.1 christos It's called like this: 453 1.1 christos 454 1.1 christos src2obj(obj => "PATH/TO/objectfile", 455 1.1 christos srcs => [ "PATH/TO/sourcefile", ... ], 456 1.1 christos deps => [ "dep1", ... ], 457 1.1 christos incs => [ "INCL/PATH", ... ] 458 1.1 christos intent => one of "lib", "dso", "bin" ); 459 1.1 christos 460 1.1 christos 'obj' has the intended object file with `.o` 461 1.1 christos extension, src2obj() is expected to change it to 462 1.1 christos something more suitable for the platform. 463 1.1 christos 'srcs' has the list of source files to build the 464 1.1 christos object file, with the first item being the source 465 1.1 christos file that directly corresponds to the object file. 466 1.1 christos 'deps' is a list of explicit dependencies. 'incs' 467 1.1 christos is a list of include file directories. Finally, 468 1.1 christos 'intent' indicates what this object file is going 469 1.1 christos to be used for. 470 1.1 christos 471 1.1 christos obj2lib - function that produces build file lines to build a 472 1.1 christos static library file ("libfoo.a" in Unix terms) from 473 1.1 christos object files. 474 1.1 christos 475 1.1 christos called like this: 476 1.1 christos 477 1.1 christos obj2lib(lib => "PATH/TO/libfile", 478 1.1 christos objs => [ "PATH/TO/objectfile", ... ]); 479 1.1 christos 480 1.1 christos 'lib' has the intended library file name *without* 481 1.1 christos extension, obj2lib is expected to add that. 'objs' 482 1.1 christos has the list of object files to build this library. 483 1.1 christos 484 1.1 christos libobj2shlib - backward compatibility function that's used the 485 1.1 christos same way as obj2shlib (described next), and was 486 1.1 christos expected to build the shared library from the 487 1.1 christos corresponding static library when that was suitable. 488 1.1 christos NOTE: building a shared library from a static 489 1.1 christos library is now DEPRECATED, as they no longer share 490 1.1 christos object files. Attempting to do this will fail. 491 1.1 christos 492 1.1 christos obj2shlib - function that produces build file lines to build a 493 1.1 christos shareable object library file ("libfoo.so" in Unix 494 1.1 christos terms) from the corresponding object files. 495 1.1 christos 496 1.1 christos called like this: 497 1.1 christos 498 1.1 christos obj2shlib(shlib => "PATH/TO/shlibfile", 499 1.1 christos lib => "PATH/TO/libfile", 500 1.1 christos objs => [ "PATH/TO/objectfile", ... ], 501 1.1 christos deps => [ "PATH/TO/otherlibfile", ... ]); 502 1.1 christos 503 1.1 christos 'lib' has the base (static) library file name 504 1.1 christos *without* extension. This is useful in case 505 1.1 christos supporting files are needed (such as import 506 1.1 christos libraries on Windows). 507 1.1 christos 'shlib' has the corresponding shared library name 508 1.1 christos *without* extension. 'deps' has the list of other 509 1.1 christos libraries (also *without* extension) this library 510 1.1 christos needs to be linked with. 'objs' has the list of 511 1.1 christos object files to build this library. 512 1.1 christos 513 1.1 christos obj2dso - function that produces build file lines to build a 514 1.1 christos dynamic shared object file from object files. 515 1.1 christos 516 1.1 christos called like this: 517 1.1 christos 518 1.1 christos obj2dso(lib => "PATH/TO/libfile", 519 1.1 christos objs => [ "PATH/TO/objectfile", ... ], 520 1.1 christos deps => [ "PATH/TO/otherlibfile", 521 1.1 christos ... ]); 522 1.1 christos 523 1.1 christos This is almost the same as obj2shlib, but the 524 1.1 christos intent is to build a shareable library that can be 525 1.1 christos loaded in runtime (a "plugin"...). 526 1.1 christos 527 1.1 christos obj2bin - function that produces build file lines to build an 528 1.1 christos executable file from object files. 529 1.1 christos 530 1.1 christos called like this: 531 1.1 christos 532 1.1 christos obj2bin(bin => "PATH/TO/binfile", 533 1.1 christos objs => [ "PATH/TO/objectfile", ... ], 534 1.1 christos deps => [ "PATH/TO/libfile", ... ]); 535 1.1 christos 536 1.1 christos 'bin' has the intended executable file name 537 1.1 christos *without* extension, obj2bin is expected to add 538 1.1 christos that. 'objs' has the list of object files to build 539 1.1 christos this library. 'deps' has the list of library files 540 1.1 christos (also *without* extension) that the programs needs 541 1.1 christos to be linked with. 542 1.1 christos 543 1.1 christos in2script - function that produces build file lines to build a 544 1.1 christos script file from some input. 545 1.1 christos 546 1.1 christos called like this: 547 1.1 christos 548 1.1 christos in2script(script => "PATH/TO/scriptfile", 549 1.1 christos sources => [ "PATH/TO/infile", ... ]); 550 1.1 christos 551 1.1 christos 'script' has the intended script file name. 552 1.1 christos 'sources' has the list of source files to build the 553 1.1 christos resulting script from. 554 1.1 christos 555 1.1 christos Along with the build-file templates is the driving template 556 1.1 christos [`Configurations/common.tmpl`](common.tmpl), which looks through all the 557 1.1 christos information in `%unified_info` and generates all the rulesets to build libraries, 558 1.1 christos programs and all intermediate files, using the rule generating 559 1.1 christos functions defined in the build-file template. 560 1.1 christos 561 1.1 christos As an example with the smaller `build.info` set we've seen as an 562 1.1 christos example, producing the rules to build `libcrypto` would result in the 563 1.1 christos following calls: 564 1.1 christos 565 1.1 christos # Note: obj2shlib will only be called if shared libraries are 566 1.1 christos # to be produced. 567 1.1 christos # Note 2: obj2shlib must convert the '.o' extension to whatever 568 1.1 christos # is suitable on the local platform. 569 1.1 christos obj2shlib(shlib => "libcrypto", 570 1.1 christos objs => [ "crypto/aes.o", "crypto/evp.o", "crypto/cversion.o" ], 571 1.1 christos deps => [ ]); 572 1.1 christos 573 1.1 christos obj2lib(lib => "libcrypto" 574 1.1 christos objs => [ "crypto/aes.o", "crypto/evp.o", "crypto/cversion.o" ]); 575 1.1 christos 576 1.1 christos src2obj(obj => "crypto/aes.o" 577 1.1 christos srcs => [ "crypto/aes.c" ], 578 1.1 christos deps => [ ], 579 1.1 christos incs => [ "include" ], 580 1.1 christos intent => "lib"); 581 1.1 christos 582 1.1 christos src2obj(obj => "crypto/evp.o" 583 1.1 christos srcs => [ "crypto/evp.c" ], 584 1.1 christos deps => [ ], 585 1.1 christos incs => [ "include" ], 586 1.1 christos intent => "lib"); 587 1.1 christos 588 1.1 christos src2obj(obj => "crypto/cversion.o" 589 1.1 christos srcs => [ "crypto/cversion.c" ], 590 1.1 christos deps => [ "crypto/buildinf.h" ], 591 1.1 christos incs => [ "include" ], 592 1.1 christos intent => "lib"); 593 1.1 christos 594 1.1 christos generatesrc(src => "crypto/buildinf.h", 595 1.1 christos generator => [ "util/mkbuildinf.pl", "\"$(CC)", 596 1.1 christos "$(CFLAGS)\"", "\"$(PLATFORM)\"" ], 597 1.1 christos generator_incs => [ "util" ], 598 1.1 christos generator_deps => [ "util/Foo.pm" ], 599 1.1 christos incs => [ ], 600 1.1 christos deps => [ ], 601 1.1 christos intent => "lib"); 602 1.1 christos 603 1.1 christos The returned strings from all those calls are then concatenated 604 1.1 christos together and written to the resulting build-file. 605