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