]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libstand/Makefile
Copy device support from head in to 6
[FreeBSD/FreeBSD.git] / lib / libstand / Makefile
1 # $FreeBSD$
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
9 LIB=            stand
10 NO_PROFILE=
11 NO_PIC=
12 INCS=           stand.h
13 MAN=            libstand.3
14
15 CFLAGS+= -ffreestanding -Wformat
16 CFLAGS+= -I${.CURDIR}
17
18 .if ${MACHINE_ARCH} == "alpha"
19 CFLAGS+=        -mno-fp-regs
20 .endif
21 .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
22 CFLAGS+=        -mpreferred-stack-boundary=2
23 CFLAGS+=        -mno-mmx -mno-3dnow -mno-sse -mno-sse2
24 .endif
25 .if ${MACHINE} == "pc98"
26 CFLAGS+=        -Os
27 .endif
28 .if ${MACHINE_ARCH} == "powerpc"
29 CFLAGS+=        -msoft-float -D_STANDALONE
30 .endif
31 .if ${MACHINE_ARCH} == "amd64"
32 CFLAGS+=        -m32 -I.
33 .endif
34
35 # standalone components and stuff we have modified locally
36 SRCS+=  zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
37         globals.c pager.c printf.c strdup.c strerror.c strtol.c random.c \
38         sbrk.c twiddle.c zalloc.c zalloc_malloc.c
39
40 # private (pruned) versions of libc string functions
41 SRCS+=  strcasecmp.c
42
43 # byte order functions from libc
44 .if ${MACHINE_ARCH} != "amd64"
45 .PATH: ${.CURDIR}/../libc/${MACHINE_ARCH}/net
46 .else
47 .PATH: ${.CURDIR}/../libc/i386/net
48 .endif
49 SRCS+= htons.S ntohs.S htonl.S ntohl.S
50
51 # string functions from libc
52 .PATH: ${.CURDIR}/../libc/string
53 .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
54         ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "amd64"
55 SRCS+=  bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
56         memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
57         strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
58         strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
59 .endif
60 .if ${MACHINE_ARCH} == "alpha"
61 .PATH: ${.CURDIR}/../libc/alpha/string
62 SRCS+=  bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
63         memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
64         strcmp.c strcpy.c strcspn.c strlen.c \
65         strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
66         strspn.c strstr.c strtok.c swab.c
67
68 SRCS+= __divqu.S __divq.S __divlu.S __divl.S
69 SRCS+= __remqu.S __remq.S __remlu.S __reml.S
70
71 CLEANFILES+=   __divqu.S __divq.S __divlu.S __divl.S
72 CLEANFILES+=   __remqu.S __remq.S __remlu.S __reml.S
73
74
75 __divqu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
76         m4 -DNAME=__divqu -DOP=div -DS=false -DWORDSIZE=64 \
77                 ${.ALLSRC} > ${.TARGET}
78
79 __divq.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
80         m4 -DNAME=__divq -DOP=div -DS=true -DWORDSIZE=64 \
81                 ${.ALLSRC} > ${.TARGET}
82
83 __divlu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
84         m4 -DNAME=__divlu -DOP=div -DS=false -DWORDSIZE=32 \
85                 ${.ALLSRC} > ${.TARGET}
86
87 __divl.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
88         m4 -DNAME=__divl -DOP=div -DS=true -DWORDSIZE=32 \
89                 ${.ALLSRC} > ${.TARGET}
90
91 __remqu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
92         m4 -DNAME=__remqu -DOP=rem -DS=false -DWORDSIZE=64 \
93                 ${.ALLSRC} > ${.TARGET}
94
95 __remq.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
96         m4 -DNAME=__remq -DOP=rem -DS=true -DWORDSIZE=64 \
97                 ${.ALLSRC} > ${.TARGET}
98
99 __remlu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
100         m4 -DNAME=__remlu -DOP=rem -DS=false -DWORDSIZE=32 \
101                 ${.ALLSRC} > ${.TARGET}
102
103 __reml.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
104         m4 -DNAME=__reml -DOP=rem -DS=true -DWORDSIZE=32 \
105                 ${.ALLSRC} > ${.TARGET}
106 .endif
107 .if ${MACHINE_ARCH} == "ia64"
108 .PATH: ${.CURDIR}/../libc/ia64/string
109 SRCS+=  bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
110         memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
111         strcmp.c strcpy.c strcspn.c strlen.c \
112         strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
113         strspn.c strstr.c strtok.c swab.c
114
115 .PATH: ${.CURDIR}/../libc/ia64/gen
116 SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S
117 SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S
118 .endif
119 .if ${MACHINE_ARCH} == "powerpc"
120 .PATH: ${.CURDIR}/../libc/quad
121 SRCS+=  ashldi3.c ashrdi3.c
122 .PATH: ${.CURDIR}/../libc/powerpc/gen
123 SRCS+=  syncicache.c
124 .endif
125
126 # uuid functions from libc
127 .PATH: ${.CURDIR}/../libc/uuid
128 SRCS+= uuid_equal.c uuid_is_nil.c
129
130 # _setjmp/_longjmp
131 .if ${MACHINE_ARCH} == "amd64"
132 .PATH: ${.CURDIR}/i386
133 .else
134 .PATH: ${.CURDIR}/${MACHINE_ARCH}
135 .endif
136 SRCS+=  _setjmp.S
137
138 # decompression functionality from libbz2
139 # NOTE: to actually test this functionality after libbz2 upgrade compile
140 # loader(8) with LOADER_BZIP2_SUPPORT defined
141 .PATH: ${.CURDIR}/../../contrib/bzip2
142 CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS
143 SRCS+=  libstand_bzlib_private.h
144
145 .for file in bzlib.c crctable.c decompress.c huffman.c randtable.c
146 SRCS+=  _${file}
147 CLEANFILES+=    _${file}
148
149 _${file}: ${file}
150         sed "s|bzlib_private\.h|libstand_bzlib_private.h|" ${.ALLSRC} > ${.TARGET}
151 .endfor
152
153 CLEANFILES+= libstand_bzlib_private.h
154 libstand_bzlib_private.h: bzlib_private.h
155         sed -e 's|<stdlib.h>|"stand.h"|' \
156                 ${.ALLSRC} > ${.TARGET}
157
158 # decompression functionality from libz
159 .PATH: ${.CURDIR}/../libz
160 CFLAGS+=-DHAVE_MEMCPY -I${.CURDIR}/../libz
161 SRCS+=  adler32.c crc32.c libstand_zutil.h
162
163 .for file in infback.c inffast.c inflate.c inftrees.c zutil.c
164 SRCS+=  _${file}
165 CLEANFILES+=    _${file}
166
167 _${file}: ${file}
168         sed "s|zutil\.h|libstand_zutil.h|" ${.ALLSRC} > ${.TARGET}
169 .endfor
170
171 # depend on stand.h being able to be included multiple times
172 CLEANFILES+= libstand_zutil.h
173 libstand_zutil.h: zutil.h
174         sed -e 's|<stddef.h>|"stand.h"|' \
175             -e 's|<string.h>|"stand.h"|' \
176             -e 's|<stdlib.h>|"stand.h"|' \
177             ${.ALLSRC} > ${.TARGET}
178
179 # io routines
180 SRCS+=  closeall.c dev.c ioctl.c nullfs.c stat.c \
181         fstat.c close.c lseek.c open.c read.c write.c readdir.c
182
183 # network routines
184 SRCS+=  arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
185
186 # network info services:
187 SRCS+=  bootp.c rarp.c bootparam.c
188
189 # boot filesystems
190 SRCS+=  ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c
191 SRCS+=  dosfs.c ext2fs.c
192 SRCS+=  splitfs.c
193
194 .include <bsd.lib.mk>
195
196 .if ${MACHINE_ARCH} == "amd64"
197 ${SRCS:M*.c:R:S/$/.o/g}:        machine
198
199 beforedepend:   machine
200
201 machine:
202         ln -s ${.CURDIR}/../../sys/i386/include machine
203 .endif