]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libstand/Makefile
Update LLDB snapshot to upstream r241361
[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 LIBSTAND_SRC=   ${.CURDIR}
15 LIBC_SRC=       ${LIBSTAND_SRC}/../libc
16
17 LIB=            stand
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} == "aarch64"
46 CFLAGS+=        -D_STANDALONE -mgeneral-regs-only
47 .endif
48 .if ${MACHINE_CPUARCH} == "mips"
49 CFLAGS+=        -G0 -fno-pic -mno-abicalls
50 .endif
51
52 # standalone components and stuff we have modified locally
53 SRCS+=  gzguts.h zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
54         globals.c pager.c printf.c strdup.c strerror.c strtol.c strtoul.c random.c \
55         sbrk.c twiddle.c zalloc.c zalloc_malloc.c
56
57 # private (pruned) versions of libc string functions
58 SRCS+=  strcasecmp.c
59
60 .PATH: ${LIBC_SRC}/net
61
62 SRCS+= ntoh.c
63
64 # string functions from libc
65 .PATH: ${LIBC_SRC}/string
66 SRCS+=  bcmp.c bcopy.c bzero.c ffs.c memccpy.c memchr.c memcmp.c memcpy.c \
67         memmove.c memset.c qdivrem.c strcat.c strchr.c strcmp.c strcpy.c \
68         strcspn.c strlen.c strncat.c strncmp.c strncpy.c strpbrk.c \
69         strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
70 .if ${MACHINE_CPUARCH} == "arm"
71 .PATH: ${LIBC_SRC}/arm/gen
72
73 # Compiler support functions
74 .PATH: ${LIBSTAND_SRC}/../../contrib/compiler-rt/lib/builtins/
75 # __clzsi2 and ctzsi2 for various builtin functions
76 SRCS+=  clzsi2.c ctzsi2.c
77 # Divide and modulus functions called by the compiler
78 SRCS+=   divmoddi4.c  divmodsi4.c  divdi3.c  divsi3.c  moddi3.c  modsi3.c
79 SRCS+=  udivmoddi4.c udivmodsi4.c udivdi3.c udivsi3.c umoddi3.c umodsi3.c
80
81 .PATH: ${LIBSTAND_SRC}/../../contrib/compiler-rt/lib/builtins/arm/
82 SRCS+=  aeabi_idivmod.S aeabi_ldivmod.S aeabi_uidivmod.S aeabi_uldivmod.S
83 SRCS+=  aeabi_memcmp.S aeabi_memcpy.S aeabi_memmove.S aeabi_memset.S
84 .endif
85
86 .if ${MACHINE_CPUARCH} == "aarch64"
87 .PATH: ${LIBC_SRC}/aarch64/gen
88 .endif
89
90 .if ${MACHINE_CPUARCH} == "powerpc"
91 .PATH: ${LIBC_SRC}/quad
92 SRCS+=  ashldi3.c ashrdi3.c
93 SRCS+=  syncicache.c
94 .endif
95
96 # uuid functions from libc
97 .PATH: ${LIBC_SRC}/uuid
98 SRCS+= uuid_equal.c uuid_is_nil.c
99
100 # _setjmp/_longjmp
101 .PATH: ${LIBSTAND_SRC}/${MACHINE_CPUARCH}
102 SRCS+=  _setjmp.S
103
104 # decompression functionality from libbz2
105 # NOTE: to actually test this functionality after libbz2 upgrade compile
106 # loader(8) with LOADER_BZIP2_SUPPORT defined
107 .PATH: ${LIBSTAND_SRC}/../../contrib/bzip2
108 CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS
109 SRCS+=  libstand_bzlib_private.h
110
111 .for file in bzlib.c crctable.c decompress.c huffman.c randtable.c
112 SRCS+=  _${file}
113 CLEANFILES+=    _${file}
114
115 _${file}: ${file}
116         sed "s|bzlib_private\.h|libstand_bzlib_private.h|" \
117             ${.ALLSRC} > ${.TARGET}
118 .endfor
119
120 CLEANFILES+= libstand_bzlib_private.h
121 libstand_bzlib_private.h: bzlib_private.h
122         sed -e 's|<stdlib.h>|"stand.h"|' \
123                 ${.ALLSRC} > ${.TARGET}
124
125 # decompression functionality from libz
126 .PATH: ${LIBSTAND_SRC}/../libz
127 CFLAGS+=-DHAVE_MEMCPY -I${LIBSTAND_SRC}/../libz
128 SRCS+=  adler32.c crc32.c libstand_zutil.h libstand_gzguts.h
129
130 .for file in infback.c inffast.c inflate.c inftrees.c zutil.c
131 SRCS+=  _${file}
132 CLEANFILES+=    _${file}
133
134 _${file}: ${file}
135         sed -e "s|zutil\.h|libstand_zutil.h|" \
136             -e "s|gzguts\.h|libstand_gzguts.h|" \
137             ${.ALLSRC} > ${.TARGET}
138 .endfor
139
140 # depend on stand.h being able to be included multiple times
141 .for file in zutil.h gzguts.h
142 CLEANFILES+= libstand_${file}
143 libstand_${file}: ${file}
144         sed -e 's|<fcntl.h>|"stand.h"|' \
145             -e 's|<stddef.h>|"stand.h"|' \
146             -e 's|<string.h>|"stand.h"|' \
147             -e 's|<stdio.h>|"stand.h"|' \
148             -e 's|<stdlib.h>|"stand.h"|' \
149             ${.ALLSRC} > ${.TARGET}
150 .endfor
151
152 # io routines
153 SRCS+=  closeall.c dev.c ioctl.c nullfs.c stat.c \
154         fstat.c close.c lseek.c open.c read.c write.c readdir.c
155
156 # network routines
157 SRCS+=  arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
158
159 # network info services:
160 SRCS+=  bootp.c rarp.c bootparam.c
161
162 # boot filesystems
163 SRCS+=  ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c
164 SRCS+=  dosfs.c ext2fs.c
165 SRCS+=  splitfs.c
166 SRCS+=  pkgfs.c
167 .if ${MK_NAND} != "no"
168 SRCS+=  nandfs.c
169 .endif
170
171 .include <bsd.lib.mk>