Subversion Repositories Kolibri OS

Rev

Rev 8759 | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. if tup.getconfig("NO_GCC") ~= "" or tup.getconfig("NO_FASM") ~= "" then return end
  2. tup.include("../../../../../programs/use_gcc.lua")
  3. SDK_DIR = "../../.."
  4. CFLAGS =  "-c -O2 -fno-builtin -fno-ident -fomit-frame-pointer -DMISSING_SYSCALL_NAMES"
  5. LDFLAGS = "-shared -s -T libcdll.lds --out-implib " .. SDK_DIR .. "/lib/libc.dll.a --image-base 0"
  6. -- LDFLAGS = LDFLAGS .. " --output-def libc.orig.def"
  7.  
  8.  
  9. LIBC_TOPDIR = "."
  10. LIBC_INCLUDES = "include"
  11. NAME = "libc"
  12. DEFINES = "-U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -U_MSC_VER -D_MB_EXTENDED_CHARSETS_WINDOWS=1 -D_IEEE_LIBM -DHAVE_RENAME -DBUILD_LIBC"
  13. INCLUDES = "-Iinclude"
  14.  
  15. TOOLCHAIN_LIBPATH = tup.getconfig("TOOLCHAIN_LIBPATH")
  16. -- if not given explicitly in config, try to guess
  17. if TOOLCHAIN_LIBPATH == "" then
  18.   if tup.getconfig("TUP_PLATFORM") == "win32"
  19.   then TOOLCHAIN_LIBPATH="C:\\MinGW\\msys\\1.0\\home\\autobuild\\tools\\win32\\mingw32\\lib"
  20.   else TOOLCHAIN_LIBPATH="/home/autobuild/tools/win32/mingw32/lib"
  21.   end
  22. end
  23. LIBPATH = "-L" .. SDK_DIR .. "/lib"
  24. STATIC_SRCS = {"crt/start.S", "crt/crt2.c", "crt/exit.S"}
  25. LIBDLL_SRCS = {"crt/dllstart.c", "crt/exit.S", "crt/pseudo-reloc.c", "crt/setjmp.S"}
  26. LIBCDLL_SRCS = {
  27.   "crt/crt2.c",
  28.   "crt/pseudo-reloc.c",
  29.   "crt/exit.S"
  30. }
  31. CORE_SRCS = {
  32.   "argz/buf_findstr.c",
  33.   "argz/envz_get.c",
  34.   "crt/console.asm",
  35.   "crt/gthr-kos32.c",
  36.   "crt/thread.S",
  37.   "crt/setjmp.S",
  38.   "crt/cpu_features.c",
  39.   "crt/tls.c",
  40.   "ctype/ctype_.c",
  41.   "ctype/isascii.c",
  42.   "ctype/isblank.c",
  43.   "ctype/isalnum.c",
  44.   "ctype/isalpha.c",
  45.   "ctype/iscntrl.c",
  46.   "ctype/isdigit.c",
  47.   "ctype/islower.c",
  48.   "ctype/isupper.c",
  49.   "ctype/isprint.c",
  50.   "ctype/ispunct.c",
  51.   "ctype/isspace.c",
  52.   "ctype/iswctype.c",
  53.   "ctype/iswalnum.c",
  54.   "ctype/iswalpha.c",
  55.   "ctype/iswblank.c",
  56.   "ctype/iswcntrl.c",
  57.   "ctype/iswdigit.c",
  58.   "ctype/iswgraph.c",
  59.   "ctype/iswlower.c",
  60.   "ctype/iswprint.c",
  61.   "ctype/iswpunct.c",
  62.   "ctype/iswspace.c",
  63.   "ctype/iswupper.c",
  64.   "ctype/iswxdigit.c",
  65.   "ctype/isxdigit.c",
  66.   "ctype/jp2uc.c",
  67.   "ctype/toascii.c",
  68.   "ctype/tolower.c",
  69.   "ctype/toupper.c",
  70.   "ctype/towctrans.c",
  71.   "ctype/towlower.c",
  72.   "ctype/towupper.c",
  73.   "ctype/wctrans.c",
  74.   "ctype/wctype.c",
  75.   "errno/errno.c",
  76.   "locale/locale.c",
  77.   "locale/lctype.c",
  78.   "locale/ldpart.c",
  79.   "reent/closer.c",
  80.   "reent/fstatr.c",
  81.   "reent/getreent.c",
  82.   "reent/gettimeofdayr.c",
  83.   "reent/impure.c",
  84.   "reent/init_reent.c",
  85.   "reent/isattyr.c",
  86.   "reent/linkr.c",
  87.   "reent/lseekr.c",
  88.   "reent/mutex.c",
  89.   "reent/openr.c",
  90.   "reent/readr.c",
  91.   "reent/statr.c",
  92.   "reent/timesr.c",
  93.   "reent/unlinkr.c",
  94.   "reent/writer.c",
  95.   "search/qsort.c",
  96.   "search/bsearch.c",
  97.   "signal/signal.c",
  98.   "sys/access.c",
  99.   "sys/clock_gettime.c",
  100.   "sys/close.c",
  101.   "sys/conio.c",
  102.   "sys/create.c",
  103.   "sys/errno.c",
  104.   "sys/finfo.c",
  105.   "sys/fsize.c",
  106.   "sys/fstat.c",
  107.   "sys/gettod.c",
  108.   "sys/io.c",
  109.   "sys/ioread.c",
  110.   "sys/iowrite.c",
  111.   "sys/isatty.c",
  112.   "sys/lseek.c",
  113.   "sys/open.c",
  114.   "sys/read.c",
  115.   "sys/_rename.c",
  116.   "sys/stat.c",
  117.   "sys/unlink.c",
  118.   "sys/write.c",
  119.   "sys/io_alloc.S",
  120.   "time/asctime.c",
  121.   "time/asctime_r.c",
  122.   "time/clock.c",
  123.   "time/ctime.c",
  124.   "time/ctime_r.c",
  125.   "time/difftime.c",
  126.   "time/gettzinfo.c",
  127.   "time/gmtime.c",
  128.   "time/gmtime_r.c",
  129.   "time/mktime.c",
  130.   "time/month_lengths.c",
  131.   "time/lcltime.c",
  132.   "time/lcltime_r.c",
  133.   "time/strftime.c",
  134.   "time/time.c",
  135.   "time/tzcalc_limits.c",
  136.   "time/timelocal.c",
  137.   "time/tzlock.c",
  138.   "time/tzset.c",
  139.   "time/tzset_r.c",
  140.   "time/tzvars.c"
  141. }
  142. STDLIB_SRCS = {
  143.   "__atexit.c",
  144.   "__call_atexit.c",
  145.   "abort.c",
  146.   "abs.c",
  147.   "assert.c",
  148.   "atexit.c",
  149.   "atof.c",
  150.   "atoi.c",
  151.   "atol.c",
  152.   "btowc.c",
  153.   "calloc.c",
  154.   "cxa_atexit.c",
  155.   "cxa_finalize.c",
  156.   "div.c",
  157.   "dtoa.c",
  158.   "dtoastub.c",
  159.   "efgcvt.c",
  160.   "ecvtbuf.c",
  161.   "eprintf.c",
  162.   "erand48.c",
  163.   "exit.c",
  164.   "gdtoa-gethex.c",
  165.   "gdtoa-hexnan.c",
  166.   "getenv.c",
  167.   "getenv_r.c",
  168.   "itoa.c",
  169.   "ldiv.c",
  170.   "labs.c",
  171.   "ldtoa.c",
  172.   "malloc.c",
  173.   "mallocr.c",
  174.   "mblen.c",
  175.   "mblen_r.c",
  176.   "mbrlen.c",
  177.   "mbrtowc.c",
  178.   "mbsinit.c",
  179.   "mbsnrtowcs.c",
  180.   "mbsrtowcs.c",
  181.   "mbstowcs.c",
  182.   "mbstowcs_r.c",
  183.   "mbtowc.c",
  184.   "mbtowc_r.c",
  185.   "mlock.c",
  186.   "mprec.c",
  187.   "rand.c",
  188.   "rand_r.c",
  189.   "rand48.c",
  190.   "random.c",
  191.   "realloc.c",
  192.   "sb_charsets.c",
  193.   "seed48.c",
  194.   "srand48.c",
  195.   "strtod.c",
  196.   "strtodg.c",
  197.   "strtol.c",
  198.   "strtold.c",
  199.   "strtoll.c",
  200.   "strtoll_r.c",
  201.   "strtorx.c",
  202.   "strtoul.c",
  203.   "strtoull.c",
  204.   "strtoull_r.c",
  205.   "system.c",
  206.   "utoa.c",
  207.   "wcrtomb.c",
  208.   "wcsnrtombs.c",
  209.   "wcsrtombs.c",
  210.   "wcstod.c",
  211.   "wcstol.c",
  212.   "wcstold.c",
  213.   "wcstoll.c",
  214.   "wcstoll_r.c",
  215.   "wcstombs.c",
  216.   "wcstombs_r.c",
  217.   "wcstoul.c",
  218.   "wcstoull.c",
  219.   "wcstoull_r.c",
  220.   "wctob.c",
  221.   "wctomb.c",
  222.   "wctomb_r.c"
  223. }
  224. STRING_SRCS = {
  225.   "bcmp.c",
  226.   "bcopy.c",
  227.   "bzero.c",
  228.   "explicit_bzero.c",
  229.   "gnu_basename.c",
  230.   "index.c",
  231.   "memccpy.c",
  232.   "memchr.c",
  233.   "memcmp.c",
  234.   "memcpy.c",
  235.   "memmem.c",
  236.   "memmove.c",
  237.   "mempcpy.c",
  238.   "memrchr.c",
  239.   "memset.c",
  240.   "rawmemchr.c",
  241.   "rindex.c",
  242.   "stpcpy.c",
  243.   "stpncpy.c",
  244.   "strcasecmp.c",
  245.   "strcasestr.c",
  246.   "strcat.c",
  247.   "strchr.c",
  248.   "strchrnul.c",
  249.   "strcmp.c",
  250.   "strcoll.c",
  251.   "strcpy.c",
  252.   "strcspn.c",
  253.   "strdup.c",
  254.   "strdup_r.c",
  255.   "strerror.c",
  256.   "strerror_r.c",
  257.   "strlcat.c",
  258.   "strlcpy.c",
  259.   "strlen.c",
  260.   "strlwr.c",
  261.   "strncasecmp.c",
  262.   "strncat.c",
  263.   "strncmp.c",
  264.   "strncpy.c",
  265.   "strndup.c",
  266.   "strndup_r.c",
  267.   "strnlen.c",
  268.   "strpbrk.c",
  269.   "strrchr.c",
  270.   "strsep.c",
  271.   "strspn.c",
  272.   "strstr.c",
  273.   "strtok.c",
  274.   "strtok_r.c",
  275.   "strupr.c",
  276.   "strxfrm.c",
  277.   "swab.c",
  278.   "u_strerr.c",
  279.   "wcpcpy.c",
  280.   "wcpncpy.c",
  281.   "wcscasecmp.c",
  282.   "wcscat.c",
  283.   "wcschr.c",
  284.   "wcscmp.c",
  285.   "wcscoll.c",
  286.   "wcscpy.c",
  287.   "wcscspn.c",
  288.   "wcsdup.c",
  289.   "wcslcat.c",
  290.   "wcslcpy.c",
  291.   "wcslen.c",
  292.   "wcsncasecmp.c",
  293.   "wcsncat.c",
  294.   "wcsncmp.c",
  295.   "wcsncpy.c",
  296.   "wcsnlen.c",
  297.   "wcspbrk.c",
  298.   "wcsrchr.c",
  299.   "wcsspn.c",
  300.   "wcsstr.c",
  301.   "wcstok.c",
  302.   "wcswidth.c",
  303.   "wcsxfrm.c",
  304.   "wcwidth.c",
  305.   "wmemchr.c",
  306.   "wmemcmp.c",
  307.   "wmemcpy.c",
  308.   "wmemmove.c",
  309.   "wmemset.c",
  310.   "dirname.c"
  311. }
  312.  
  313. STDIO_SRCS = {
  314.   "asiprintf.c",
  315.   "asniprintf.c",
  316.   "asnprintf.c",
  317.   "asprintf.c",
  318.   "clearerr.c",
  319.   "clearerr_u.c",
  320.   "diprintf.c",
  321.   "dprintf.c",
  322.   "fclose.c",
  323.   "fcloseall.c",
  324.   "fdopen.c",
  325.   "feof.c",
  326.   "feof_u.c",
  327.   "ferror.c",
  328.   "ferror_u.c",
  329.   "fflush.c",
  330.   "fflush_u.c",
  331.   "fgetc.c",
  332.   "fgetc_u.c",
  333.   "fgetpos.c",
  334.   "fgets.c",
  335.   "fgets_u.c",
  336.   "fgetwc.c",
  337.   "fgetwc_u.c",
  338.   "fgetws.c",
  339.   "fgetws_u.c",
  340.   "fileno.c",
  341.   "fileno_u.c",
  342.   "findfp.c",
  343.   "fiprintf.c",
  344.   "fiscanf.c",
  345.   "flags.c",
  346.   "fmemopen.c",
  347.   "fopen.c",
  348.   "fopencookie.c",
  349.   "fprintf.c",
  350.   "fpurge.c",
  351.   "fputc.c",
  352.   "fputc_u.c",
  353.   "fputs.c",
  354.   "fputs_u.c",
  355.   "fputwc.c",
  356.   "fputwc_u.c",
  357.   "fputws.c",
  358.   "fputws_u.c",
  359.   "fsetpos.c",
  360.   "funopen.c",
  361.   "fread.c",
  362.   "fread_u.c",
  363.   "freopen.c",
  364.   "fscanf.c",
  365.   "fseek.c",
  366.   "fseeko.c",
  367.   "fsetlocking.c",
  368.   "ftell.c",
  369.   "ftello.c",
  370.   "fvwrite.c",
  371.   "fwalk.c",
  372.   "fwide.c",
  373.   "fwprintf.c",
  374.   "fwrite.c",
  375.   "fwrite_u.c",
  376.   "fwscanf.c",
  377.   "getc.c",
  378.   "getc_u.c",
  379.   "getchar.c",
  380.   "getchar_u.c",
  381.   "getdelim.c",
  382.   "getline.c",
  383.   "gets.c",
  384.   "getw.c",
  385.   "getwc.c",
  386.   "getwc_u.c",
  387.   "getwchar.c",
  388.   "getwchar_u.c",
  389.   "iprintf.c",
  390.   "iscanf.c",
  391.   "makebuf.c",
  392.   "mktemp.c",
  393.   "open_memstream.c",
  394.   "perror.c",
  395.   "printf.c",
  396.   "putc.c",
  397.   "putc_u.c",
  398.   "putchar.c",
  399.   "putchar_u.c",
  400.   "puts.c",
  401.   "putw.c",
  402.   "putwc.c",
  403.   "putwc_u.c",
  404.   "putwchar.c",
  405.   "putwchar_u.c",
  406.   "refill.c",
  407.   "remove.c",
  408.   "rename.c",
  409.   "rewind.c",
  410.   "rget.c",
  411.   "scanf.c",
  412.   "sccl.c",
  413.   "setbuf.c",
  414.   "setbuffer.c",
  415.   "setlinebuf.c",
  416.   "setvbuf.c",
  417.   "siprintf.c",
  418.   "siscanf.c",
  419.   "sniprintf.c",
  420.   "snprintf.c",
  421.   "sprintf.c",
  422.   "sscanf.c",
  423.   "stdio.c",
  424.   "stdio_ext.c",
  425.   "swprintf.c",
  426.   "swscanf.c",
  427.   "tmpfile.c",
  428.   "tmpnam.c",
  429.   "ungetc.c",
  430.   "ungetwc.c",
  431.   "vasiprintf.c",
  432.   "vasniprintf.c",
  433.   "vasnprintf.c",
  434.   "vasprintf.c",
  435.   "vdiprintf.c",
  436.   "vdprintf.c",
  437.   "vfwscanf.c",
  438.   "viprintf.c",
  439.   "viscanf.c",
  440.   "vprintf.c",
  441.   "vscanf.c",
  442.   "vsiprintf.c",
  443.   "vsiscanf.c",
  444.   "vsprintf.c",
  445.   "vsniprintf.c",
  446.   "vsnprintf.c",
  447.   "vsscanf.c",
  448.   "vswprintf.c",
  449.   "vswscanf.c",
  450.   "vwprintf.c",
  451.   "vwscanf.c",
  452.   "wbuf.c",
  453.   "wprintf.c",
  454.   "wscanf.c",
  455.   "wsetup.c"
  456. }
  457.  
  458. DIRENT_SRCS = {
  459.                 "dir.c",
  460.                 "closedir.c",
  461.                 "opendir.c",
  462.                 "readdir.c",
  463.                 "rewinddir.c",
  464.                 "seekdir.c",
  465.                 "telldir.c",
  466.                 "scandir.c",
  467.                 "alphasort.c",
  468. }
  469.  
  470. MATH_SRCS = {
  471.   "e_acos.c", "e_acosh.c", "e_asin.c", "e_atan2.c", "e_atanh.c", "e_cosh.c", "e_exp.c", "e_fmod.c",
  472.   "e_hypot.c", "e_j0.c", "e_j1.c", "e_jn.c", "e_log.c", "e_log10.c", "e_pow.c", "e_rem_pio2.c",
  473.   "e_remainder.c", "e_scalb.c", "e_sinh.c", "e_sqrt.c", "ef_acos.c", "ef_acosh.c", "ef_asin.c",
  474.   "ef_atan2.c", "ef_atanh.c", "ef_cosh.c", "ef_exp.c", "ef_fmod.c", "ef_hypot.c", "ef_j0.c", "ef_j1.c",
  475.   "ef_jn.c", "ef_log.c", "ef_log10.c", "ef_pow.c", "ef_rem_pio2.c", "ef_remainder.c", "ef_scalb.c",
  476.   "ef_sinh.c", "ef_sqrt.c", "er_gamma.c", "er_lgamma.c", "erf_gamma.c", "erf_lgamma.c", "f_exp.c",
  477.   "f_expf.c", "f_llrint.c", "f_llrintf.c", "f_llrintl.c", "f_lrint.c", "f_lrintf.c", "f_lrintl.c",
  478.   "f_pow.c", "f_powf.c", "f_rint.c", "f_rintf.c", "f_rintl.c", "feclearexcept.c", "fetestexcept.c",
  479.   "k_cos.c", "k_rem_pio2.c", "k_sin.c", "k_standard.c", "k_tan.c", "kf_cos.c", "kf_rem_pio2.c", "kf_sin.c",
  480.   "kf_tan.c", "s_asinh.c", "s_atan.c", "s_cbrt.c", "s_ceil.c", "s_copysign.c", "s_cos.c", "s_erf.c", "s_exp10.c", "s_expm1.c",
  481.   "s_fabs.c", "s_fdim.c", "s_finite.c", "s_floor.c", "s_fma.c", "s_fmax.c", "s_fmin.c", "s_fpclassify.c",
  482.   "s_frexp.c", "s_ilogb.c", "s_infconst.c", "s_infinity.c", "s_isinf.c", "s_isinfd.c", "s_isnan.c",
  483.   "s_isnand.c", "s_ldexp.c", "s_lib_ver.c", "s_llrint.c", "s_llround.c", "s_log1p.c", "s_log2.c",
  484.   "s_logb.c", "s_lrint.c", "s_lround.c", "s_matherr.c", "s_modf.c", "s_nan.c", "s_nearbyint.c",
  485.   "s_nextafter.c", "s_pow10.c", "s_remquo.c", "s_rint.c", "s_round.c", "s_scalbln.c", "s_scalbn.c",
  486.   "s_signbit.c", "s_signif.c", "s_sin.c", "s_tan.c", "s_tanh.c", "s_trunc.c", "scalblnl.c", "scalbnl.c",
  487.   "sf_asinh.c", "sf_atan.c", "sf_cbrt.c", "sf_ceil.c", "sf_copysign.c", "sf_cos.c", "sf_erf.c",
  488.   "sf_exp10.c", "sf_expm1.c", "sf_fabs.c", "sf_fdim.c", "sf_finite.c", "sf_floor.c", "sf_fma.c",
  489.   "sf_fmax.c", "sf_fmin.c", "sf_fpclassify.c", "sf_frexp.c", "sf_ilogb.c", "sf_infinity.c",
  490.   "sf_isinf.c", "sf_isinff.c", "sf_isnan.c", "sf_isnanf.c", "sf_ldexp.c", "sf_llrint.c",
  491.   "sf_llround.c", "sf_log1p.c", "sf_log2.c", "sf_logb.c", "sf_lrint.c", "sf_lround.c", "sf_modf.c",
  492.   "sf_nan.c", "sf_nearbyint.c", "sf_nextafter.c", "sf_pow10.c", "sf_remquo.c", "sf_rint.c",
  493.   "sf_round.c", "sf_scalbln.c", "sf_scalbn.c", "sf_signif.c", "sf_sin.c", "sf_tan.c", "sf_tanh.c",
  494.   "sf_trunc.c", "w_acos.c", "w_acosh.c", "w_asin.c", "w_atan2.c", "w_atanh.c", "w_cosh.c", "w_drem.c",
  495.   "w_exp.c", "w_exp2.c", "w_fmod.c", "w_gamma.c", "w_hypot.c", "w_j0.c", "w_j1.c", "w_jn.c", "w_lgamma.c",
  496.   "w_log.c", "w_log10.c", "w_pow.c", "w_remainder.c", "w_scalb.c", "w_sincos.c", "w_sinh.c", "w_sqrt.c",
  497.   "w_tgamma.c", "wf_acos.c", "wf_acosh.c", "wf_asin.c", "wf_atan2.c", "wf_atanh.c", "wf_cosh.c",
  498.   "wf_drem.c", "wf_exp.c", "wf_exp2.c", "wf_fmod.c", "wf_gamma.c", "wf_hypot.c", "wf_j0.c", "wf_j1.c",
  499.   "wf_jn.c", "wf_lgamma.c", "wf_log.c", "wf_log10.c", "wf_pow.c", "wf_remainder.c", "wf_scalb.c",
  500.   "wf_sincos.c", "wf_sinh.c", "wf_sqrt.c", "wf_tgamma.c", "wr_gamma.c", "wr_lgamma.c", "wrf_gamma.c",
  501.   "wrf_lgamma.c",
  502.   "f_atan2.S", "f_atan2f.S", "f_frexp.S", "f_frexpf.S", "f_ldexp.S", "f_ldexpf.S", "f_log.S",
  503.   "f_log10.S", "f_log10f.S", "f_logf.S", "f_tan.S", "f_tanf.S"
  504. }
  505.  
  506. function prepend(what, to)
  507.   local result = {}
  508.   for i,v in ipairs(to) do
  509.     table.insert(result, what .. v)
  510.   end
  511.   return result
  512. end
  513.  
  514. -- make shared
  515. LIB_SRCS = LIBCDLL_SRCS
  516.  
  517. LIB_SRCS += CORE_SRCS
  518. LIB_SRCS += prepend("stdio/", STDIO_SRCS)
  519. LIB_SRCS += prepend("string/", STRING_SRCS)
  520. LIB_SRCS += prepend("stdlib/", STDLIB_SRCS)
  521. LIB_SRCS += prepend("dirent/", DIRENT_SRCS)
  522. LIB_SRCS += prepend("math/", MATH_SRCS)
  523.  
  524. ALL_OBJS = {}
  525. function compile(list)
  526.   local result = {}
  527.   for i,v in ipairs(list) do
  528.     if ALL_OBJS[v] then
  529.       -- already compiled
  530.     elseif v:sub(-2) == ".c" or v:sub(-2) == ".S" then
  531.       ALL_OBJS[v] = tup.rule(v, "kos32-gcc ".. CFLAGS .. " " .. DEFINES .. " " .. INCLUDES .. " -o %o %f", v:sub(1, -3) .. ".o")
  532.     elseif v:sub(-4) == ".asm" then
  533.       ALL_OBJS[v] = tup.rule(v, "fasm %f %o", v:sub(1, -5) .. ".obj")
  534.     end
  535.     result += ALL_OBJS[v]
  536.   end
  537.   return result
  538. end
  539.  
  540. LIB_OBJS = compile(LIB_SRCS)
  541. LIB_OBJS += tup.rule("crt/crtdll.c", "kos32-gcc " .. CFLAGS .. " " .. DEFINES .. " " .. INCLUDES .. " -fno-delete-null-pointer-checks -c %f -o %o","crt/crtdll.o")
  542. LIB_OBJS += tup.rule("pe/loader.c", "kos32-gcc " .. CFLAGS .. " " .. DEFINES .. " " .. INCLUDES .. " -fno-delete-null-pointer-checks -c %f -o %o", "pe/loader.o")
  543. LIB_OBJS += tup.rule("reent/renamer.c", "kos32-gcc " .. CFLAGS .. " " .. DEFINES .. " " .. INCLUDES .. " -D_COMPILING_NEWLIB -c %f -o %o", "reent/renamer.o")
  544. LIB_OBJS += tup.rule("time/strftime.c", "kos32-gcc " .. CFLAGS .. " " .. DEFINES .. " -DMAKE_WCSFTIME " .. INCLUDES .. " -c %f -o %o", "time/wcsftime.o")
  545.  
  546.  
  547. LIBDLL_OBJS = compile(LIBDLL_SRCS)
  548.  
  549.  
  550. vfprintf_extra_objs = {
  551.   {"", "stdio/vfprintf.o"},
  552.   {"-DINTEGER_ONLY", "stdio/vfiprintf.o"},
  553.   {"-DSTRING_ONLY", "stdio/svfprintf.o"},
  554.   {"-DINTEGER_ONLY -DSTRING_ONLY", "stdio/svfiprintf.o"},
  555. }
  556. for i,v in ipairs(vfprintf_extra_objs) do
  557.   LIB_OBJS += tup.rule("stdio/vfprintf.c", "kos32-gcc " .. CFLAGS .. " " .. DEFINES .. " " .. INCLUDES .. " -fshort-enums " .. v[1] .. " -c %f -o %o", v[2])
  558. end
  559.  
  560. vfwprintf_extra_objs = {
  561.   {"", "stdio/vfwprintf.o"},
  562.   {"-DINTEGER_ONLY", "stdio/vfiwprintf.o"},
  563.   {"-DSTRING_ONLY", "stdio/svfwprintf.o"},
  564.   {"-DINTEGER_ONLY -DSTRING_ONLY", "stdio/svfiwprintf.o"},
  565. }
  566. for i,v in ipairs(vfwprintf_extra_objs) do
  567.   LIB_OBJS += tup.rule("stdio/vfwprintf.c", "kos32-gcc " .. CFLAGS .. " " .. DEFINES .. " " .. INCLUDES .. " -fshort-enums " .. v[1] .. " -c %f -o %o", v[2])
  568. end
  569.  
  570.  
  571. vfscanf_extra_objs = {
  572.   {"", "stdio/vfscanf.o"},
  573.   {"-DINTEGER_ONLY", "stdio/vfiscanf.o"},
  574.   {"-DSTRING_ONLY", "stdio/svscanf.o"},
  575.   {"-DINTEGER_ONLY -DSTRING_ONLY", "stdio/svfiscanf.o"},
  576. }
  577. for i,v in ipairs(vfscanf_extra_objs) do
  578.   LIB_OBJS += tup.rule("stdio/vfscanf.c", "kos32-gcc " .. CFLAGS .. " " .. DEFINES .. " " .. INCLUDES .. " " .. v[1] .. " -c %f -o %o", v[2])
  579. end
  580.  
  581. vfwscanf_extra_objs = {
  582.   {"-DINTEGER_ONLY", "stdio/vfiwscanf.o"},
  583.   {"-DSTRING_ONLY", "stdio/svfwscanf.o"},
  584.   {"-DINTEGER_ONLY -DSTRING_ONLY", "stdio/svfiwscanf.o"},
  585. }
  586. for i,v in ipairs(vfwscanf_extra_objs) do
  587.   LIB_OBJS += tup.rule("stdio/vfwscanf.c", "kos32-gcc " .. CFLAGS .. " " .. DEFINES .. " " .. INCLUDES .. " " .. v[1] .. " -c %f -o %o", v[2])
  588. end
  589.  
  590.  
  591.  
  592. tup.rule(LIB_OBJS, "kos32-ld " .. LDFLAGS .. " " .. LIBPATH .. " -o %o %f -lgcc --version-script libc.ver " .. tup.getconfig("KPACK_CMD"),
  593.   {SDK_DIR .. "/bin/libc.dll", extra_outputs = {SDK_DIR .. "/lib/libc.dll.a", SDK_DIR .. "/lib/<libc.dll.a>"}})
  594. tup.rule(LIBDLL_OBJS, "kos32-ar rcs %o %f", {SDK_DIR .. "/lib/libdll.a", extra_outputs = {SDK_DIR .. "/lib/<libdll.a>"}})
  595.