Makefile revision 100394
1# $FreeBSD: head/lib/libstand/Makefile 100394 2002-07-20 04:18:20Z peter $
2# Originally from	$NetBSD: Makefile,v 1.21 1997/10/26 22:08:38 lukem Exp $
3#
4# Notes:
5# - We don't use the libc strerror/sys_errlist because the string table is
6#   quite large.
7#
8
9LIB=		stand
10NOPROFILE=	YES
11NOPIC=		YES
12INCS=		stand.h
13MAN=		libstand.3
14
15CFLAGS+= -ffreestanding -Wformat
16CFLAGS+= -I${.CURDIR}
17
18.if ${MACHINE_ARCH} == "alpha"
19CFLAGS+=	-mno-fp-regs
20.endif
21.if ${MACHINE_ARCH} == "i386"
22CFLAGS+=	-mpreferred-stack-boundary=2
23.endif
24.if ${MACHINE_ARCH} == "powerpc"
25CFLAGS+=	-msoft-float
26.endif
27
28# standalone components and stuff we have modified locally
29SRCS+=	zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
30	globals.c pager.c printf.c strdup.c strerror.c strtol.c random.c \
31	sbrk.c twiddle.c zalloc.c zalloc_malloc.c
32
33# private (pruned) versions of libc string functions
34SRCS+=	strcasecmp.c
35
36# byte order functions from libc
37.PATH: ${.CURDIR}/../libc/${MACHINE_ARCH}/net
38SRCS+= htons.S ntohs.S htonl.S ntohl.S
39
40# string functions from libc
41.PATH:	${.CURDIR}/../libc/string
42.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
43	${MACHINE_ARCH} == "sparc64"
44SRCS+=	bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
45        memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
46        strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
47	strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
48.endif
49.if ${MACHINE_ARCH} == "alpha"
50.PATH: ${.CURDIR}/../libc/alpha/string
51SRCS+=	bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
52	memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
53	strcmp.c strcpy.c strcspn.c strlen.c \
54	strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
55	strspn.c strstr.c strtok.c swab.c
56
57SRCS+= __divqu.S __divq.S __divlu.S __divl.S
58SRCS+= __remqu.S __remq.S __remlu.S __reml.S
59
60CLEANFILES+=   __divqu.S __divq.S __divlu.S __divl.S
61CLEANFILES+=   __remqu.S __remq.S __remlu.S __reml.S
62
63
64__divqu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
65	m4 -DNAME=__divqu -DOP=div -DS=false -DWORDSIZE=64 \
66		${.ALLSRC} > ${.TARGET}
67
68__divq.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
69	m4 -DNAME=__divq -DOP=div -DS=true -DWORDSIZE=64 \
70		${.ALLSRC} > ${.TARGET}
71
72__divlu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
73	m4 -DNAME=__divlu -DOP=div -DS=false -DWORDSIZE=32 \
74		${.ALLSRC} > ${.TARGET}
75
76__divl.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
77	m4 -DNAME=__divl -DOP=div -DS=true -DWORDSIZE=32 \
78		${.ALLSRC} > ${.TARGET}
79
80__remqu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
81	m4 -DNAME=__remqu -DOP=rem -DS=false -DWORDSIZE=64 \
82		${.ALLSRC} > ${.TARGET}
83
84__remq.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
85	m4 -DNAME=__remq -DOP=rem -DS=true -DWORDSIZE=64 \
86		${.ALLSRC} > ${.TARGET}
87
88__remlu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
89	m4 -DNAME=__remlu -DOP=rem -DS=false -DWORDSIZE=32 \
90		${.ALLSRC} > ${.TARGET}
91
92__reml.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
93	m4 -DNAME=__reml -DOP=rem -DS=true -DWORDSIZE=32 \
94		${.ALLSRC} > ${.TARGET}
95.endif
96.if ${MACHINE_ARCH} == "ia64"
97.PATH: ${.CURDIR}/../libc/ia64/string
98SRCS+=	bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
99	memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
100	strcmp.c strcpy.c strcspn.c strlen.c \
101	strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
102	strspn.c strstr.c strtok.c swab.c
103
104.PATH: ${.CURDIR}/../libc/ia64/gen
105SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S
106SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S
107.endif
108
109# _setjmp/_longjmp
110.PATH:	${.CURDIR}/${MACHINE_ARCH}
111SRCS+=	_setjmp.S
112
113# decompression functionality from libbz2
114.PATH:	${.CURDIR}/../../contrib/bzip2
115CFLAGS+=-I. -DBZ_NO_STDIO -DBZ_NO_COMPRESS
116SRCS+=	_bzlib.c _crctable.c _decompress.c _huffman.c _randtable.c _bzlib.h \
117	_bzlib_private.h
118
119# check your belt - ugly bzip2 stuff ahead
120.for file in bzlib.c bzlib.h bzlib_private.h
121CLEANFILES+=   _${file} _${file}.orig
122
123_${file}: ${file} ${file}.diff
124	patch -s -b .orig -o ${.TARGET} < ${.ALLSRC:M*.diff} ${.ALLSRC:M*.[ch]}
125.endfor
126
127.for file in crctable.c decompress.c huffman.c randtable.c
128CLEANFILES+=    _${file}
129
130_${file}: ${file}
131	sed "s|bzlib_private\.h|_bzlib_private.h|" ${.ALLSRC} > ${.TARGET}
132.endfor
133
134# decompression functionality from libz
135.PATH:	${.CURDIR}/../libz
136CFLAGS+=-DHAVE_MEMCPY -I${.CURDIR}/../libz
137SRCS+=	adler32.c crc32.c _infblock.c _infcodes.c _inffast.c _inflate.c \
138	_inftrees.c _infutil.c _zutil.c _zutil.h
139
140# aargh
141.for file in zutil.h
142CLEANFILES+=	_${file} _${file}.orig
143
144_${file}: ${file} ${file}.diff
145	patch -s -b .orig -o ${.TARGET} < ${.ALLSRC:M*.diff} ${.ALLSRC:M*.[ch]}
146.endfor
147
148.for file in infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c zutil.c
149_${file}: ${file}
150	sed "s|zutil\.h|_zutil.h|" ${.ALLSRC} > ${.TARGET}
151.endfor
152
153# io routines
154SRCS+=	closeall.c dev.c ioctl.c nullfs.c stat.c \
155	fstat.c close.c lseek.c open.c read.c write.c readdir.c
156
157# network routines
158SRCS+=	arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
159
160# network info services:
161SRCS+=	bootp.c rarp.c bootparam.c
162
163# boot filesystems
164SRCS+=	ufs.c nfs.c cd9660.c tftp.c zipfs.c bzipfs.c
165SRCS+=	netif.c nfs.c
166SRCS+=	dosfs.c ext2fs.c
167SRCS+=	splitfs.c
168
169.include <bsd.lib.mk>
170