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