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