1 # from @(#)Makefile.inc 8.3 (Berkeley) 2/4/95
2 # $FreeBSD: src/lib/libc/stdlib/Makefile.inc,v 1.45 2003/04/05 07:33:46 tjr Exp $
4 # machine-dependent stdlib sources
5 .sinclude "${.CURDIR}/${MACHINE_ARCH}/stdlib/Makefile.inc"
7 # machine-independent stdlib sources
8 .PATH: ${.CURDIR}/stdlib
9 CWD := ${.CURDIR}/stdlib
11 MISRCS+=a64l.c grantpt.c l64a.c
14 .endif # FEATURE_BLOCKS
16 .include "Makefile.fbsd_begin"
17 FBSDMISRCS=_Exit_.c abort.c abs.c atexit.c atof.c atoi.c atol.c atoll.c \
18 bsearch.c div.c exit.c getenv.c getopt.c getopt_long.c getsubopt.c \
19 hcreate.c heapsort.c imaxabs.c imaxdiv.c insque.c labs.c \
20 ldiv.c llabs.c lldiv.c lsearch.c merge.c putenv.c qsort.c qsort_r.c \
21 radixsort.c rand.c random.c reallocf.c realpath.c remque.c setenv.c \
22 strhash.c strtoimax.c strtol.c strtoll.c strtoq.c strtoul.c \
23 strtoull.c strtoumax.c strtouq.c system.c tdelete.c tfind.c tsearch.c \
26 .include "Makefile.fbsd_end"
28 # special cases: heapsort_b-fbsd.c, merge_b-fbsd.c
29 .for _file in heapsort merge
31 .for _cwd in ${CWD} # This .for statement forces evaluation of ${CWD}
32 AUTOPATCHSRCS+= ${_cwd}/${_file}_b-fbsd.c
33 ${_cwd}/${_file}_b-fbsd.c: ${_cwd}/FreeBSD/${_file}.c
34 ${CP} ${.ALLSRC} ${.TARGET}
35 ${PATCH} ${.TARGET} ${.ALLSRC:S/${_file}/${_file}_b/}.patch
40 .endif # FEATURE_BLOCKS
44 # special cases: heapsort_r-fbsd.c
45 .for _file in heapsort
47 .for _cwd in ${CWD} # This .for statement forces evaluation of ${CWD}
48 AUTOPATCHSRCS+= ${_cwd}/${_file}_r-fbsd.c
49 ${_cwd}/${_file}_r-fbsd.c: ${_cwd}/FreeBSD/${_file}.c
50 ${CP} ${.ALLSRC} ${.TARGET}
51 ${PATCH} ${.TARGET} ${.ALLSRC:S/${_file}/${_file}_r/}.patch
58 # special cases: psort{,_b,_r}-fbsd.c psort.3
59 .for _cwd in ${CWD} # This .for statement forces evaluation of ${CWD}
61 AUTOPATCHSRCS+= ${_cwd}/psort-fbsd.c
62 ${_cwd}/psort-fbsd.c: ${_cwd}/qsort-fbsd.c
63 ${CP} ${.ALLSRC} ${.TARGET}
64 ${PATCH} ${.TARGET} ${_cwd}/psort.c.patch
65 .for _file in psort_b psort_r
66 AUTOPATCHSRCS+= ${_cwd}/${_file}-fbsd.c
67 ${_cwd}/${_file}-fbsd.c: ${_cwd}/psort-fbsd.c
68 ${LN} ${.ALLSRC} ${.TARGET}
70 AUTOPATCHMAN+= ${_cwd}/psort.3
71 ${_cwd}/psort.3: ${_cwd}/qsort.3
72 ${CP} ${.ALLSRC} ${.TARGET}
73 ${PATCH} ${.TARGET} ${_cwd}/psort.3.patch
75 MISRCS+= psort.c psort_r.c
76 CFLAGS-psort_r-fbsd.c += -DI_AM_PSORT_R
79 CFLAGS-psort_b-fbsd.c += -DI_AM_PSORT_B
80 .endif # FEATURE_BLOCKS
84 .include "Makefile.nbsd_begin"
85 NBSDMISRCS = strfmon.c
86 .include "Makefile.nbsd_end"
88 # 4302056: compile qsort.c and bsearch.c with -fexceptions
89 .for _src in qsort-fbsd.c bsearch-fbsd.c
90 CFLAGS-${_src} += -fexceptions
93 PRIV_INSTHDRS += ${SRCROOT}/stdlib/atexit.h
95 .include "Makefile.obsd_begin"
96 OBSDMISRCS=ecvt.c gcvt.c
97 .include "Makefile.obsd_end"
99 LEGACYSRCS+= getopt.c putenv.c realpath.c setenv.c system.c
100 DARWINEXTSNSRCS += realpath.c
101 CANCELABLESRCS += system.c
102 DYLDSRCS += atexit.c exit.c gettimeofday.c heapsort.c merge.c qsort.c reallocf.c realpath.c
104 # set the LIBC_ALIAS_* macros so we can decorate the symbol independent
105 # of other macro settings
106 CFLAGS-getopt-fbsd.c += -DLIBC_ALIAS_GETOPT
107 CFLAGS-putenv-fbsd.c += -DLIBC_ALIAS_PUTENV
108 CFLAGS-realpath-fbsd.c += -DLIBC_ALIAS_REALPATH
109 CFLAGS-setenv-fbsd.c += -DLIBC_ALIAS_SETENV -DLIBC_ALIAS_UNSETENV
110 CFLAGS-system-fbsd.c += -DLIBC_ALIAS_SYSTEM
113 MAN3+= a64l.3 grantpt.3 psort.3
114 MAN3+= strtod_l.3 strtol_l.3
116 .include "Makefile.fbsd_begin"
117 FBSDMAN3= abort.3 abs.3 alloca.3 atexit.3 atof.3 atoi.3 atol.3 bsearch.3 \
118 div.3 exit.3 getenv.3 getopt.3 getopt_long.3 getsubopt.3 \
119 hcreate.3 imaxabs.3 imaxdiv.3 insque.3 labs.3 ldiv.3 llabs.3 lldiv.3 \
120 lsearch.3 memory.3 qsort.3 radixsort.3 rand.3 random.3 realpath.3 \
121 strtod.3 strtol.3 strtoul.3 system.3 tsearch.3
122 .include "Makefile.fbsd_end"
124 .include "Makefile.nbsd_begin"
126 .include "Makefile.nbsd_end"
128 .include "Makefile.obsd_begin"
130 .include "Makefile.obsd_end"
132 MLINKS+= a64l.3 l64a.3
134 .ifdef FEATURE_BLOCKS
135 MLINKS+= atexit.3 atexit_b.3
136 .endif # FEATURE_BLOCKS
138 MLINKS+= atof.3 atof_l.3
140 MLINKS+= atoi.3 atoi_l.3
142 MLINKS+= atol.3 atol_l.3 \
146 .ifdef FEATURE_BLOCKS
147 MLINKS+= bsearch.3 bsearch_b.3
148 .endif # FEATURE_BLOCKS
150 MLINKS+= ecvt.3 fcvt.3 \
153 MLINKS+= exit.3 _Exit.3
155 MLINKS+= getenv.3 putenv.3 \
159 MLINKS+= getopt_long.3 getopt_long_only.3
161 MLINKS+= grantpt.3 posix_openpt.3 \
162 grantpt.3 ptsname.3 \
165 MLINKS+= hcreate.3 hdestroy.3 \
168 MLINKS+= insque.3 remque.3
170 MLINKS+= lsearch.3 lfind.3
172 MLINKS+= psort.3 psort_r.3
173 .ifdef FEATURE_BLOCKS
174 MLINKS+= psort.3 psort_b.3
175 .endif # FEATURE_BLOCKS
177 MLINKS+= qsort.3 heapsort.3 \
178 qsort.3 mergesort.3 \
180 .ifdef FEATURE_BLOCKS
181 MLINKS+= qsort.3 heapsort_b.3 \
182 qsort.3 mergesort_b.3 \
184 .endif # FEATURE_BLOCKS
186 MLINKS+= radixsort.3 sradixsort.3
188 MLINKS+= rand.3 rand_r.3 \
192 MLINKS+= random.3 initstate.3 \
193 random.3 setstate.3 \
195 random.3 srandomdev.3
197 MLINKS+=strfmon.3 strfmon_l.3
199 MLINKS+= strtod.3 strtof.3 \
202 MLINKS+= strtod_l.3 strtof_l.3 \
203 strtod_l.3 strtold_l.3
205 MLINKS+= strtol.3 strtoll.3 \
209 MLINKS+= strtol_l.3 strtoimax_l.3 \
210 strtol_l.3 strtoll_l.3 \
211 strtol_l.3 strtoq_l.3 \
212 strtol_l.3 strtoul_l.3 \
213 strtol_l.3 strtoull_l.3 \
214 strtol_l.3 strtoumax_l.3 \
215 strtol_l.3 strtouq_l.3
217 MLINKS+= strtoul.3 strtoull.3 \
218 strtoul.3 strtoumax.3 \
221 MLINKS+= tsearch.3 tdelete.3 \