build.ck 5.6 KB

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