Makefile revision 90070
1# $FreeBSD: head/lib/libstand/Makefile 90070 2002-02-01 16:33:40Z sobomax $
2#
3# Originally from	$NetBSD: Makefile,v 1.21 1997/10/26 22:08:38 lukem Exp $
4#
5# Notes:
6# - We don't use the libc strerror/sys_errlist because the string table is
7#   quite large.
8#
9
10LIB=		stand
11NOPROFILE=	YES
12NOPIC=		YES
13MAN=		libstand.3
14
15# Mostly OK, some of the libc imports are a bit noisy
16CFLAGS+=	-Wall
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+=	__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# string functions from libc
37.PATH:	${.CURDIR}/../libc/string
38.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
39	${MACHINE_ARCH} == "sparc64"
40SRCS+=	bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
41        memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
42        strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
43	strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
44.endif
45.if ${MACHINE_ARCH} == "alpha"
46.PATH: ${.CURDIR}/../libc/alpha/string
47SRCS+=	bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
48	memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
49	strcmp.c strcpy.c strcspn.c strlen.c \
50	strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
51	strspn.c strstr.c strtok.c swab.c
52
53.PATH: ${.CURDIR}/../libc/alpha/net
54SRCS+= htons.S ntohs.S htonl.S ntohl.S
55
56SRCS+= __divqu.S __divq.S __divlu.S __divl.S
57SRCS+= __remqu.S __remq.S __remlu.S __reml.S
58
59CLEANFILES+=   __divqu.S __divq.S __divlu.S __divl.S
60CLEANFILES+=   __remqu.S __remq.S __remlu.S __reml.S
61
62
63__divqu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
64	m4 -DNAME=__divqu -DOP=div -DS=false -DWORDSIZE=64 \
65		${.ALLSRC} > ${.TARGET}
66
67__divq.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
68	m4 -DNAME=__divq -DOP=div -DS=true -DWORDSIZE=64 \
69		${.ALLSRC} > ${.TARGET}
70
71__divlu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
72	m4 -DNAME=__divlu -DOP=div -DS=false -DWORDSIZE=32 \
73		${.ALLSRC} > ${.TARGET}
74
75__divl.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
76	m4 -DNAME=__divl -DOP=div -DS=true -DWORDSIZE=32 \
77		${.ALLSRC} > ${.TARGET}
78
79__remqu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
80	m4 -DNAME=__remqu -DOP=rem -DS=false -DWORDSIZE=64 \
81		${.ALLSRC} > ${.TARGET}
82
83__remq.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
84	m4 -DNAME=__remq -DOP=rem -DS=true -DWORDSIZE=64 \
85		${.ALLSRC} > ${.TARGET}
86
87__remlu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
88	m4 -DNAME=__remlu -DOP=rem -DS=false -DWORDSIZE=32 \
89		${.ALLSRC} > ${.TARGET}
90
91__reml.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
92	m4 -DNAME=__reml -DOP=rem -DS=true -DWORDSIZE=32 \
93		${.ALLSRC} > ${.TARGET}
94.endif
95.if ${MACHINE_ARCH} == "ia64"
96.PATH: ${.CURDIR}/../libc/ia64/string
97SRCS+=	bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
98	memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
99	strcmp.c strcpy.c strcspn.c strlen.c \
100	strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
101	strspn.c strstr.c strtok.c swab.c
102
103.PATH: ${.CURDIR}/../libc/ia64/net
104SRCS+= htons.S ntohs.S htonl.S ntohl.S
105
106.PATH: ${.CURDIR}/../libc/ia64/gen
107SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S
108SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S
109.endif
110
111.if ${MACHINE_ARCH} != "sparc64"
112# _setjmp/_longjmp
113.PATH:	${.CURDIR}/${MACHINE_ARCH}
114SRCS+=	_setjmp.S
115.endif
116
117# decompression functionality from libbz2
118.PATH:	${.CURDIR}/../../contrib/bzip2
119CFLAGS+=-I${.CURDIR} -DBZ_NO_STDIO -DBZ_NO_COMPRESS
120SRCS+=	_bzlib.c _crctable.c _decompress.c _huffman.c _randtable.c _bzlib.h \
121	_bzlib_private.h
122
123# check your belt - ugly bzip2 stuff ahead
124.for file in bzlib.c bzlib.h bzlib_private.h
125CLEANFILES+=   _${file} _${file}.orig
126
127_${file}: ${file} ${file}.diff
128	patch -s -b .orig -o ${.TARGET} < ${.ALLSRC:M*.diff} ${.ALLSRC:M*.[ch]}
129.endfor
130
131.for file in crctable.c decompress.c huffman.c randtable.c
132CLEANFILES+=    _${file}
133
134_${file}: ${file}
135	sed "s|bzlib_private\.h|_bzlib_private.h|" ${.ALLSRC} > ${.TARGET}
136.endfor
137
138# decompression functionality from libz
139.PATH:	${.CURDIR}/../libz
140CFLAGS+=-DHAVE_MEMCPY
141SRCS+=	adler32.c crc32.c infblock.c infcodes.c inffast.c inflate.c \
142	inftrees.c infutil.c zutil.c 
143
144# io routines
145SRCS+=	closeall.c dev.c ioctl.c nullfs.c stat.c \
146	fstat.c close.c lseek.c open.c read.c write.c readdir.c
147
148# network routines
149SRCS+=	arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
150
151# network info services:
152SRCS+=	bootp.c rarp.c bootparam.c
153
154# boot filesystems
155SRCS+=	ufs.c nfs.c cd9660.c tftp.c zipfs.c bzipfs.c
156SRCS+=	netif.c nfs.c
157SRCS+=	dosfs.c ext2fs.c
158
159beforeinstall:
160	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/stand.h \
161		${DESTDIR}/usr/include
162
163.include <bsd.lib.mk>
164