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