compiler/clib/ftime.c: Better implementation using gettimeofday(); move to static...
[AROS.git] / compiler / clib / mmakefile.src
blobf3b1eb3da3eef52acc8a3a63d7850b21a7dd3105
1 # $Id$
2 include $(TOP)/config/make.cfg
5 #   This is a rather special makefile. It builds both a shared library
6 #   and a link library from the same source, with only a small amount of
7 #   overlap.
9 USER_CFLAGS :=  -I$(SRCDIR)/$(CURDIR) -I$(SRCDIR)/$(CURDIR)/include \
10         -D__mb_cur_max=MB_CUR_MAX               \
11         -DADATE="\"$(shell date '+%d.%m.%Y')\"" \
12         -fno-builtin
14 TESTDIR := $(BINDIR)/Tests
16 # Lists of files
17 #   - Common always exist in the link library.
19 COMMON  := \
20         __alloca \
21         __filesystem_support \
22         __isinf \
23         atof \
24         div \
25         _errstrings \
26         getopt \
27         getopt_long \
28         isinf \
29         ldiv \
30         lldiv \
31         mblen \
32         mbtowc \
33         mbstowcs \
34         memchr \
35         memcmp \
36         memcpy \
37         memmove \
38         memset \
39         putchar \
40         stcd_l \
41         stcl_d \
42         stcl_h \
43         stcl_o \
44         stch_l \
45         stco_l \
46         stcu_d \
47         stccpy \
48         stpblk \
49         stpcpy \
50         stpsym \
51         strcasecmp \
52         strcasestr \
53         strcat \
54         strchr \
55         strcmp \
56         strcoll \
57         strcpy \
58         strcspn \
59         strdup \
60         strndup \
61         strlcat \
62         strlcpy \
63         strlen \
64         strlwr \
65         strncasecmp \
66         strncat \
67         strncmp \
68         strncpy \
69         strpbrk \
70         strrchr \
71         strrev \
72         strsep \
73         strspn \
74         strstr \
75         strtod \
76         strtok \
77         strupr \
78         strxfrm \
79         swab \
80         wctomb \
81         wcstombs
83 COMMON_ARCH := \
84         longjmp \
85         setjmp
87 #   - Shared are in either the shared linklib, or the arosc module
88 SHARED  := \
89         __arosc_gmtoffset \
90         __arosc_environ \
91         __arosc_init \
92         __arosc_ioerr2errno \
93         __arosc_nixmain \
94         __arosc_startup \
95         __arosc_userdata \
96         __assert \
97         __ctype \
98         __get_default_file \
99         __env \
100         __exec \
101         __exitfunc \
102         __fdesc \
103         __rand48 \
104         __signal \
105         __stat \
106         __stdio \
107         __upath \
108         __vcformat \
109         __vcscan \
110         __vfork \
111         abort \
112         abs \
113         access \
114         asctime \
115         asctime_r \
116         atexit \
117         atoi \
118         atol \
119         basename \
120         bsearch \
121         calloc \
122         cfgetispeed \
123         cfgetospeed \
124         cfsetispeed \
125         cfsetospeed \
126         chdir \
127         chmod \
128         chown \
129         clearerr \
130         ctime \
131         ctime_r \
132         clock \
133         close \
134         closedir \
135         creat \
136         difftime \
137         dirfd \
138         dirname \
139         drand48 \
140         dup \
141         dup2 \
142         endgrent \
143         endpwent \
144         erand48 \
145         execl \
146         execlp \
147         execv \
148         execve \
149         execvp \
150         exit \
151         _exit \
152     fchdir \
153         fchmod \
154         fchown \
155         fclose \
156         fcntl \
157         fdopen \
158         feof \
159         ferror \
160         fflush \
161         fgetc \
162         fgetpos \
163         fgets \
164         fileno \
165         flock \
166         fopen \
167         fprintf \
168         fscanf \
169         fsync \
170         fputc \
171         fputs \
172         fread \
173         free \
174         freopen \
175         fseek \
176         fseeko \
177         fsetpos \
178         fstat \
179         ftell \
180         ftello \
181         ftruncate \
182         fwrite \
183         gcvt \
184         getc \
185         getchar \
186         getcwd \
187         getenv \
188         getfsstat \
189         statfs \
190         getpid \
191         getrlimit \
192         gettimeofday \
193         getuid \
194         geteuid \
195         getgid \
196         getegid \
197         getgrgid \
198         getgroups \
199         getgrnam \
200         getgrent \
201         getlogin \
202         getpgrp \
203         getppid \
204         getpwent \
205         getpwnam \
206         getpwuid \
207         gets \
208         getloadavg \
209         gmtime \
210     gmtime_r \
211         isatty \
212         jrand48 \
213         kill \
214         labs \
215         lcong48 \
216         link \
217         localeconv \
218         localtime \
219         localtime_r \
220         lrand48 \
221         lseek \
222         lstat \
223         malloc \
224         mkdir \
225         mknod \
226         mkstemp \
227         mktemp \
228         mktime \
229         mrand48 \
230         nanosleep \
231         nrand48 \
232         on_exit \
233         open \
234         opendir \
235         pathconf \
236         pclose \
237         perror \
238         pipe \
239         popen \
240         posix_memalign \
241         printf \
242         putenv \
243         putc \
244         puts \
245         qsort \
246         raise \
247         rand \
248         random \
249         read \
250         readdir \
251         readlink \
252         realloc \
253         realloc_nocopy \
254         realpath \
255         regex/regerror  \
256         regex/regexec   \
257         regex/regcomp   \
258         regex/regfree   \
259         remove \
260         rename \
261         rewind \
262         rewinddir \
263         rmdir \
264         scanf \
265         seed48 \
266         seekdir \
267         setbuf \
268         setenv \
269         setgid \
270         setgrent \
271         setlinebuf \
272         setlocale \
273         setpwent \
274         setrlimit \
275         setuid \
276         setvbuf \
277         sharecontextwithchild \
278         sigaction \
279         sigaddset \
280         sigdelset \
281         sigemptyset \
282         sigfillset \
283         sigismember \
284         signal \
285         sigpending \
286         sigprocmask \
287         sigsuspend \
288         sleep \
289         snprintf \
290         sprintf \
291         srand48 \
292         sscanf \
293         stat \
294         strftime \
295         strerror \
296         strptime \
297         strtoimax \
298         strtol \
299         strtoll \
300         strtoul \
301         strtoull \
302         strtoumax \
303         sync \
304         sysconf \
305         symlink \
306         system \
307         tcgetattr \
308         telldir \
309         tempnam \
310         time \
311         times \
312         tmpfile \
313         tmpnam \
314         truncate \
315         tcsetattr \
316         ttyname \
317         umask \
318         ungetc \
319         uname \
320         unlink \
321         unsetenv \
322         updatestdio \
323         usleep \
324         utime \
325         utimes \
326         vfprintf \
327         vfscanf \
328         vprintf \
329         vscanf \
330         vsnprintf \
331         vsprintf \
332         vsscanf \
333         wait \
334         waitpid \
335         write
337 SHARED_ARCH := \
338     vfork \
339     vfork_longjmp
341 SHARED_LINKLIB := \
342         arosc_environ \
343         bcmp \
344         bcopy \
345         bzero \
346         ftime \
347         __ctype_linklib
349 # Note: These files are compiled differently
350 #       depending on whether -DAROSC_ROM is used
351 #       or not.
352 ROM_ONLY := \
353         __ctype \
354         __arosc_userdata \
355         __assert_kernel \
356         __vcformat \
357         __vcscan
359 ROM_COMMON := \
360         atof \
361         div \
362         ldiv \
363         lldiv \
364         mblen \
365         mbtowc \
366         mbstowcs \
367         memchr \
368         memcmp \
369         memcpy \
370         memmove \
371         memset \
372         stccpy \
373         stcd_l \
374         stcl_d \
375         stcl_h \
376         stcl_o \
377         stch_l \
378         stco_l \
379         stcu_d \
380         stpblk \
381         stpcpy \
382         strcasecmp \
383         strcasestr \
384         strcat \
385         strchr \
386         strcmp \
387         strcpy \
388         strcspn \
389         _errstrings \
390         strerror_rom \
391         strlen \
392         strlcat \
393         strlcpy \
394         strncasecmp \
395         strncat \
396         strncmp \
397         strncpy \
398         strpbrk \
399         strrchr \
400         strrev \
401         strspn \
402         strstr \
403         strtod \
404         wctomb \
405         wcstombs
407 ROM_COMMON_ARCH := \
408         longjmp \
409         setjmp
411 # Objects for libarosc.static.a, from the static build.
412 ROM_STATIC := \
413         __filesystem_support \
414         __isinf \
415         abs \
416         atoi \
417         atol \
418         bsearch \
419         isinf \
420         labs \
421         qsort \
422         rand_rom \
423         snprintf \
424         sprintf \
425         sscanf \
426         stcd_l \
427         stch_l \
428         stcl_d \
429         strchr \
430         strerror_rom \
431         strspn \
432         strtol \
433         strtoll \
434         strtoul \
435         strtoull \
436         strtok \
437         vsnprintf \
438         vsprintf \
439         vsscanf
442 #MM- core-linklibs : linklibs-arosc linklibs-rom
443 #MM- linklibs : linklibs-clib-shared-linklib linklibs-rom
444 #MM- linklibs-clib : linklibs-clib-shared linklibs-rom
445 #MM- linklibs-clib-shared : includes linklibs-mlib \
446 #MM      linklibs-clib-common linklibs-autoinit
447 #MM- linklibs-clib-shared-linklib : includes linklibs-clib-common
448 #MM- linklibs-rom : includes linklibs-clib-common
449 #MM- linklibs-clib-quick : linklibs-clib-shared-quick \
450 #MM      linklibs-clib-common-quick linklibs-rom-quick
451 #MM- linklibs-clib-clean : linklibs-clib-shared-clean \
452 #MM      linklibs-clib-common-clean linklibs-rom-clean
454 #MM- linklibs-clib-quick : linklibs-clib-shared-quick linklibs-rom-quick
456 %build_linklib mmake=linklibs-clib-common \
457     libname=arosccommon files="$(COMMON) $(add-prefix arch/,$(COMMON_ARCH))" \
458     libdir=$(OBJDIR)
461 #   Also build $(AROS_LIB)/libarosc.static.a
463 #   This is a library that is allowed to be used inside modules and the
464 #   kernel. It must include no code which refers to global variables.
466 #   Currently the main difference is that it includes a different __assert()
467 #   function to handle asserts in the kernel.
469 ROM_ARCH_OBJS := $(addsuffix .o, \
470     $(addprefix $(OBJDIR)/arch/,$(ROM_COMMON_ARCH)) \
472 %build_linklib mmake=linklibs-rom \
473     libname=arosc.static files="$(ROM_ONLY) $(ROM_COMMON) $(ROM_STATIC)" objs="$(ROM_ARCH_OBJS)" \
474     cflags="$(CFLAGS) -DAROSC_STATIC -DAROSC_ROM" \
475     objdir=$(OBJDIR)/static
479 AROSC_LINKLIB_OBJS := $(addsuffix .o, \
480     $(addprefix $(OBJDIR)/,$(COMMON)) \
481     $(addprefix $(OBJDIR)/arch/,$(COMMON_ARCH)) \
483 USER_LDFLAGS := -L$(OBJDIR)
484 %build_module mmake=linklibs-clib-shared \
485     modname=arosc modtype=library objdir=$(OBJDIR)/shared \
486     cflags="$(CFLAGS) -DAROSC_SHARED" \
487     files="$(SHARED) $(SHARED_ARCH)" \
488     linklibfiles=$(SHARED_LINKLIB) linklibobjs=$(AROSC_LINKLIB_OBJS) \
489     uselibs="arosccommon"
492 # x86_64 needs a reduced 32bit libarosc.a lib.
493 %rule_compile_multi basenames=$(ROM_COMMON) \
494     cflags="-m32 -DAROSC_LIB32 $(CFLAGS)" targetdir=$(OBJDIR)/32bit
496 ROM_COMMON_OBJ32 := $(addsuffix .o, $(addprefix $(OBJDIR)/32bit/,$(ROM_COMMON)))
497 %build_linklib mmake=linklibs-clib32 \
498     libname=arosc.static files="$(ROM_ONLY) $(ROM_STATIC)" objs=$(ROM_COMMON_OBJ32) \
499     cflags="-m32 $(CFLAGS) -DAROSC_LIB32 -DAROSC_STATIC -DAROSC_ROM" \
500     objdir=$(GENDIR)/$(CURDIR)/32bit libdir=$(GENDIR)/lib32
504 check : $(TESTDIR)/snprintf
506 $(TESTDIR)/snprintf : snprintf.c $(LIBDIR)/startup.o $(DEPLIBS)
507         $(CC) -DTEST $(ILDFLAGS) $< -o $@ $(LIBS)
510 clean ::
511         -$(RM) $(OBJDIR) *.err $(LIB)