Initial import from FreeBSD RELENG_4:
[dragonfly.git] / lib / libstand / Makefile
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
10 LIB=            stand
11 NOPROFILE=      YES
12 NOPIC=          YES
13 INCS=           stand.h
14 MAN=            libstand.3
15
16 # Mostly OK, some of the libc imports are a bit noisy
17 CFLAGS+=        -Wall
18
19 .if ${MACHINE_ARCH} == "alpha"
20 CFLAGS+=        -mno-fp-regs
21 .endif
22 .if ${MACHINE_ARCH} == "i386"
23 CFLAGS+=        -mpreferred-stack-boundary=2
24 .endif
25
26
27 # standalone components and stuff we have modified locally
28 SRCS+=  __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
33 SRCS+=  strcasecmp.c
34
35 # string functions from libc
36 .PATH:  ${.CURDIR}/../libc/string
37 .if ${MACHINE_ARCH} == "i386"
38 SRCS+=  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
45 SRCS+=  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
52 SRCS+= htons.S ntohs.S htonl.S ntohl.S
53
54 SRCS+= __divqu.S __divq.S __divlu.S __divl.S
55 SRCS+= __remqu.S __remq.S __remlu.S __reml.S
56
57 CLEANFILES+=   __divqu.S __divq.S __divlu.S __divl.S
58 CLEANFILES+=   __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}
96 SRCS+=  _setjmp.S
97 # really only required for i386
98 CFLAGS+=-I${.CURDIR}/../libc/${MACHINE_ARCH}
99
100 # decompression functionality from libbz2
101 .PATH:  ${.CURDIR}/../../contrib/bzip2
102 CFLAGS+=-I. -DBZ_NO_STDIO -DBZ_NO_COMPRESS
103 SRCS+=  _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
108 CLEANFILES+=   _${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
115 CLEANFILES+=    _${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
123 CFLAGS+=-DHAVE_MEMCPY
124 SRCS+=  adler32.c crc32.c infblock.c infcodes.c inffast.c inflate.c \
125         inftrees.c infutil.c zutil.c 
126
127 # io routines
128 SRCS+=  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
132 SRCS+=  arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
133
134 # network info services:
135 SRCS+=  bootp.c rarp.c bootparam.c
136
137 # boot filesystems
138 SRCS+=  ufs.c nfs.c cd9660.c tftp.c zipfs.c bzipfs.c
139 SRCS+=  netif.c nfs.c
140 SRCS+=  dosfs.c ext2fs.c
141 SRCS+=  splitfs.c
142
143 .include <bsd.lib.mk>