Subversion Repositories Kolibri OS

Rev

Rev 6316 | Rev 6537 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6316 Rev 6536
Line 1... Line 1...
1
if tup.getconfig("NO_GCC") ~= "" or tup.getconfig("NO_FASM") ~= "" then return end
1
if tup.getconfig("NO_GCC") ~= "" or tup.getconfig("NO_FASM") ~= "" then return end
2
tup.include("../../../../../programs/use_gcc.lua")
2
tup.include("../../../../../programs/use_gcc.lua")
3
CFLAGS = CFLAGS_OPTIMIZE_SPEED .. " -c -DBUILD_LIBC -DMISSING_SYSCALL_NAMES"
3
CFLAGS = CFLAGS_OPTIMIZE_SPEED .. " -c -fno-builtin -DBUILD_LIBC -DMISSING_SYSCALL_NAMES"
4
LDFLAGS = "-shared -s -T libcdll.lds --out-implib $(SDK_DIR)/lib/libc.dll.a --image-base 0"
4
LDFLAGS = "-shared -s -T libcdll.lds --out-implib $(SDK_DIR)/lib/libc.dll.a --image-base 0"
5
-- LDFLAGS = LDFLAGS .. " --output-def libc.orig.def"
5
-- LDFLAGS = LDFLAGS .. " --output-def libc.orig.def"
Line 6... Line 6...
6
 
6
 
Line 19... Line 19...
19
  then TOOLCHAIN_LIBPATH="C:\\MinGW\\msys\\1.0\\home\\autobuild\\tools\\win32\\mingw32\\lib"
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"
20
  else TOOLCHAIN_LIBPATH="/home/autobuild/tools/win32/mingw32/lib"
21
  end
21
  end
22
end
22
end
23
LIBPATH = "-L$(SDK_DIR)/lib -L$(TOOLCHAIN_LIBPATH)"
23
LIBPATH = "-L$(SDK_DIR)/lib -L$(TOOLCHAIN_LIBPATH)"
24
STATIC_SRCS = {"crt/start.S", "crt/crt1.c", "crt/crt2.c", "crt/chkstk.S", "crt/exit.c"}
24
STATIC_SRCS = {"crt/start.S", "crt/crt1.c", "crt/crt2.c", "crt/exit.S"}
25
LIBCRT_SRCS = {"crt/start.S", "crt/crt3.c", "crt/chkstk.S",  "crt/pseudo-reloc.c", "pe/crtloader.c"}
-
 
26
LIBDLL_SRCS = {"crt/dllstart.c", "crt/chkstk.S", "crt/exit.S", "crt/pseudo-reloc.c", "crt/setjmp.S"}
25
LIBDLL_SRCS = {"crt/dllstart.c", "crt/exit.S", "crt/pseudo-reloc.c", "crt/setjmp.S"}
27
LIBCDLL_SRCS = {"crt/crtdll.c", "crt/crt2.c", "crt/pseudo-reloc.c", "crt/chkstk.S", "crt/exit.S", "pe/loader.c"}
26
LIBCDLL_SRCS = {"crt/crt2.c", "crt/pseudo-reloc.c", "crt/exit.S"}
28
CORE_SRCS = {
27
CORE_SRCS = {
29
  "argz/buf_findstr.c", "argz/envz_get.c",
28
  "argz/buf_findstr.c", "argz/envz_get.c",
30
  "crt/console.asm", "crt/emutls.c", "crt/thread.S", "crt/tls.S", "crt/setjmp.S", "crt/cpu_features.c",
29
  "crt/console.asm", "crt/thread.S", "crt/cpu_features.c", "crt/tls.c",
31
  "ctype/ctype_.c", "ctype/isascii.c", "ctype/isblank.c", "ctype/isalnum.c",
30
  "ctype/ctype_.c", "ctype/isascii.c", "ctype/isblank.c", "ctype/isalnum.c",
32
  "ctype/isalpha.c", "ctype/iscntrl.c", "ctype/isdigit.c", "ctype/islower.c",
31
  "ctype/isalpha.c", "ctype/iscntrl.c", "ctype/isdigit.c", "ctype/islower.c",
33
  "ctype/isupper.c", "ctype/isprint.c", "ctype/ispunct.c", "ctype/isspace.c",
32
  "ctype/isupper.c", "ctype/isprint.c", "ctype/ispunct.c", "ctype/isspace.c",
34
  "ctype/iswctype.c", "ctype/iswalnum.c", "ctype/iswalpha.c", "ctype/iswblank.c",
33
  "ctype/iswctype.c", "ctype/iswalnum.c", "ctype/iswalpha.c", "ctype/iswblank.c",
35
  "ctype/iswcntrl.c", "ctype/iswdigit.c", "ctype/iswgraph.c", "ctype/iswlower.c",
34
  "ctype/iswcntrl.c", "ctype/iswdigit.c", "ctype/iswgraph.c", "ctype/iswlower.c",
Line 41... Line 40...
41
  "locale/locale.c", "locale/lctype.c", "locale/ldpart.c",
40
  "locale/locale.c", "locale/lctype.c", "locale/ldpart.c",
Line 42... Line 41...
42
 
41
 
43
  "reent/closer.c", "reent/fstatr.c", "reent/getreent.c", "reent/gettimeofdayr.c",
42
  "reent/closer.c", "reent/fstatr.c", "reent/getreent.c", "reent/gettimeofdayr.c",
44
  "reent/impure.c", "reent/init_reent.c", "reent/isattyr.c", "reent/linkr.c",
43
  "reent/impure.c", "reent/init_reent.c", "reent/isattyr.c", "reent/linkr.c",
45
  "reent/lseekr.c", "reent/mutex.c", "reent/openr.c", "reent/readr.c",
44
  "reent/lseekr.c", "reent/mutex.c", "reent/openr.c", "reent/readr.c",
46
  "reent/renamer.c", "reent/statr.c", "reent/timesr.c", "reent/unlinkr.c",
45
  "reent/statr.c", "reent/timesr.c", "reent/unlinkr.c",
47
  "reent/writer.c",
46
  "reent/writer.c",
48
  "search/qsort.c", "search/bsearch.c",
47
  "search/qsort.c", "search/bsearch.c",
49
  "signal/signal.c",
48
  "signal/signal.c",
50
  "sys/access.c", "sys/clock_gettime.c", "sys/close.c", "sys/conio.c", "sys/create.c",
49
  "sys/access.c", "sys/clock_gettime.c", "sys/close.c", "sys/conio.c", "sys/create.c",
Line 56... Line 55...
56
  "time/gmtime_r.c", "time/mktime.c", "time/month_lengths.c", "time/lcltime.c",
55
  "time/gmtime_r.c", "time/mktime.c", "time/month_lengths.c", "time/lcltime.c",
57
  "time/lcltime_r.c", "time/strftime.c", "time/time.c", "time/tzcalc_limits.c",
56
  "time/lcltime_r.c", "time/strftime.c", "time/time.c", "time/tzcalc_limits.c",
58
  "time/timelocal.c", "time/tzlock.c", "time/tzset.c", "time/tzset_r.c", "time/tzvars.c"
57
  "time/timelocal.c", "time/tzlock.c", "time/tzset.c", "time/tzset_r.c", "time/tzvars.c"
59
}
58
}
60
STDLIB_SRCS = {
59
STDLIB_SRCS = {
-
 
60
  "__atexit.c",
61
  "__atexit.c", "__call_atexit.c", "abort.c", "abs.c", "assert.c", "atexit.c",
61
  "__call_atexit.c",
-
 
62
  "abort.c",
-
 
63
  "abs.c",
-
 
64
  "assert.c",
-
 
65
  "atexit.c",
-
 
66
  "atof.c",
-
 
67
  "atoi.c",
-
 
68
  "atol.c",
-
 
69
  "cxa_atexit.c",
-
 
70
  "cxa_finalize.c",
-
 
71
  "div.c",
-
 
72
  "dtoa.c",
-
 
73
  "dtoastub.c",
-
 
74
  "efgcvt.c",
-
 
75
  "ecvtbuf.c",
-
 
76
  "eprintf.c",
-
 
77
  "erand48.c",
-
 
78
  "exit.c",
62
  "atof.c", "atoi.c", "atol.c", "div.c", "dtoa.c", "dtoastub.c", "exit.c",
79
  "gdtoa-gethex.c",
63
  "gdtoa-gethex.c", "gdtoa-hexnan.c", "getenv.c", "getenv_r.c","mprec.c", "mbtowc.c",
80
  "gdtoa-hexnan.c",
-
 
81
  "getenv.c",
-
 
82
  "getenv_r.c",
-
 
83
  "itoa.c",
-
 
84
  "labs.c",  
-
 
85
  "mprec.c",
-
 
86
  "mbtowc.c",
64
  "mbtowc_r.c", "mbrtowc.c", "mlock.c", "calloc.c", "malloc.c", "mallocr.c",
87
  "mbtowc_r.c",
-
 
88
  "mbrtowc.c",
-
 
89
  "mlock.c",
-
 
90
  "calloc.c",
-
 
91
  "malloc.c",
-
 
92
  "mallocr.c",
-
 
93
  "rand.c",
-
 
94
  "rand_r.c",
-
 
95
  "rand48.c",
-
 
96
  "realloc.c",
-
 
97
  "seed48.c",
65
  "rand.c", "rand_r.c", "rand48.c", "realloc.c", "seed48.c", "srand48.c",
98
  "srand48.c",
-
 
99
  "strtod.c",
-
 
100
  "strtodg.c",
-
 
101
  "strtol.c",
-
 
102
  "strtold.c",
-
 
103
  "strtoll.c",
66
  "strtod.c", "strtodg.c", "strtol.c", "strtold.c", "strtoll.c", "strtoll_r.c",
104
  "strtoll_r.c",
-
 
105
  "strtorx.c",
-
 
106
  "strtoul.c",
-
 
107
  "strtoull.c",
67
  "strtorx.c","strtoul.c", "strtoull.c", "strtoull_r.c", "system.c", "wcrtomb.c",
108
  "strtoull_r.c",
-
 
109
  "system.c",
-
 
110
  "utoa.c",
-
 
111
  "wcrtomb.c",
68
  "wctomb_r.c"
112
  "wctomb_r.c"
69
}
113
}
70
STRING_SRCS = {
114
STRING_SRCS = {
-
 
115
  "memcpy.c",
-
 
116
  "memcmp.c",
71
  "memcpy.c", "memcmp.c", "memmove.c", "memset.c", "memchr.c", "stpcpy.c",
117
  "memmove.c",
-
 
118
  "memset.c",
-
 
119
  "memchr.c",
-
 
120
  "stpcpy.c",
-
 
121
  "stpncpy.c",
-
 
122
  "strcat.c",
-
 
123
  "strchr.c",
-
 
124
  "strcmp.c",
-
 
125
  "strcoll.c",
72
  "stpncpy.c", "strcat.c", "strchr.c", "strcmp.c", "strcoll.c", "strcasecmp.c",
126
  "strcasecmp.c",
73
  "strncasecmp.c", "strncat.c", "strncmp.c", "strncpy.c", "strndup.c",
127
  "strncasecmp.c",
-
 
128
  "strncat.c",
-
 
129
  "strncmp.c",
-
 
130
  "strncpy.c",
-
 
131
  "strndup.c",
74
  "strndup_r.c", "strnlen.c", "strcasestr.c", "strdup.c", "strdup_r.c",
132
  "strndup_r.c",
-
 
133
  "strnlen.c",
75
  "strerror.c", "strlen.c", "strrchr.c", "strpbrk.c", "strsep.c", "strstr.c",
134
  "strcasestr.c",
-
 
135
  "strdup.c",
-
 
136
  "strdup_r.c",
-
 
137
  "strerror.c",
-
 
138
  "strlen.c",
-
 
139
  "strrchr.c",
-
 
140
  "strpbrk.c",
-
 
141
  "strsep.c",
-
 
142
  "strstr.c",
-
 
143
  "strtok.c",
76
  "strtok.c", "strtok_r.c", "strupr.c", "strcspn.c", "strspn.c", "strcpy.c",
144
  "strtok_r.c",
-
 
145
  "strupr.c",
-
 
146
  "strxfrm.c",
-
 
147
  "strcspn.c",
-
 
148
  "strspn.c",
-
 
149
  "strcpy.c",
77
  "u_strerr.c"
150
  "u_strerr.c"
78
}
151
}
Line 79... Line 152...
79
 
152
 
-
 
153
STDIO_SRCS = {
80
STDIO_SRCS = {
154
  "asiprintf.c",
-
 
155
  "asniprintf.c",
-
 
156
  "asnprintf.c",
-
 
157
  "asprintf.c",
-
 
158
  "clearerr.c",
-
 
159
  "diprintf.c",
-
 
160
  "dprintf.c",
81
  "clearerr.c", "diprintf.c", "dprintf.c", "printf.c", "putchar.c", "fgetc.c",
161
  "fclose.c",
-
 
162
  "fcloseall.c",
-
 
163
  "fdopen.c",
-
 
164
  "feof.c",
-
 
165
  "feof_u.c",
-
 
166
  "ferror.c",
-
 
167
  "ferror_u.c",
-
 
168
  "fflush.c",
-
 
169
  "fflush_u.c",
-
 
170
  "fgetc.c",
-
 
171
  "fgetc_u.c",
-
 
172
  "fgetpos.c",
-
 
173
  "fgets.c",
-
 
174
  "fgets_u.c",
-
 
175
  "fileno.c",
-
 
176
  "fileno_u.c",
82
  "fgets.c", "fopen.c", "fclose.c", "fdopen.c", "fflush.c", "flags.c",
177
  "findfp.c",
-
 
178
  "fiprintf.c",
-
 
179
  "fiscanf.c",
-
 
180
  "flags.c",
-
 
181
  "fmemopen.c",
83
  "fileno.c", "findfp.c", "fiprintf.c", "fiscanf.c", "fprintf.c", "fputc.c",
182
  "fopen.c",
-
 
183
  "fopencookie.c",
-
 
184
  "fprintf.c",
-
 
185
  "fpurge.c",
-
 
186
  "fputc.c",
-
 
187
  "fputc_u.c",
-
 
188
  "fputs.c",
-
 
189
  "fputs_u.c",
-
 
190
  "fputwc.c",
-
 
191
  "fsetpos.c",
-
 
192
  "fread.c",
-
 
193
  "fread_u.c",
-
 
194
  "freopen.c",
-
 
195
  "fscanf.c",
-
 
196
  "fseek.c",
84
  "fputs.c", "fputwc.c", "fread.c", "freopen.c", "fscanf.c", "fseek.c", "fseeko.c",
197
  "fseeko.c",
-
 
198
  "fsetlocking.c",
-
 
199
  "ftell.c",
-
 
200
  "ftello.c",
-
 
201
  "fvwrite.c",
-
 
202
  "fwalk.c",
-
 
203
  "fwide.c",
-
 
204
  "fwrite.c",
-
 
205
  "fwrite_u.c",
-
 
206
  "getc.c",
-
 
207
  "getc_u.c",
-
 
208
  "getchar.c",
-
 
209
  "getchar_u.c",
-
 
210
  "getdelim.c",
-
 
211
  "getline.c",
-
 
212
  "gets.c",
-
 
213
  "iprintf.c",
-
 
214
  "iscanf.c",
-
 
215
  "makebuf.c",
-
 
216
  "mbstowcs.c",
85
  "ftell.c", "ftello.c", "fwrite.c", "fvwrite.c", "fwalk.c", "makebuf.c",
217
  "mktemp.c",
-
 
218
  "open_memstream.c",
-
 
219
  "perror.c",
-
 
220
  "printf.c",
-
 
221
  "putc.c",
-
 
222
  "putc_u.c",
-
 
223
  "putchar.c",
-
 
224
  "putchar_u.c",
-
 
225
  "puts.c",
-
 
226
  "refill.c",
-
 
227
  "remove.c",
-
 
228
  "rename.c",
-
 
229
  "rewind.c",
-
 
230
  "rget.c",
-
 
231
  "scanf.c",
-
 
232
  "sccl.c",
-
 
233
  "setbuf.c",
-
 
234
  "setbuffer.c",
-
 
235
  "setlinebuf.c",
-
 
236
  "setvbuf.c",
-
 
237
  "siprintf.c",
-
 
238
  "siscanf.c",
-
 
239
  "sniprintf.c",
-
 
240
  "snprintf.c",
-
 
241
  "sprintf.c",
-
 
242
  "sscanf.c",
-
 
243
  "stdio.c",
-
 
244
  "stdio_ext.c",
-
 
245
  "tmpfile.c",
-
 
246
  "tmpnam.c",
86
  "mbstowcs.c", "mktemp.c", "perror.c", "putc.c", "puts.c", "refill.c", "remove.c",
247
  "ungetc.c",
87
  "rename.c", "rewind.c", "rget.c", "sccl.c", "setvbuf.c", "siprintf.c",
248
  "vasiprintf.c",
88
  "siscanf.c", "sniprintf.c", "snprintf.c", "sprintf.c", "sscanf.c", "stdio.c",
249
  "vasniprintf.c",
-
 
250
  "vasnprintf.c",
-
 
251
  "vasprintf.c",
-
 
252
  "vdiprintf.c",
-
 
253
  "vdprintf.c",
-
 
254
  "viprintf.c",
-
 
255
  "viscanf.c",
-
 
256
  "vprintf.c",
-
 
257
  "vscanf.c",
-
 
258
  "vsiprintf.c",
-
 
259
  "vsiscanf.c",
89
  "tmpfile.c", "tmpnam.c", "ungetc.c", "vasniprintf.c", "vasnprintf.c",
260
  "vsprintf.c",
-
 
261
  "vsniprintf.c",
90
  "vdprintf.c", "vdiprintf.c", "vscanf.c", "vsprintf.c", "vsnprintf.c",
262
  "vsnprintf.c",
-
 
263
  "vsscanf.c",
91
  "vsscanf.c", "wsetup.c", "wbuf.c"
264
  "wsetup.c",
92
 
265
  "wbuf.c"
Line -... Line 266...
-
 
266
}   
93
}
267
 
94
 
268
 
95
MATH_SRCS = {
269
MATH_SRCS = {
96
  "e_acos.c", "e_acosh.c", "e_asin.c", "e_atan2.c", "e_atanh.c", "e_cosh.c", "e_exp.c", "e_fmod.c",
270
  "e_acos.c", "e_acosh.c", "e_asin.c", "e_atan2.c", "e_atanh.c", "e_cosh.c", "e_exp.c", "e_fmod.c",
97
  "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",
271
  "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",
Line 160... Line 334...
160
  end
334
  end
161
  return result
335
  return result
162
end
336
end
Line 163... Line 337...
163
 
337
 
-
 
338
LIB_OBJS = compile(LIB_SRCS)
-
 
339
LIB_OBJS += tup.rule("crt/crtdll.c", "kos32-gcc $(CFLAGS) $(DEFINES) $(INCLUDES) -fno-delete-null-pointer-checks -c crt/crtdll.c -o crt/crtdll.o")
164
LIB_OBJS = compile(LIB_SRCS)
340
LIB_OBJS += tup.rule("pe/loader.c", "kos32-gcc $(CFLAGS) $(DEFINES) $(INCLUDES) -fno-delete-null-pointer-checks -c pe/loader.c -o pe/loader.o")
-
 
341
LIB_OBJS += tup.rule("reent/renamer.c", "kos32-gcc $(CFLAGS) $(DEFINES) $(INCLUDES) -D_COMPILING_NEWLIB -c reent/renamer.c -o reent/renamer.o")
165
LIBCRT_OBJS = compile(LIBCRT_SRCS)
342
 
Line -... Line 343...
-
 
343
LIBDLL_OBJS = compile(LIBDLL_SRCS)
166
LIBDLL_OBJS = compile(LIBDLL_SRCS)
344
 
167
 
345
 
168
vfprintf_extra_objs = {
346
vfprintf_extra_objs = {
169
  {"-DFLOATING_POINT", "stdio/vfprintf.o"},
347
  {"", "stdio/vfprintf.o"},
170
  {"-DINTEGER_ONLY", "stdio/vfiprintf.o"},
348
  {"-DINTEGER_ONLY", "stdio/vfiprintf.o"},
171
  {"-DSTRING_ONLY", "stdio/svfprintf.o"},
349
  {"-DSTRING_ONLY", "stdio/svfprintf.o"},
172
  {"-DINTEGER_ONLY -DSTRING_ONLY", "stdio/svfiprintf.o"},
350
  {"-DINTEGER_ONLY -DSTRING_ONLY", "stdio/svfiprintf.o"},
Line 180... Line 358...
180
  {"-DINTEGER_ONLY", "stdio/vfiscanf.o"},
358
  {"-DINTEGER_ONLY", "stdio/vfiscanf.o"},
181
  {"-DSTRING_ONLY", "stdio/svscanf.o"},
359
  {"-DSTRING_ONLY", "stdio/svscanf.o"},
182
  {"-DINTEGER_ONLY -DSTRING_ONLY", "stdio/svfiscanf.o"},
360
  {"-DINTEGER_ONLY -DSTRING_ONLY", "stdio/svfiscanf.o"},
183
}
361
}
184
for i,v in ipairs(vfscanf_extra_objs) do
362
for i,v in ipairs(vfscanf_extra_objs) do
185
  LIB_OBJS += tup.rule("stdio/vfscanf.c", "kos32-gcc $(CFLAGS) $(DEFINES) $(INCLUDES) -fshort-enums " .. v[1] .. " -c %f -o %o", v[2])
363
  LIB_OBJS += tup.rule("stdio/vfscanf.c", "kos32-gcc $(CFLAGS) $(DEFINES) $(INCLUDES) " .. v[1] .. " -c %f -o %o", v[2])
186
end
364
end
Line 187... Line 365...
187
 
365
 
188
tup.rule(LIB_OBJS, "kos32-ld " .. LDFLAGS .. " " .. LIBPATH .. " -o %o %f -lgcc --version-script libc.ver " .. tup.getconfig("KPACK_CMD"),
366
tup.rule(LIB_OBJS, "kos32-ld " .. LDFLAGS .. " " .. LIBPATH .. " -o %o %f -lgcc --version-script libc.ver " .. tup.getconfig("KPACK_CMD"),
189
  {SDK_DIR .. "/bin/libc.dll", extra_outputs = {SDK_DIR .. "/lib/libc.dll.a", SDK_DIR .. "/lib/"}})
-
 
190
tup.rule(LIBCRT_OBJS, "kos32-ar rcs %o %f", {SDK_DIR .. "/lib/libapp.a", extra_outputs = {SDK_DIR .. "/lib/"}})
367
  {SDK_DIR .. "/bin/libc.dll", extra_outputs = {SDK_DIR .. "/lib/libc.dll.a", SDK_DIR .. "/lib/"}})