build.ck 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*++
  2. Copyright (c) 2017 Minoca Corp.
  3. This file is licensed under the terms of the GNU General Public License
  4. version 3. Alternative licensing terms are available. Contact
  5. info@minocacorp.com for details. See the LICENSE file at the root of this
  6. project for complete licensing information.
  7. Module Name:
  8. Spawn Module
  9. Abstract:
  10. This directory builds the spawn module, which is used to launch other
  11. processes in Chalk.
  12. Author:
  13. Evan Green 21-Jun-2017
  14. Environment:
  15. C
  16. --*/
  17. from menv import compiledSources, group, mconfig, staticLibrary;
  18. from apps.ck.modules.build import chalkSharedModule;
  19. function build() {
  20. var buildOs = mconfig.build_os;
  21. var buildSources;
  22. var commonSources;
  23. var lib;
  24. var entries;
  25. var objs;
  26. var posixSources;
  27. var win32Sources;
  28. commonSources = [
  29. "entry.c",
  30. "spawn.c"
  31. ];
  32. posixSources = ["uos.c"];
  33. win32Sources = ["win32.c"];
  34. //
  35. // Create the static and dynamic versions of the module targeted at Minoca.
  36. //
  37. lib = {
  38. "label": "spawn_static",
  39. "output": "spawn",
  40. "inputs": commonSources + posixSources
  41. };
  42. objs = compiledSources(lib);
  43. entries = staticLibrary(lib);
  44. lib = {
  45. "label": "spawn_dynamic",
  46. "output": "spawn",
  47. "inputs": objs[0]
  48. };
  49. entries += chalkSharedModule(lib);
  50. //
  51. // Create the static and dynamic versions of the module for the build
  52. // machine.
  53. //
  54. if (buildOs == "Windows") {
  55. buildSources = commonSources + win32Sources;
  56. } else {
  57. buildSources = commonSources + posixSources;
  58. }
  59. lib = {
  60. "label": "build_spawn_static",
  61. "output": "spawn",
  62. "inputs": buildSources,
  63. "build": true,
  64. "prefix": "build"
  65. };
  66. objs = compiledSources(lib);
  67. entries += staticLibrary(lib);
  68. lib = {
  69. "label": "build_spawn_dynamic",
  70. "output": "spawn",
  71. "inputs": objs[0],
  72. "build": true,
  73. "prefix": "build"
  74. };
  75. entries += chalkSharedModule(lib);
  76. entries += group("all", [":spawn_static", ":spawn_dynamic"]);
  77. entries += group("build_all",
  78. [":build_spawn_static", ":build_spawn_dynamic"]);
  79. return entries;
  80. }