]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libstand/Makefile
MFH
[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 PACKAGE=lib${LIB}
10 MK_PROFILE=     no
11 MK_SSP=         no
12
13 .include <src.opts.mk>
14
15 LIBSTAND_SRC?=  ${.CURDIR}
16 LIBSTAND_CPUARCH?=${MACHINE_CPUARCH}
17 LIBC_SRC=       ${LIBSTAND_SRC}/../libc
18
19 LIB=            stand
20 NO_PIC=
21 INCS?=          stand.h
22 MAN?=           libstand.3
23
24 WARNS?=         0
25
26 CFLAGS+= -I${LIBSTAND_SRC}
27
28 # standalone components and stuff we have modified locally
29 SRCS+=  gzguts.h zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
30         globals.c pager.c printf.c strdup.c strerror.c strtol.c strtoul.c random.c \
31         sbrk.c twiddle.c zalloc.c zalloc_malloc.c
32
33 # private (pruned) versions of libc string functions
34 SRCS+=  strcasecmp.c
35
36 .PATH: ${LIBC_SRC}/net
37
38 SRCS+= ntoh.c
39
40 # string functions from libc
41 .PATH: ${LIBC_SRC}/string
42 SRCS+=  bcmp.c bcopy.c bzero.c ffs.c fls.c \
43         memccpy.c memchr.c memcmp.c memcpy.c memmove.c memset.c \
44         qdivrem.c strcat.c strchr.c strcmp.c strcpy.c \
45         strcspn.c strlcat.c strlcpy.c strlen.c strncat.c strncmp.c strncpy.c \
46         strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
47 .if ${MACHINE_CPUARCH} == "arm"
48 .PATH: ${LIBC_SRC}/arm/gen
49
50 # Do not generate movt/movw, because the relocation fixup for them does not
51 # translate to the -Bsymbolic -pie format required by self_reloc() in loader(8).
52 # Also, the fpu is not available in a standalone environment.
53 .if ${COMPILER_VERSION} < 30800
54 CFLAGS.clang+=  -mllvm -arm-use-movt=0
55 .else
56 CFLAGS.clang+=  -mno-movt
57 .endif
58 CFLAGS.clang+=  -mfpu=none
59
60 # Compiler support functions
61 .PATH: ${LIBSTAND_SRC}/../../contrib/compiler-rt/lib/builtins/
62 # __clzsi2 and ctzsi2 for various builtin functions
63 SRCS+=  clzsi2.c ctzsi2.c
64 # Divide and modulus functions called by the compiler
65 SRCS+=   divmoddi4.c  divmodsi4.c  divdi3.c  divsi3.c  moddi3.c  modsi3.c
66 SRCS+=  udivmoddi4.c udivmodsi4.c udivdi3.c udivsi3.c umoddi3.c umodsi3.c
67
68 .PATH: ${LIBSTAND_SRC}/../../contrib/compiler-rt/lib/builtins/arm/
69 SRCS+=  aeabi_idivmod.S aeabi_ldivmod.S aeabi_uidivmod.S aeabi_uldivmod.S
70 SRCS+=  aeabi_memcmp.S aeabi_memcpy.S aeabi_memmove.S aeabi_memset.S
71 .endif
72
73 .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "riscv"
74 .PATH: ${LIBC_SRC}/${MACHINE_CPUARCH}/gen
75 .endif
76
77 .if ${MACHINE_CPUARCH} == "powerpc"
78 .PATH: ${LIBC_SRC}/quad
79 SRCS+=  ashldi3.c ashrdi3.c
80 SRCS+=  syncicache.c
81 .endif
82
83 # uuid functions from libc
84 .PATH: ${LIBC_SRC}/uuid
85 SRCS+= uuid_create_nil.c uuid_equal.c uuid_from_string.c uuid_is_nil.c uuid_to_string.c
86
87 # _setjmp/_longjmp
88 .PATH: ${LIBSTAND_SRC}/${LIBSTAND_CPUARCH}
89 SRCS+=  _setjmp.S
90
91 # decompression functionality from libbz2
92 # NOTE: to actually test this functionality after libbz2 upgrade compile
93 # loader(8) with LOADER_BZIP2_SUPPORT defined
94 .PATH: ${LIBSTAND_SRC}/../../contrib/bzip2
95 CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS
96 SRCS+=  libstand_bzlib_private.h
97
98 .for file in bzlib.c crctable.c decompress.c huffman.c randtable.c
99 SRCS+=  _${file}
100 CLEANFILES+=    _${file}
101
102 _${file}: ${file}
103         sed "s|bzlib_private\.h|libstand_bzlib_private.h|" \
104             ${.ALLSRC} > ${.TARGET}
105 .endfor
106
107 CLEANFILES+= libstand_bzlib_private.h
108 libstand_bzlib_private.h: bzlib_private.h
109         sed -e 's|<stdlib.h>|"stand.h"|' \
110                 ${.ALLSRC} > ${.TARGET}
111
112 # decompression functionality from libz
113 .PATH: ${LIBSTAND_SRC}/../libz
114 CFLAGS+=-DHAVE_MEMCPY -I${LIBSTAND_SRC}/../libz
115 SRCS+=  adler32.c crc32.c libstand_zutil.h libstand_gzguts.h
116
117 .for file in infback.c inffast.c inflate.c inftrees.c zutil.c
118 SRCS+=  _${file}
119 CLEANFILES+=    _${file}
120
121 _${file}: ${file}
122         sed -e "s|zutil\.h|libstand_zutil.h|" \
123             -e "s|gzguts\.h|libstand_gzguts.h|" \
124             ${.ALLSRC} > ${.TARGET}
125 .endfor
126
127 # depend on stand.h being able to be included multiple times
128 .for file in zutil.h gzguts.h
129 CLEANFILES+= libstand_${file}
130 libstand_${file}: ${file}
131         sed -e 's|<fcntl.h>|"stand.h"|' \
132             -e 's|<stddef.h>|"stand.h"|' \
133             -e 's|<string.h>|"stand.h"|' \
134             -e 's|<stdio.h>|"stand.h"|' \
135             -e 's|<stdlib.h>|"stand.h"|' \
136             ${.ALLSRC} > ${.TARGET}
137 .endfor
138
139 # io routines
140 SRCS+=  closeall.c dev.c ioctl.c nullfs.c stat.c \
141         fstat.c close.c lseek.c open.c read.c write.c readdir.c
142
143 # network routines
144 SRCS+=  arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
145
146 # network info services:
147 SRCS+=  bootp.c rarp.c bootparam.c
148
149 # boot filesystems
150 SRCS+=  ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c
151 SRCS+=  dosfs.c ext2fs.c
152 SRCS+=  splitfs.c
153 SRCS+=  pkgfs.c
154 .if ${MK_NAND} != "no"
155 SRCS+=  nandfs.c
156 .endif
157
158 .include <bsd.stand.mk>
159 .include <bsd.lib.mk>