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