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