Makefile revision 146839
150476Speter# $FreeBSD: head/lib/libstand/Makefile 146839 2005-05-31 20:39:53Z obrien $
238451Smsmith# Originally from	$NetBSD: Makefile,v 1.21 1997/10/26 22:08:38 lukem Exp $
338451Smsmith#
438451Smsmith# Notes:
538451Smsmith# - We don't use the libc strerror/sys_errlist because the string table is
638451Smsmith#   quite large.
738451Smsmith#
838451Smsmith
938451SmsmithLIB=		stand
10139106SruNO_PROFILE=
11139106SruNO_PIC=
1296462SruINCS=		stand.h
1374870SruMAN=		libstand.3
1438451Smsmith
15100394SpeterCFLAGS+= -ffreestanding -Wformat
16100394SpeterCFLAGS+= -I${.CURDIR}
1794310Sobrien
1838451Smsmith.if ${MACHINE_ARCH} == "alpha"
1938451SmsmithCFLAGS+=	-mno-fp-regs
2038451Smsmith.endif
2164549Speter.if ${MACHINE_ARCH} == "i386"
2264549SpeterCFLAGS+=	-mpreferred-stack-boundary=2
2364549Speter.endif
2466929Sobrien.if ${MACHINE_ARCH} == "powerpc"
25123382SgrehanCFLAGS+=	-msoft-float -D_STANDALONE
2666929Sobrien.endif
27116861Speter.if ${MACHINE_ARCH} == "amd64"
28146425SpeterCFLAGS+=	-m32 -I.
29116861Speter.endif
3038451Smsmith
3138451Smsmith# standalone components and stuff we have modified locally
32100394SpeterSRCS+=	zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
3340805Smsmith	globals.c pager.c printf.c strdup.c strerror.c strtol.c random.c \
3440805Smsmith	sbrk.c twiddle.c zalloc.c zalloc_malloc.c
3538451Smsmith
3640005Smsmith# private (pruned) versions of libc string functions
3740005SmsmithSRCS+=	strcasecmp.c
3839665Smsmith
3991394Stmm# byte order functions from libc
40116861Speter.if ${MACHINE_ARCH} != "amd64"
4191394Stmm.PATH: ${.CURDIR}/../libc/${MACHINE_ARCH}/net
42116861Speter.else
43116861Speter.PATH: ${.CURDIR}/../libc/i386/net
44116861Speter.endif
4591394StmmSRCS+= htons.S ntohs.S htonl.S ntohl.S
4691394Stmm
4738451Smsmith# string functions from libc
48146324Sobrien.PATH: ${.CURDIR}/../libc/string
4984995Srobert.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
50116861Speter	${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "amd64"
5138451SmsmithSRCS+=	bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
5240874Smsmith        memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
5338451Smsmith        strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
5438451Smsmith	strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
5538451Smsmith.endif
5638451Smsmith.if ${MACHINE_ARCH} == "alpha"
5738451Smsmith.PATH: ${.CURDIR}/../libc/alpha/string
5838451SmsmithSRCS+=	bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
5940005Smsmith	memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
6038451Smsmith	strcmp.c strcpy.c strcspn.c strlen.c \
6138451Smsmith	strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
6238451Smsmith	strspn.c strstr.c strtok.c swab.c
6338451Smsmith
6438451SmsmithSRCS+= __divqu.S __divq.S __divlu.S __divl.S
6538451SmsmithSRCS+= __remqu.S __remq.S __remlu.S __reml.S
6638451Smsmith
6738451SmsmithCLEANFILES+=   __divqu.S __divq.S __divlu.S __divl.S
6838451SmsmithCLEANFILES+=   __remqu.S __remq.S __remlu.S __reml.S
6938451Smsmith
7038451Smsmith
7138451Smsmith__divqu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
7238451Smsmith	m4 -DNAME=__divqu -DOP=div -DS=false -DWORDSIZE=64 \
7338451Smsmith		${.ALLSRC} > ${.TARGET}
7438451Smsmith
7538451Smsmith__divq.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
7638451Smsmith	m4 -DNAME=__divq -DOP=div -DS=true -DWORDSIZE=64 \
7738451Smsmith		${.ALLSRC} > ${.TARGET}
7838451Smsmith
7938451Smsmith__divlu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
8038451Smsmith	m4 -DNAME=__divlu -DOP=div -DS=false -DWORDSIZE=32 \
8138451Smsmith		${.ALLSRC} > ${.TARGET}
8238451Smsmith
8338451Smsmith__divl.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
8438451Smsmith	m4 -DNAME=__divl -DOP=div -DS=true -DWORDSIZE=32 \
8538451Smsmith		${.ALLSRC} > ${.TARGET}
8638451Smsmith
8738451Smsmith__remqu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
8838451Smsmith	m4 -DNAME=__remqu -DOP=rem -DS=false -DWORDSIZE=64 \
8938451Smsmith		${.ALLSRC} > ${.TARGET}
9038451Smsmith
9138451Smsmith__remq.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
9238451Smsmith	m4 -DNAME=__remq -DOP=rem -DS=true -DWORDSIZE=64 \
9338451Smsmith		${.ALLSRC} > ${.TARGET}
9438451Smsmith
9538451Smsmith__remlu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
9638451Smsmith	m4 -DNAME=__remlu -DOP=rem -DS=false -DWORDSIZE=32 \
9738451Smsmith		${.ALLSRC} > ${.TARGET}
9838451Smsmith
9938451Smsmith__reml.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
10038451Smsmith	m4 -DNAME=__reml -DOP=rem -DS=true -DWORDSIZE=32 \
10138451Smsmith		${.ALLSRC} > ${.TARGET}
10238451Smsmith.endif
10373887Sdfr.if ${MACHINE_ARCH} == "ia64"
10473887Sdfr.PATH: ${.CURDIR}/../libc/ia64/string
10573887SdfrSRCS+=	bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
10673887Sdfr	memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
10773887Sdfr	strcmp.c strcpy.c strcspn.c strlen.c \
10873887Sdfr	strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
10973887Sdfr	strspn.c strstr.c strtok.c swab.c
11038451Smsmith
11173887Sdfr.PATH: ${.CURDIR}/../libc/ia64/gen
11273887SdfrSRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S
11373887SdfrSRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S
11473887Sdfr.endif
115123382Sgrehan.if ${MACHINE_ARCH} == "powerpc"
116123382Sgrehan.PATH: ${.CURDIR}/../libc/quad
117123382SgrehanSRCS+=	ashldi3.c ashrdi3.c
118123382Sgrehan.PATH: ${.CURDIR}/../libc/powerpc/gen
119123382SgrehanSRCS+=	syncicache.c
120123382Sgrehan.endif
12173887Sdfr
12240891Smsmith# _setjmp/_longjmp
123116861Speter.if ${MACHINE_ARCH} == "amd64"
124146324Sobrien.PATH: ${.CURDIR}/i386
125116861Speter.else
126146324Sobrien.PATH: ${.CURDIR}/${MACHINE_ARCH}
127116861Speter.endif
12840891SmsmithSRCS+=	_setjmp.S
12984995Srobert
130146788Ssobomax# decompression functionality from libbz2
131146788Ssobomax# NOTE: to actually test this functionality after libbz2 upgrade compile
132146788Ssobomax# loader(8) with LOADER_BZIP2_SUPPORT defined
133146324Sobrien.PATH: ${.CURDIR}/../../contrib/bzip2
134146839SobrienCFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS
135146788SsobomaxSRCS+=	libstand_bzlib_private.h
136146324Sobrien
137146788Ssobomax.for file in bzlib.c crctable.c decompress.c huffman.c randtable.c
138146788SsobomaxSRCS+=	_${file}
139146788SsobomaxCLEANFILES+=	_${file}
140146788Ssobomax
141146788Ssobomax_${file}: ${file}
142146788Ssobomax	sed "s|bzlib_private\.h|libstand_bzlib_private.h|" ${.ALLSRC} > ${.TARGET}
143146788Ssobomax.endfor
144146788Ssobomax
145146788SsobomaxCLEANFILES+= libstand_bzlib_private.h
146146788Ssobomaxlibstand_bzlib_private.h: bzlib_private.h
147146788Ssobomax	sed -e 's|<stdlib.h>|"stand.h"|' \
148146788Ssobomax		${.ALLSRC} > ${.TARGET}
149146788Ssobomax
150146324Sobrien# decompression functionality from libz
151146324Sobrien.PATH: ${.CURDIR}/../libz
152100394SpeterCFLAGS+=-DHAVE_MEMCPY -I${.CURDIR}/../libz
153146327SobrienSRCS+=	adler32.c crc32.c libstand_zutil.h
15438451Smsmith
155131383Stjr.for file in infback.c inffast.c inflate.c inftrees.c zutil.c
156146327SobrienSRCS+=	_${file}
157105430SmarcelCLEANFILES+=	_${file}
158105430Smarcel
159100394Speter_${file}: ${file}
160146327Sobrien	sed "s|zutil\.h|libstand_zutil.h|" ${.ALLSRC} > ${.TARGET}
161100394Speter.endfor
162100394Speter
163146327Sobrien# depend on stand.h being able to be included multiple times
164146328SobrienCLEANFILES+= libstand_zutil.h
165146788Ssobomaxlibstand_zutil.h: zutil.h
166146327Sobrien	sed -e 's|<stddef.h>|"stand.h"|' \
167146327Sobrien	    -e 's|<string.h>|"stand.h"|' \
168146327Sobrien	    -e 's|<stdlib.h>|"stand.h"|' \
169146327Sobrien	    ${.ALLSRC} > ${.TARGET}
170146327Sobrien
17138451Smsmith# io routines
17238451SmsmithSRCS+=	closeall.c dev.c ioctl.c nullfs.c stat.c \
17359766Sjlemon	fstat.c close.c lseek.c open.c read.c write.c readdir.c
17438451Smsmith
17538451Smsmith# network routines
17668362SpsSRCS+=	arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
17738451Smsmith
17838451Smsmith# network info services:
17938451SmsmithSRCS+=	bootp.c rarp.c bootparam.c
18038451Smsmith
18138451Smsmith# boot filesystems
182146324SobrienSRCS+=	ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c
18359766SjlemonSRCS+=	dosfs.c ext2fs.c
18492494SsobomaxSRCS+=	splitfs.c
18538451Smsmith
18638451Smsmith.include <bsd.lib.mk>
187116861Speter
188116861Speter.if ${MACHINE_ARCH} == "amd64"
189116861Speter${SRCS:M*.c:R:S/$/.o/g}:	machine
190116861Speter
191116861Speterbeforedepend:	machine
192116861Speter
193116861Spetermachine:
194116861Speter	ln -s ${.CURDIR}/../../sys/i386/include machine
195116861Speter.endif
196