build.ck 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. /*++
  2. Copyright (c) 2016 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. Minoca OS
  9. Abstract:
  10. This module contains the top level build target for Minoca OS.
  11. Author:
  12. Evan Green 14-Apr-2016
  13. Environment:
  14. Build
  15. --*/
  16. function build() {
  17. cflags_line = "$BASE_CPPFLAGS $CPPFLAGS $BASE_CFLAGS $CFLAGS " +
  18. "-MMD -MF $OUT.d ";
  19. cc = {
  20. "type": "tool",
  21. "name": "cc",
  22. "command": "$CC " + cflags_line + "-c -o $OUT $IN",
  23. "description": "Compiling - $IN",
  24. "depsformat": "gcc",
  25. "depfile": "$OUT.d"
  26. };
  27. cxx = {
  28. "type": "tool",
  29. "name": "cxx",
  30. "command": "$CXX " + cflags_line + "-c -o $OUT $IN",
  31. "description": "Compiling - $IN",
  32. "depsformat": "gcc",
  33. "depfile": "$OUT.d"
  34. };
  35. ldflags_line = "-Wl,-Map=$OUT.map $BASE_LDFLAGS $LDFLAGS ";
  36. ld = {
  37. "type": "tool",
  38. "name": "ld",
  39. "command": "$CC " + ldflags_line + "-o $OUT $IN -Bdynamic $DYNLIBS",
  40. "description": "Linking - $OUT",
  41. };
  42. ar = {
  43. "type": "tool",
  44. "name": "ar",
  45. "command": "$AR rcs $OUT $IN",
  46. "description": "Building Library - $OUT",
  47. };
  48. asflags_line = cflags_line + "$BASE_ASFLAGS $ASFLAGS ";
  49. as = {
  50. "type": "tool",
  51. "name": "as",
  52. "command": "$CC " + asflags_line + "-c -o $OUT $IN",
  53. "description": "Assembling - $IN",
  54. "depsformat": "gcc",
  55. "depfile": "$OUT.d"
  56. };
  57. objcopy = {
  58. "type": "tool",
  59. "name": "objcopy",
  60. "command": "$SHELL -c \"cd `dirname $IN` && $OBJCOPY $OBJCOPY_FLAGS `basename $IN` $OUT\"",
  61. "description": "Objectifying - $IN"
  62. };
  63. strip_tool = {
  64. "type": "tool",
  65. "name": "strip",
  66. "command": "$STRIP $STRIP_FLAGS -o $OUT $IN",
  67. "description": "Stripping - $OUT",
  68. };
  69. build_cflags_line = "$BUILD_BASE_CPPFLAGS $CPPFLAGS $BUILD_BASE_CFLAGS " +
  70. "$CFLAGS -MMD -MF $OUT.d ";
  71. build_cc = {
  72. "type": "tool",
  73. "name": "build_cc",
  74. "command": "$BUILD_CC " + build_cflags_line + "-c -o $OUT $IN",
  75. "description": "Compiling - $IN",
  76. "depsformat": "gcc",
  77. "depfile": "$OUT.d"
  78. };
  79. build_cxx = {
  80. "type": "tool",
  81. "name": "build_cxx",
  82. "command": "$BUILD_CXX " + build_cflags_line + "-c -o $OUT $IN",
  83. "description": "Compiling - $IN",
  84. "depsformat": "gcc",
  85. "depfile": "$OUT.d"
  86. };
  87. build_ldflags_line = "-Wl,-Map=$OUT.map $BUILD_BASE_LDFLAGS $LDFLAGS ";
  88. build_ld = {
  89. "type": "tool",
  90. "name": "build_ld",
  91. "command": "$BUILD_CC " + build_ldflags_line + "-o $OUT $IN -Bdynamic $DYNLIBS",
  92. "description": "Linking - $OUT",
  93. };
  94. build_ar = {
  95. "type": "tool",
  96. "name": "build_ar",
  97. "command": "$BUILD_AR rcs $OUT $IN",
  98. "description": "Building Library - $OUT",
  99. };
  100. build_asflags_line = build_cflags_line + "$BUILD_BASE_ASFLAGS $ASFLAGS ";
  101. build_as = {
  102. "type": "tool",
  103. "name": "build_as",
  104. "command": "$BUILD_CC " + build_asflags_line + "-c -o $OUT $IN",
  105. "description": "Assembling - $IN",
  106. "depsformat": "gcc",
  107. "depfile": "$OUT.d"
  108. };
  109. build_strip = {
  110. "type": "tool",
  111. "name": "build_strip",
  112. "command": "$BUILD_STRIP $STRIP_FLAGS -o $OUT $IN",
  113. "description": "Stripping - $OUT",
  114. };
  115. build_rcc = {
  116. "type": "tool",
  117. "name": "build_rcc",
  118. "command": "$RCC -o $OUT $IN",
  119. "description": "Compiling Resource - $IN",
  120. };
  121. iasl = {
  122. "type": "tool",
  123. "name": "iasl",
  124. "command": "$SHELL -c \"$IASL $IASL_FLAGS -p $OUT $IN > $OUT.stdout\"",
  125. "description": "Compiling ASL - $IN"
  126. };
  127. cp = {
  128. "type": "tool",
  129. "name": "copy",
  130. "command": "$SHELL -c \"cp $CPFLAGS $IN $OUT && [ -z $CHMOD_FLAGS ] || chmod $CHMOD_FLAGS $OUT\"",
  131. "description": "Copying - $IN -> $OUT"
  132. };
  133. if (build_os == "Windows") {
  134. symlink_command = "cp $IN $OUT";
  135. } else {
  136. symlink_command = "ln -sf $SYMLINK_IN $OUT";
  137. }
  138. symlink = {
  139. "type": "tool",
  140. "name": "symlink",
  141. "command": symlink_command,
  142. "description": "Symlinking - $OUT"
  143. };
  144. stamp = {
  145. "type": "tool",
  146. "name": "stamp",
  147. "command": "$SHELL -c \"date > $OUT\"",
  148. "description": "Stamp - $OUT"
  149. };
  150. touch = {
  151. "type": "tool",
  152. "name": "touch",
  153. "command": "touch $OUT",
  154. "description": "Touch - $OUT"
  155. };
  156. gen_version = {
  157. "type": "tool",
  158. "name": "gen_version",
  159. "command": "$SHELL $//tasks/build/print_version.sh $OUT $FORM $MAJOR $MINOR $REVISION $RELEASE $SERIAL $BUILD_STRING",
  160. "description": "Versioning - $OUT"
  161. };
  162. config_entry = {
  163. "type": "global_config",
  164. "config": global_config
  165. };
  166. entries = [cc, cxx, ld, ar, as, objcopy, strip_tool,
  167. build_cc, build_cxx, build_ld, build_ar, build_as, build_rcc,
  168. build_strip, iasl, cp, symlink, stamp, touch, gen_version,
  169. config_entry];
  170. all = [
  171. "//lib:test_apps",
  172. "//images:"
  173. ];
  174. all_group = group("all", all);
  175. all_group[0]["default"] = TRUE;
  176. entries += all_group;
  177. return entries;
  178. }
  179. return build();