BUILD 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  1. load('//sys/src/FLAGS', "KLIB_COMPILER_FLAGS", "LIB_COMPILER_FLAGS")
  2. LIBC_SRCS = [
  3. "9sys/access.c",
  4. "9sys/announce.c",
  5. "9sys/convD2M.c",
  6. "9sys/convM2D.c",
  7. "9sys/convM2S.c",
  8. "9sys/convS2M.c",
  9. "9sys/cputime.c",
  10. "9sys/ctime.c",
  11. "9sys/dial.c",
  12. "9sys/dirfstat.c",
  13. "9sys/dirfwstat.c",
  14. "9sys/dirmodefmt.c",
  15. "9sys/dirread.c",
  16. "9sys/dirstat.c",
  17. "9sys/dirwstat.c",
  18. "9sys/fcallfmt.c",
  19. "9sys/fork.c",
  20. "9sys/getnetconninfo.c",
  21. "9sys/getenv.c",
  22. "9sys/getpid.c",
  23. "9sys/getppid.c",
  24. "9sys/getwd.c",
  25. "9sys/iounit.c",
  26. "9sys/nulldir.c",
  27. "9sys/postnote.c",
  28. "9sys/privalloc.c",
  29. "9sys/pushssl.c",
  30. "9sys/pushtls.c",
  31. "9sys/putenv.c",
  32. "9sys/qlock.c",
  33. "9sys/read9pmsg.c",
  34. "9sys/read.c",
  35. "9sys/readv.c",
  36. "9sys/rerrstr.c",
  37. "9sys/sbrk.c",
  38. "9sys/setnetmtpt.c",
  39. "9sys/sysfatal.c",
  40. "9sys/syslog.c",
  41. "9sys/sysname.c",
  42. "9sys/time.c",
  43. "9sys/times.c",
  44. "9sys/tm2sec.c",
  45. "9sys/truerand.c",
  46. "9sys/wait.c",
  47. "9sys/waitpid.c",
  48. "9sys/werrstr.c",
  49. "9sys/write.c",
  50. "9sys/writev.c",
  51. "9syscall/alarm.s",
  52. "9syscall/await.s",
  53. "9syscall/bind.s",
  54. "9syscall/brk_.s",
  55. "9syscall/chdir.s",
  56. "9syscall/close.s",
  57. "9syscall/create.s",
  58. "9syscall/dup.s",
  59. "9syscall/errstr.s",
  60. "9syscall/exec.s",
  61. "9syscall/_exits.s",
  62. "9syscall/fauth.s",
  63. "9syscall/fd2path.s",
  64. "9syscall/fstat.s",
  65. "9syscall/fversion.s",
  66. "9syscall/fwstat.s",
  67. "9syscall/mount.s",
  68. "9syscall/noted.s",
  69. "9syscall/notify.s",
  70. "9syscall/nsec.s",
  71. "9syscall/open.s",
  72. "9syscall/pipe.s",
  73. "9syscall/pread.s",
  74. "9syscall/pwrite.s",
  75. "9syscall/remove.s",
  76. "9syscall/rendezvous.s",
  77. "9syscall/rfork.s",
  78. "9syscall/seek.s",
  79. "9syscall/segattach.s",
  80. "9syscall/segbrk.s",
  81. "9syscall/segdetach.s",
  82. "9syscall/segflush.s",
  83. "9syscall/segfree.s",
  84. "9syscall/semacquire.s",
  85. "9syscall/semrelease.s",
  86. "9syscall/sleep.s",
  87. "9syscall/stat.s",
  88. "9syscall/tsemacquire.s",
  89. "9syscall/unmount.s",
  90. "9syscall/wstat.s",
  91. "fmt/dofmt.c",
  92. "fmt/dorfmt.c",
  93. "fmt/errfmt.c",
  94. "fmt/fltfmt.c",
  95. "fmt/fmt.c",
  96. "fmt/fmtfd.c",
  97. "fmt/fmtlock.c",
  98. "fmt/fmtprint.c",
  99. "fmt/fmtquote.c",
  100. "fmt/fmtrune.c",
  101. "fmt/fmtstr.c",
  102. "fmt/fmtvprint.c",
  103. "fmt/fprint.c",
  104. "fmt/print.c",
  105. "fmt/runefmtstr.c",
  106. "fmt/runeseprint.c",
  107. "fmt/runesmprint.c",
  108. "fmt/runesnprint.c",
  109. "fmt/runesprint.c",
  110. "fmt/runevseprint.c",
  111. "fmt/runevsmprint.c",
  112. "fmt/runevsnprint.c",
  113. "fmt/seprint.c",
  114. "fmt/smprint.c",
  115. "fmt/snprint.c",
  116. "fmt/sprint.c",
  117. "fmt/vfprint.c",
  118. "fmt/vseprint.c",
  119. "fmt/vsmprint.c",
  120. "fmt/vsnprint.c",
  121. "port/_assert.c",
  122. "port/abs.c",
  123. "port/asin.c",
  124. "port/atan.c",
  125. "port/atan2.c",
  126. "port/atexit.c",
  127. "port/atnotify.c",
  128. "port/atof.c",
  129. "port/atol.c",
  130. "port/atoll.c",
  131. "port/cistrcmp.c",
  132. "port/cistrncmp.c",
  133. "port/cistrstr.c",
  134. "port/charstod.c",
  135. "port/cleanname.c",
  136. "port/ctype.c",
  137. "port/encodefmt.c",
  138. "port/execl.c",
  139. "port/exp.c",
  140. "port/fabs.c",
  141. "port/floor.c",
  142. "port/fmod.c",
  143. "port/frand.c",
  144. "port/frexp.c",
  145. "port/getfields.c",
  146. "port/getuser.c",
  147. "port/hangup.c",
  148. "port/hypot.c",
  149. "port/lnrand.c",
  150. "port/lock.c",
  151. "port/log.c",
  152. "port/lrand.c",
  153. "port/malloc.c",
  154. "port/memccpy.c",
  155. "port/memchr.c",
  156. "port/memcmp.c",
  157. "port/memmove.c",
  158. "port/memset.c",
  159. "port/mktemp.c",
  160. "port/muldiv.c",
  161. "port/nan.c",
  162. "port/needsrcquote.c",
  163. "port/netmkaddr.c",
  164. "port/nrand.c",
  165. "port/ntruerand.c",
  166. "port/perror.c",
  167. "port/pool.c",
  168. "port/pow.c",
  169. "port/pow10.c",
  170. "port/qsort.c",
  171. "port/quote.c",
  172. "port/rand.c",
  173. "port/readn.c",
  174. "port/reallocarray.c",
  175. "port/rijndael.c",
  176. "port/rune.c",
  177. "port/runebase.c",
  178. "port/runebsearch.c",
  179. "port/runestrcat.c",
  180. "port/runestrchr.c",
  181. "port/runestrcmp.c",
  182. "port/runestrcpy.c",
  183. "port/runestrecpy.c",
  184. "port/runestrdup.c",
  185. "port/runestrncat.c",
  186. "port/runestrncmp.c",
  187. "port/runestrncpy.c",
  188. "port/runestrrchr.c",
  189. "port/runestrlen.c",
  190. "port/runestrstr.c",
  191. "port/runetype.c",
  192. "port/sha2.c",
  193. "port/sin.c",
  194. "port/sinh.c",
  195. "port/slice.c",
  196. "port/strcat.c",
  197. "port/strchr.c",
  198. "port/strcmp.c",
  199. "port/strcpy.c",
  200. "port/strecpy.c",
  201. "port/strcspn.c",
  202. "port/strdup.c",
  203. "port/strlcat.c",
  204. "port/strlcpy.c",
  205. "port/strlen.c",
  206. "port/strncat.c",
  207. "port/strncmp.c",
  208. "port/strncpy.c",
  209. "port/strpbrk.c",
  210. "port/strrchr.c",
  211. "port/strspn.c",
  212. "port/strstr.c",
  213. "port/strtod.c",
  214. "port/strtok.c",
  215. "port/strtol.c",
  216. "port/strtoll.c",
  217. "port/strtoul.c",
  218. "port/strtoull.c",
  219. "port/tan.c",
  220. "port/tanh.c",
  221. "port/tokenize.c",
  222. "port/toupper.c",
  223. "port/utfecpy.c",
  224. "port/utflen.c",
  225. "port/utfnlen.c",
  226. "port/utfrune.c",
  227. "port/utfrrune.c",
  228. "port/utfutf.c",
  229. "port/u16.c",
  230. "port/u32.c",
  231. "port/u64.c",
  232. "${ARCH}/notejmp.c",
  233. "${ARCH}/cycles.c",
  234. "${ARCH}/argv0.c",
  235. "port/getcallerpc.c",
  236. "port/getcallstack.c",
  237. "${ARCH}/rdpmc.c",
  238. "${ARCH}/setjmp.s",
  239. "${ARCH}/sqrt.s",
  240. "${ARCH}/tas.s",
  241. "${ARCH}/atom.S",
  242. "${ARCH}/main9.S"
  243. ]
  244. KLIBC_SRCS = [
  245. "9sys/access.c",
  246. "9sys/announce.c",
  247. "9sys/convD2M.c",
  248. "9sys/convM2D.c",
  249. "9sys/convM2S.c",
  250. "9sys/convS2M.c",
  251. "9sys/cputime.c",
  252. "9sys/ctime.c",
  253. "9sys/dial.c",
  254. "9sys/dirfstat.c",
  255. "9sys/dirfwstat.c",
  256. "9sys/dirmodefmt.c",
  257. "9sys/dirread.c",
  258. "9sys/dirstat.c",
  259. "9sys/dirwstat.c",
  260. "9sys/fcallfmt.c",
  261. "9sys/fork.c",
  262. "9sys/getnetconninfo.c",
  263. "9sys/getenv.c",
  264. "9sys/getpid.c",
  265. "9sys/getppid.c",
  266. "9sys/getwd.c",
  267. "9sys/iounit.c",
  268. "9sys/nulldir.c",
  269. "9sys/postnote.c",
  270. "9sys/privalloc.c",
  271. "9sys/pushssl.c",
  272. "9sys/pushtls.c",
  273. "9sys/putenv.c",
  274. "9sys/qlock.c",
  275. "9sys/read9pmsg.c",
  276. "9sys/read.c",
  277. "9sys/readv.c",
  278. "9sys/rerrstr.c",
  279. "9sys/sbrk.c",
  280. "9sys/setnetmtpt.c",
  281. "9sys/sysfatal.c",
  282. "9sys/syslog.c",
  283. "9sys/sysname.c",
  284. "9sys/time.c",
  285. "9sys/times.c",
  286. "9sys/tm2sec.c",
  287. "9sys/truerand.c",
  288. "9sys/wait.c",
  289. "9sys/waitpid.c",
  290. "9sys/werrstr.c",
  291. "9sys/write.c",
  292. "9sys/writev.c",
  293. "fmt/dofmt.c",
  294. "fmt/dorfmt.c",
  295. "fmt/errfmt.c",
  296. "fmt/fltfmt.c",
  297. "fmt/fmt.c",
  298. "fmt/fmtfd.c",
  299. "fmt/fmtlock.c",
  300. "fmt/fmtprint.c",
  301. "fmt/fmtquote.c",
  302. "fmt/fmtrune.c",
  303. "fmt/fmtstr.c",
  304. "fmt/fmtvprint.c",
  305. "fmt/fprint.c",
  306. "fmt/print.c",
  307. "fmt/runefmtstr.c",
  308. "fmt/runeseprint.c",
  309. "fmt/runesmprint.c",
  310. "fmt/runesnprint.c",
  311. "fmt/runesprint.c",
  312. "fmt/runevseprint.c",
  313. "fmt/runevsmprint.c",
  314. "fmt/runevsnprint.c",
  315. "fmt/seprint.c",
  316. "fmt/smprint.c",
  317. "fmt/snprint.c",
  318. "fmt/sprint.c",
  319. "fmt/vfprint.c",
  320. "fmt/vseprint.c",
  321. "fmt/vsmprint.c",
  322. "fmt/vsnprint.c",
  323. "port/_assert.c",
  324. "port/abs.c",
  325. "port/asin.c",
  326. "port/atan.c",
  327. "port/atan2.c",
  328. "port/atexit.c",
  329. "port/atnotify.c",
  330. "port/atof.c",
  331. "port/atol.c",
  332. "port/atoll.c",
  333. "port/cistrcmp.c",
  334. "port/cistrncmp.c",
  335. "port/cistrstr.c",
  336. "port/charstod.c",
  337. "port/cleanname.c",
  338. "port/ctype.c",
  339. "port/encodefmt.c",
  340. "port/execl.c",
  341. "port/exp.c",
  342. "port/fabs.c",
  343. "port/floor.c",
  344. "port/fmod.c",
  345. "port/frand.c",
  346. "port/frexp.c",
  347. "port/getfields.c",
  348. "port/getuser.c",
  349. "port/hangup.c",
  350. "port/hypot.c",
  351. "port/lnrand.c",
  352. "port/lock.c",
  353. "port/log.c",
  354. "port/lrand.c",
  355. "port/malloc.c",
  356. "port/memccpy.c",
  357. "port/memchr.c",
  358. "port/memcmp.c",
  359. "port/memmove.c",
  360. "port/memset.c",
  361. "port/mktemp.c",
  362. "port/muldiv.c",
  363. "port/nan.c",
  364. "port/needsrcquote.c",
  365. "port/netmkaddr.c",
  366. "port/nrand.c",
  367. "port/ntruerand.c",
  368. "port/perror.c",
  369. "port/pool.c",
  370. "port/pow.c",
  371. "port/pow10.c",
  372. "port/qsort.c",
  373. "port/quote.c",
  374. "port/rand.c",
  375. "port/readn.c",
  376. "port/reallocarray.c",
  377. "port/rijndael.c",
  378. "port/rune.c",
  379. "port/runebase.c",
  380. "port/runebsearch.c",
  381. "port/runestrcat.c",
  382. "port/runestrchr.c",
  383. "port/runestrcmp.c",
  384. "port/runestrcpy.c",
  385. "port/runestrecpy.c",
  386. "port/runestrdup.c",
  387. "port/runestrncat.c",
  388. "port/runestrncmp.c",
  389. "port/runestrncpy.c",
  390. "port/runestrrchr.c",
  391. "port/runestrlen.c",
  392. "port/runestrstr.c",
  393. "port/runetype.c",
  394. "port/sha2.c",
  395. "port/sin.c",
  396. "port/sinh.c",
  397. "port/slice.c",
  398. "port/strcat.c",
  399. "port/strchr.c",
  400. "port/strcmp.c",
  401. "port/strcpy.c",
  402. "port/strecpy.c",
  403. "port/strcspn.c",
  404. "port/strdup.c",
  405. "port/strlcat.c",
  406. "port/strlcpy.c",
  407. "port/strlen.c",
  408. "port/strncat.c",
  409. "port/strncmp.c",
  410. "port/strncpy.c",
  411. "port/strpbrk.c",
  412. "port/strrchr.c",
  413. "port/strspn.c",
  414. "port/strstr.c",
  415. "port/strtod.c",
  416. "port/strtok.c",
  417. "port/strtol.c",
  418. "port/strtoll.c",
  419. "port/strtoul.c",
  420. "port/strtoull.c",
  421. "port/tan.c",
  422. "port/tanh.c",
  423. "port/tokenize.c",
  424. "port/toupper.c",
  425. "port/utfecpy.c",
  426. "port/utflen.c",
  427. "port/utfnlen.c",
  428. "port/utfrune.c",
  429. "port/utfrrune.c",
  430. "port/utfutf.c",
  431. "port/u16.c",
  432. "port/u32.c",
  433. "port/u64.c",
  434. "${ARCH}/notejmp.c",
  435. "${ARCH}/cycles.c",
  436. "${ARCH}/argv0.c",
  437. "port/getcallerpc.c",
  438. "port/getcallstack.c",
  439. "${ARCH}/rdpmc.c",
  440. "${ARCH}/setjmp.s",
  441. "${ARCH}/sqrt.s",
  442. "${ARCH}/tas.s",
  443. "${ARCH}/atom.S",
  444. "${ARCH}/main9.S"
  445. ]
  446. cc_library(
  447. name="klibc",
  448. copts=KLIB_COMPILER_FLAGS,
  449. includes=[
  450. "//sys/include",
  451. "//${ARCH}/include",
  452. "//sys/src/libc"
  453. ],
  454. srcs=KLIBC_SRCS,
  455. deps=[
  456. ":9syscall",
  457. ":syscallheader"
  458. ],
  459. alwayslink=true,
  460. )
  461. cc_library(
  462. name="libc",
  463. copts=LIB_COMPILER_FLAGS,
  464. includes=[
  465. "//sys/include",
  466. "//${ARCH}/include",
  467. "//sys/src/libc"
  468. ],
  469. srcs=LIBC_SRCS,
  470. deps=[
  471. ":9syscall",
  472. ":syscallheader"
  473. ]
  474. )
  475. mk_sys(
  476. name="syscallheader",
  477. mode="sys.h",
  478. arch=env("ARCH"),
  479. sysconf="//sys/src/sysconf.json",
  480. )
  481. mk_sys(
  482. name="9syscall",
  483. mode="syscallfiles",
  484. arch=env("ARCH"),
  485. sysconf="//sys/src/sysconf.json",
  486. )