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