Initial import from FreeBSD RELENG_4:
[dragonfly.git] / lib / libstand / Makefile
CommitLineData
984263bc
MD
1# $FreeBSD: src/lib/libstand/Makefile,v 1.14.2.10 2002/07/22 14:21:50 ru Exp $
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
13INCS= stand.h
14MAN= libstand.3
15
16# Mostly OK, some of the libc imports are a bit noisy
17CFLAGS+= -Wall
18
19.if ${MACHINE_ARCH} == "alpha"
20CFLAGS+= -mno-fp-regs
21.endif
22.if ${MACHINE_ARCH} == "i386"
23CFLAGS+= -mpreferred-stack-boundary=2
24.endif
25
26
27# standalone components and stuff we have modified locally
28SRCS+= __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
29 globals.c pager.c printf.c strdup.c strerror.c strtol.c random.c \
30 sbrk.c twiddle.c zalloc.c zalloc_malloc.c
31
32# private (pruned) versions of libc string functions
33SRCS+= strcasecmp.c
34
35# string functions from libc
36.PATH: ${.CURDIR}/../libc/string
37.if ${MACHINE_ARCH} == "i386"
38SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
39 memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
40 strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
41 strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
42.endif
43.if ${MACHINE_ARCH} == "alpha"
44.PATH: ${.CURDIR}/../libc/alpha/string
45SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
46 memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
47 strcmp.c strcpy.c strcspn.c strlen.c \
48 strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
49 strspn.c strstr.c strtok.c swab.c
50
51.PATH: ${.CURDIR}/../libc/alpha/net
52SRCS+= htons.S ntohs.S htonl.S ntohl.S
53
54SRCS+= __divqu.S __divq.S __divlu.S __divl.S
55SRCS+= __remqu.S __remq.S __remlu.S __reml.S
56
57CLEANFILES+= __divqu.S __divq.S __divlu.S __divl.S
58CLEANFILES+= __remqu.S __remq.S __remlu.S __reml.S
59
60
61__divqu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
62 m4 -DNAME=__divqu -DOP=div -DS=false -DWORDSIZE=64 \
63 ${.ALLSRC} > ${.TARGET}
64
65__divq.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
66 m4 -DNAME=__divq -DOP=div -DS=true -DWORDSIZE=64 \
67 ${.ALLSRC} > ${.TARGET}
68
69__divlu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
70 m4 -DNAME=__divlu -DOP=div -DS=false -DWORDSIZE=32 \
71 ${.ALLSRC} > ${.TARGET}
72
73__divl.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
74 m4 -DNAME=__divl -DOP=div -DS=true -DWORDSIZE=32 \
75 ${.ALLSRC} > ${.TARGET}
76
77__remqu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
78 m4 -DNAME=__remqu -DOP=rem -DS=false -DWORDSIZE=64 \
79 ${.ALLSRC} > ${.TARGET}
80
81__remq.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
82 m4 -DNAME=__remq -DOP=rem -DS=true -DWORDSIZE=64 \
83 ${.ALLSRC} > ${.TARGET}
84
85__remlu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
86 m4 -DNAME=__remlu -DOP=rem -DS=false -DWORDSIZE=32 \
87 ${.ALLSRC} > ${.TARGET}
88
89__reml.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
90 m4 -DNAME=__reml -DOP=rem -DS=true -DWORDSIZE=32 \
91 ${.ALLSRC} > ${.TARGET}
92.endif
93
94# _setjmp/_longjmp
95.PATH: ${.CURDIR}/${MACHINE_ARCH}
96SRCS+= _setjmp.S
97# really only required for i386
98CFLAGS+=-I${.CURDIR}/../libc/${MACHINE_ARCH}
99
100# decompression functionality from libbz2
101.PATH: ${.CURDIR}/../../contrib/bzip2
102CFLAGS+=-I. -DBZ_NO_STDIO -DBZ_NO_COMPRESS
103SRCS+= _bzlib.c _crctable.c _decompress.c _huffman.c _randtable.c _bzlib.h \
104 _bzlib_private.h
105
106# check your belt - ugly bzip2 stuff ahead
107.for file in bzlib.c bzlib.h bzlib_private.h
108CLEANFILES+= _${file} _${file}.orig
109
110_${file}: ${file} ${file}.diff
111 patch -s -b .orig -o ${.TARGET} < ${.ALLSRC:M*.diff} ${.ALLSRC:M*.[ch]}
112.endfor
113
114.for file in crctable.c decompress.c huffman.c randtable.c
115CLEANFILES+= _${file}
116
117_${file}: ${file}
118 sed "s|bzlib_private\.h|_bzlib_private.h|" ${.ALLSRC} > ${.TARGET}
119.endfor
120
121# decompression functionality from libz
122.PATH: ${.CURDIR}/../libz
123CFLAGS+=-DHAVE_MEMCPY
124SRCS+= adler32.c crc32.c infblock.c infcodes.c inffast.c inflate.c \
125 inftrees.c infutil.c zutil.c
126
127# io routines
128SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
129 fstat.c close.c lseek.c open.c read.c write.c readdir.c
130
131# network routines
132SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
133
134# network info services:
135SRCS+= bootp.c rarp.c bootparam.c
136
137# boot filesystems
138SRCS+= ufs.c nfs.c cd9660.c tftp.c zipfs.c bzipfs.c
139SRCS+= netif.c nfs.c
140SRCS+= dosfs.c ext2fs.c
141SRCS+= splitfs.c
142
143.include <bsd.lib.mk>