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