fix config file path
[AROS.git] / compiler / clib / mmakefile.src
blob32f99293e79a5521785154800a52883d151c8d55
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         ftime \
182         ftruncate \
183         fwrite \
184         gcvt \
185         getc \
186         getchar \
187         getcwd \
188         getenv \
189         getfsstat \
190         statfs \
191         getpid \
192         getrlimit \
193         gettimeofday \
194         getuid \
195         geteuid \
196         getgid \
197         getegid \
198         getgrgid \
199         getgroups \
200         getgrnam \
201         getgrent \
202         getlogin \
203         getpgrp \
204         getppid \
205         getpwent \
206         getpwnam \
207         getpwuid \
208         gets \
209         getloadavg \
210         gmtime \
211     gmtime_r \
212         isatty \
213         jrand48 \
214         kill \
215         labs \
216         lcong48 \
217         link \
218         localeconv \
219         localtime \
220         localtime_r \
221         lrand48 \
222         lseek \
223         lstat \
224         malloc \
225         mkdir \
226         mknod \
227         mkstemp \
228         mktemp \
229         mktime \
230         mrand48 \
231         nanosleep \
232         nrand48 \
233         on_exit \
234         open \
235         opendir \
236         pathconf \
237         pclose \
238         perror \
239         pipe \
240         popen \
241         posix_memalign \
242         printf \
243         putenv \
244         putc \
245         puts \
246         qsort \
247         raise \
248         rand \
249         random \
250         read \
251         readdir \
252         readlink \
253         realloc \
254         realloc_nocopy \
255         realpath \
256         regex/regerror  \
257         regex/regexec   \
258         regex/regcomp   \
259         regex/regfree   \
260         remove \
261         rename \
262         rewind \
263         rewinddir \
264         rmdir \
265         scanf \
266         seed48 \
267         seekdir \
268         setbuf \
269         setenv \
270         setgid \
271         setgrent \
272         setlinebuf \
273         setlocale \
274         setpwent \
275         setrlimit \
276         setuid \
277         setvbuf \
278         sharecontextwithchild \
279         sigaction \
280         sigaddset \
281         sigdelset \
282         sigemptyset \
283         sigfillset \
284         sigismember \
285         signal \
286         sigpending \
287         sigprocmask \
288         sigsuspend \
289         sleep \
290         snprintf \
291         sprintf \
292         srand48 \
293         sscanf \
294         stat \
295         strftime \
296         strerror \
297         strptime \
298         strtoimax \
299         strtol \
300         strtoll \
301         strtoul \
302         strtoull \
303         strtoumax \
304         sync \
305         sysconf \
306         symlink \
307         system \
308         tcgetattr \
309         telldir \
310         tempnam \
311         time \
312         times \
313         tmpfile \
314         tmpnam \
315         truncate \
316         tcsetattr \
317         ttyname \
318         umask \
319         ungetc \
320         uname \
321         unlink \
322         unsetenv \
323         updatestdio \
324         usleep \
325         utime \
326         utimes \
327         vfprintf \
328         vfscanf \
329         vprintf \
330         vscanf \
331         vsnprintf \
332         vsprintf \
333         vsscanf \
334         wait \
335         waitpid \
336         write
338 SHARED_ARCH := \
339     vfork \
340     vfork_longjmp
342 SHARED_LINKLIB := \
343         arosc_environ \
344         bcmp \
345         bcopy \
346         bzero \
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)