clean up some makefile issues. (NicJA)
[AROS.git] / compiler / stdc / mmakefile.src
blobebb1d448efd69efabffe90af1d60f2e079f12616
1 include $(SRCDIR)/config/aros.cfg
3 #MM- AROS : compiler-stdc compiler-stdcio
5 FMTPRINTFDIR := $(SRCDIR)/compiler/fmtprintf
6 USER_INCLUDES += -I$(SRCDIR)/$(CURDIR)/math -iquote $(FMTPRINTFDIR)
8 STDC_MATH := \
9     math/bsdsrc/b_exp \
10     math/bsdsrc/b_log \
11     math/bsdsrc/b_tgamma \
12     math/e_acos \
13     math/e_acosf \
14     math/e_acosh \
15     math/e_acoshf \
16     math/e_asin \
17     math/e_asinf \
18     math/e_atan2 \
19     math/e_atan2f \
20     math/e_atanh \
21     math/e_atanhf \
22     math/e_cosh \
23     math/e_coshf \
24     math/e_exp \
25     math/e_expf \
26     math/e_fmod \
27     math/e_fmodf \
28     math/e_gamma \
29     math/e_gammaf \
30     math/e_gamma_r \
31     math/e_gammaf_r \
32     math/e_hypot \
33     math/e_hypotf \
34     math/e_j0 \
35     math/e_j0f \
36     math/e_j1 \
37     math/e_j1f \
38     math/e_jn \
39     math/e_jnf \
40     math/e_lgamma \
41     math/e_lgammaf \
42     math/e_lgamma_r \
43     math/e_lgammaf_r \
44     math/e_log \
45     math/e_logf \
46     math/e_log2 \
47     math/e_log2f \
48     math/e_log10 \
49     math/e_log10f \
50     math/e_pow \
51     math/e_powf \
52     math/e_rem_pio2 \
53     math/e_rem_pio2f \
54     math/e_remainder \
55     math/e_remainderf \
56     math/e_scalb \
57     math/e_scalbf \
58     math/e_sinh \
59     math/e_sinhf \
60     math/e_sqrt \
61     math/e_sqrtf \
62     math/k_cos \
63     math/k_cosf \
64     math/k_exp \
65     math/k_expf \
66     math/k_rem_pio2 \
67     math/k_rem_pio2f \
68     math/k_sin \
69     math/k_sinf \
70     math/k_tan \
71     math/k_tanf \
72     math/s_nan \
73     math/s_asinh \
74     math/s_asinhf \
75     math/s_atan \
76     math/s_atanf \
77     math/s_cacos \
78     math/s_cacosf \
79     math/s_cacosh \
80     math/s_cacoshf \
81     math/s_carg \
82     math/s_cargf \
83     math/s_casin \
84     math/s_casinf \
85     math/s_casinh \
86     math/s_casinhf \
87     math/s_catan \
88     math/s_catanf \
89     math/s_catanh \
90     math/s_catanhf \
91     math/s_cbrt \
92     math/s_cbrtf \
93     math/s_ccos \
94     math/s_ccosf \
95     math/s_ccosh \
96     math/s_ccoshf \
97     math/s_ceil \
98     math/s_ceilf \
99     math/s_cexp \
100     math/s_cexpf \
101     math/s_cimag \
102     math/s_cimagf \
103     math/s_conj \
104     math/s_conjf \
105     math/s_clog \
106     math/s_clogf \
107     math/s_cpow \
108     math/s_cpowf \
109     math/s_cproj \
110     math/s_cprojf \
111     math/s_creal \
112     math/s_crealf \
113     math/s_csinh \
114     math/s_csinhf \
115     math/s_csin \
116     math/s_csqrt \
117     math/s_csqrtf \
118     math/s_ctan \
119     math/s_ctanf \
120     math/s_ctanh \
121     math/s_ctanhf \
122     math/s_copysign \
123     math/s_copysignf \
124     math/s_cos \
125     math/s_cosf \
126     math/s_erf \
127     math/s_erff \
128     math/s_exp2 \
129     math/s_exp2f \
130     math/s_expm1 \
131     math/s_expm1f \
132     math/s_fabs \
133     math/s_fabsf \
134     math/s_fdim \
135     math/s_floor \
136     math/s_floorf \
137     math/s_fpclassify \
138     math/s_fma \
139     math/s_fmaf  \
140     math/s_fmax \
141     math/s_fmaxf \
142     math/s_fmaxl \
143     math/s_fmin \
144     math/s_fminf \
145     math/s_fminl \
146     math/s_frexp \
147     math/s_frexpf  \
148     math/s_ilogb \
149     math/s_ilogbf \
150     math/s_isfinite \
151     math/s_isinf \
152     math/s_isnan \
153     math/s_isnormal \
154     math/s_log1p \
155     math/s_log1pf \
156     math/s_logb \
157     math/s_logbf \
158     math/s_modf \
159     math/s_modff \
160     math/s_nearbyint \
161     math/s_nextafter \
162     math/s_nextafterf  \
163     math/s_nexttowardf \
164     math/s_remquo \
165     math/s_remquof \
166     math/s_rint \
167     math/s_rintf \
168     math/s_lrint \
169     math/s_lrintf \
170     math/s_llrint \
171     math/s_llrintf \
172     math/s_round \
173     math/s_roundf \
174     math/s_lround \
175     math/s_lroundf \
176     math/s_llround \
177     math/s_llroundf \
178     math/s_scalbln \
179     math/s_scalbn \
180     math/s_scalbnf  \
181     math/s_signbit \
182     math/s_significand \
183     math/s_significandf \
184     math/s_sin \
185     math/s_sincos \
186     math/s_sincosf \
187     math/s_sinf \
188     math/s_tan \
189     math/s_tanf \
190     math/s_tanh \
191     math/s_tanhf \
192     math/s_tgammaf \
193     math/s_trunc \
194     math/s_truncf
196 STDC_SCABS_MATH := \
197     math/s_cabs \
198     math/s_cabsf
200 STDC_WCABS_MATH := \
201     math/w_cabs \
202     math/w_cabsf
204 STDC_LONGDB_MATH := \
205     math/e_acosl \
206     math/e_asinl \
207     math/e_atan2l \
208     math/e_fmodl \
209     math/e_hypotl \
210     math/e_lgammal \
211     math/e_remainderl \
212     math/e_sqrtl \
213     math/polevll \
214     math/s_atanl \
215     math/s_cacoshl \
216     math/s_cacosl \
217     math/s_cargl \
218     math/s_casinhl \
219     math/s_casinl \
220     math/s_catanhl \
221     math/s_catanl \
222     math/s_cbrtl \
223     math/s_ccoshl \
224     math/s_ccosl \
225     math/s_ceill \
226     math/s_cexpl \
227     math/s_cimagl \
228     math/s_clogl \
229     math/s_conjl \
230     math/s_copysignl \
231     math/s_cosl \
232     math/s_cpowl \
233     math/s_cprojl \
234     math/s_creall \
235     math/s_csinhl \
236     math/s_csinl \
237     math/s_csqrtl \
238     math/s_ctanhl \
239     math/s_ctanl \
240     math/s_fabsl \
241     math/s_floorl \
242     math/s_fmal \
243     math/s_frexpl \
244     math/s_ilogbl \
245     math/s_llrintl \
246     math/s_llroundl \
247     math/s_lrintl \
248     math/s_lroundl \
249     math/s_logbl \
250     math/s_modfl \
251     math/s_nextafterl \
252     math/s_nexttoward \
253     math/s_remquol \
254     math/s_rintl \
255     math/s_roundl \
256     math/s_scalbnl \
257     math/s_sincosl \
258     math/s_sinl \
259     math/s_tanl \
260     math/s_truncl
262 # Support files for 80bit and 128bit precision long double.
264 STDC_LONGDB80_MATH := \
265     math/ld80/e_acoshl \
266     math/ld80/e_atanhl \
267     math/ld80/e_coshl \
268     math/ld80/e_expl \
269     math/ld80/e_lgammal_r \
270     math/ld80/e_log2l \
271     math/ld80/e_log10l \
272     math/ld80/e_logl \
273     math/ld80/e_powl \
274     math/ld80/e_sinhl \
275     math/ld80/e_tgammal \
276     math/ld80/invtrig \
277     math/ld80/k_cosl \
278     math/ld80/k_sinl \
279     math/ld80/k_tanl \
280     math/ld80/s_asinhl \
281     math/ld80/s_erfl \
282     math/ld80/s_exp2l \
283     math/ld80/s_expm1l \
284     math/ld80/s_log1pl \
285     math/ld80/s_nanl \
286     math/ld80/s_tanhl
288 STDC_LONGDB128_MATH := \
289     math/ld128/e_acoshl \
290     math/ld128/e_atanhl \
291     math/ld128/e_coshl \
292     math/ld128/e_expl \
293     math/ld128/e_lgammal_r \
294     math/ld128/e_log2l \
295     math/ld128/e_log10l \
296     math/ld128/e_logl \
297     math/ld128/e_powl \
298     math/ld128/e_sinhl \
299     math/ld128/e_tgammal \
300     math/ld128/invtrig \
301     math/ld128/k_cosl \
302     math/ld128/k_sinl \
303     math/ld128/k_tanl \
304     math/ld128/s_asinhl \
305     math/ld128/s_erfl \
306     math/ld128/s_exp2l \
307     math/ld128/s_expm1l \
308     math/ld128/s_log1pl \
309     math/ld128/s_nanl \
310     math/ld128/s_tanhl
313 # Add 80bit long double support on x86, x64 and m68k
315 ifneq ($(filter $(AROS_TARGET_CPU),i386 x86_64 m68k),)
316 STDC_MATH += $(STDC_LONGDB_MATH)
317 STDC_MATH += $(STDC_LONGDB80_MATH)
318 USER_INCLUDES += -I$(SRCDIR)/$(CURDIR)/math/ld80
319 STDC_SCABS_MATH += math/s_cabsl
320 STDC_WCABS_MATH += math/w_cabsl
321 else
323 # Add 128bit long double support for aarch64
325 ifneq ($(filter $(AROS_TARGET_CPU),aarch64),)
326 STDC_MATH += $(STDC_LONGDB_MATH)
327 STDC_MATH += $(STDC_LONGDB128_MATH)
328 USER_INCLUDES += -I$(SRCDIR)/$(CURDIR)/math/ld128
329 STDC_SCABS_MATH += math/s_cabsl
330 STDC_WCABS_MATH += math/w_cabsl
331 else
333 # We either don't know what long double format is required
334 # or the platform doesn't support it, so alias the double versions
335 # of necessary functions.
336 # These architectures should have
337 # LDBL_MANT_DIG == DBL_MANT_DIG (53) in float.h
339 endif
340 endif
342 STDC_MATH += $(STDC_WCABS_MATH)
344 STDC := \
345     __ctype \
346     __exitfunc \
347     __optionallibs \
348     __signal \
349     __stdc_assert \
350     __stdc_gmtoffset \
351     __stdc_ioerr2errno \
352     __stdc_startup \
353     __stdc_fpuprivate \
354     __vcformat \
355     __vcscan \
356     _exit \
357     abort \
358     abs labs llabs \
359     asctime asctime_r \
360     atexit \
361     atof \
362     atoi \
363     atol \
364     atoll \
365     bsearch \
366     calloc \
367     clock \
368     ctime ctime_r \
369     difftime \
370     div ldiv lldiv \
371     exit \
372     fenv _fenv \
373     free \
374     getc \
375     gmtime gmtime_r \
376     imaxabs \
377     imaxdiv \
378     localeconv \
379     localtime localtime_r \
380     longjmp \
381     malloc \
382     malloc_align \
383     $(STDC_MATH) \
384     mblen \
385     memchr \
386     memcmp \
387     memcpy \
388     memmove \
389     memset \
390     mktime \
391     on_exit \
392     putc \
393     qsort \
394     raise \
395     rand \
396     realloc \
397     realloc_nocopy \
398     setjmp \
399     setlocale \
400     signal \
401     snprintf \
402     sprintf \
403     sscanf \
404     stccpy \
405     stcd_l \
406     stch_l \
407     stcl_d \
408     stcl_h \
409     stcl_o \
410     stco_l \
411     stcu_d \
412     stpblk \
413     stpcpy \
414     stpsym \
415     strcasecmp \
416     strcat \
417     strchr \
418     strcmp \
419     strcoll \
420     strcpy \
421     strcspn \
422     strdup \
423     strerror \
424     strftime \
425     strlcat \
426     strlcpy \
427     strlen \
428     strnlen \
429     strlwr \
430     strncasecmp \
431     strncat \
432     strncmp \
433     strncpy \
434     strndup \
435     strpbrk \
436     strrchr \
437     strrev \
438     strsep \
439     strspn \
440     strstr \
441     strtod \
442     strtof \
443     strtoimax \
444     strtok \
445     strtok_r \
446     strtol \
447     strtold \
448     strtoll \
449     strtoul \
450     strtoull \
451     strtoumax \
452     strupr \
453     strxfrm \
454     time \
455     vsnprintf \
456     vsprintf \
457     vsscanf
459 STDC_LINKLIB := \
460     __ctype_linklib \
461     strcasestr
463 # The common files will be put both in the shared and in the static link lib
464 STDC_COMMON := \
465     __stdc_geterrnoptr \
466     __stdc_getsigngamptr \
467     __stdc_mb_cur_max \
468     math/infinity
470 STDCIO := \
471     __stdcio_assert \
472     __stdcio_init \
473     __stdio \
474     clearerr \
475     fclose \
476     feof \
477     ferror \
478     fflush \
479     fgetc \
480     fgetpos \
481     fgets \
482     fopen \
483     fprintf \
484     fputc \
485     fputs \
486     fread \
487     freopen \
488     fscanf \
489     fseek \
490     fsetpos \
491     ftell \
492     fwrite \
493     getchar \
494     getenv \
495     gets \
496     printf \
497     putchar \
498     puts \
499     remove \
500     rename \
501     rewind \
502     scanf \
503     setbuf \
504     setvbuf \
505     system \
506     tmpfile \
507     tmpnam \
508     ungetc \
509     vfprintf \
510     vfscanf \
511     vprintf \
512     vscanf
514 # The common files will be put both in the shared and in the static link lib
515 STDCIO_COMMON := \
516     __stdcio_stdstreams
518 #MM- core-linklibs : linklibs-stdc linklibs-stdcio linklibs-libm
520 STDC_LINKOBJS := $(addsuffix .o,$(addprefix $(GENDIR)/$(CURDIR)/stdc/,$(notdir $(STDC_COMMON))))
522 # Ugh. These are for the math routines, which have a number of
523 # lint issues, that should be fixed.
524 NOWARN_FLAGS := $(NOWARN_NONNULL_COMPARE) $(NOWARN_UNUSED_VARIABLE) \
525     $(NOWARN_PARENTHESES) $(NOWARN_UNINITIALIZED)
527 USER_CFLAGS := $(NOWARN_FLAGS) -noposixc $(CFLAGS_NO_BUILTIN)
528 USER_LDFLAGS := -nostdc -noposixc
529 USER_CPPFLAGS := -Dlint '-D__FBSDID(x)=' 
531 %build_module mmake=compiler-stdc \
532     modname=stdc modtype=library \
533     files="$(STDC) $(STDC_COMMON)" \
534     linklibfiles=$(STDC_LINKLIB) linklibobjs=$(STDC_LINKOBJS)
536 STDCIO_LINKOBJS := $(addsuffix .o,$(addprefix $(GENDIR)/$(CURDIR)/stdcio/,$(notdir $(STDCIO_COMMON))))
538 %build_module mmake=compiler-stdcio \
539     modname=stdcio modtype=library \
540     files="$(STDCIO) $(STDCIO_COMMON)" \
541     linklibobjs=$(STDCIO_LINKOBJS) \
542     uselibs="stdc_rel"
544 STDC_MATH_STATIC := \
545     math/e_log \
546     math/e_logf \
547     math/e_log2 \
548     math/e_log2f \
549     math/e_log10 \
550     math/e_log10f \
551     math/e_pow \
552     math/e_powf \
553     math/e_rem_pio2 \
554     math/e_sqrt \
555     math/k_cos \
556     math/k_rem_pio2 \
557     math/k_sin \
558     math/s_copysign \
559     math/s_copysignf \
560     math/s_copysignl \
561     math/s_cos \
562     math/s_fabs \
563     math/s_floor \
564     math/s_fpclassify \
565     math/s_scalbn \
566     math/s_scalbnf
568 STDC_STATIC := \
569     __ctype \
570     __vcformat \
571     __vcscan \
572     atoi \
573     atol \
574     atoll \
575     bsearch \
576     $(STDC_MATH_STATIC) \
577     memchr \
578     memcmp \
579     memcpy \
580     memmove \
581     memset \
582     qsort \
583     snprintf \
584     sprintf \
585     sscanf \
586     stccpy \
587     stpblk \
588     strcasecmp \
589     strcasestr \
590     strcat \
591     stcd_l \
592     stch_l \
593     stcl_d \
594     stcl_h \
595     stcl_o \
596     stco_l \
597     stcu_d \
598     stpcpy \
599     strchr \
600     strcmp \
601     strcpy \
602     strcspn \
603     strlcat \
604     strlcpy \
605     strlen \
606     strnlen \
607     strlwr \
608     strncasecmp \
609     strncat \
610     strncpy \
611     strncmp \
612     strpbrk \
613     strrchr \
614     strspn \
615     strstr \
616     strtod \
617     strtof \
618     strtol \
619     strtoul \
620     vsnprintf \
621     vsprintf \
622     vsscanf
624 USER_CFLAGS := $(NOWARN_FLAGS) $(CFLAGS_NO_BUILTIN)
625 USER_CPPFLAGS := -DSTDC_STATIC -Dlint
627 #MM- core-linklibs : linklibs-stdc-static
628 %build_linklib mmake=linklibs-stdc-static libname=stdc.static \
629     files="$(STDC_STATIC)" objdir=$(GENDIR)/$(CURDIR)/static
631 #MM- linklibs-romhack : compiler-stdc
632 # FIXME: The next romhack linklib is a temporary hack and has to be
633 # excommunicated in the future !
634 # setjmp()/longjmp() is used in dos.library so make it available.
635 # Plan to put stdc.library also in aros-base rom so this is not needed anymore
636 %build_linklib mmake=linklibs-romhack \
637     objdir=$(GENDIR)/$(CURDIR)/stdc libname=romhack files="setjmp longjmp"
639 CFLAGS32 := $(filter-out -mcmodel=large,$(CFLAGS))
641 # x86_64 needs a 32bit version stdc.static
642 %build_linklib mmake=linklibs-stdc-static32 \
643     libname=stdc.static files="$(STDC_STATIC)" objs=$(ROM_COMMON_OBJ32) \
644     cflags="-m32 $(CFLAGS32) -DSTDC_LIB32 -DSTDC_STATIC" \
645     objdir=$(GENDIR)/$(CURDIR)/32bit libdir=$(GENDIR)/lib32
647 # A dummy libm.a is provided so that -lm link option does not produce an error
648 # objdir is provided to avoid that arch specific files end up in libm.a
649 %build_linklib mmake=linklibs-libm \
650     libname=m files=empty objdir=$(GENDIR)/$(CURDIR)/libm