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