libstand: Apply our bzlib.c patch to master.
[dragonfly.git] / lib / libstand / Makefile
blob90ae9ee82d0cdd36ce9483d23329820fb1e21718
1 # $FreeBSD: src/lib/libstand/Makefile,v 1.14.2.10 2002/07/22 14:21:50 ru Exp $
3 # Originally from $NetBSD: Makefile,v 1.21 1997/10/26 22:08:38 lukem Exp $
5 # Notes:
6 # - We don't use the libc strerror/sys_errlist because the string table is
7 # quite large.
10 LIB?= stand
11 NOPROFILE= YES
12 NOPIC= YES
13 INCS?= stand.h
14 MAN?= libstand.3
15 CSTD?= c99
16 WARNS?= 2
17 NO_STRICT_ALIASING=
19 LIBSTAND_SRC?= ${.CURDIR}
20 LIBSTAND_ARCH?= ${MACHINE_ARCH}
21 LIBC_SRC= ${LIBSTAND_SRC}/../libc
23 CFLAGS+= -D_STANDALONE
25 # Mostly OK, some of the libc imports are a bit noisy
26 CFLAGS+= -ffreestanding
28 # Disable stack protector
29 CFLAGS+= -fno-stack-protector
31 .if (${CFLAGS:M-flto} && ${CCVER:Mgcc*})
32 CFLAGS+= -fno-builtin # LTO exposes too much stuff
33 .endif
35 .if ${LIBSTAND_ARCH} == "x86_64"
36 CFLAGS+= -mno-red-zone -fPIC
37 .endif
39 .if ${LIBSTAND_ARCH} == "i386"
40 .if ${CCVER:Mgcc*}
41 CFLAGS+= -mpreferred-stack-boundary=2
42 .endif
43 FORCE_CPUTYPE= i386
44 CFLAGS+= -m32
45 .endif
47 .if ${LIBSTAND_ARCH} == "i386" || ${LIBSTAND_ARCH} == "x86_64"
48 CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float
49 .endif
51 # standalone components and stuff we have modified locally
52 SRCS+= __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
53 globals.c pager.c printf.c random.c \
54 strdup.c strerror.c strtol.c strtoul.c sbrk.c \
55 twiddle.c zalloc.c zalloc_malloc.c
57 # private (pruned) versions of libc string functions
58 SRCS+= strcasecmp.c
60 # string functions from libc
61 .PATH: ${LIBSTAND_SRC}/../libc/string
62 .if ${LIBSTAND_ARCH} == "x86_64" || ${LIBSTAND_ARCH} == "i386"
63 SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
64 memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
65 strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
66 strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
68 # math stuff, thus no -flto!
69 qdivrem.o: qdivrem.c
70 ${CC} ${CFLAGS:N-flto} -c -o ${.TARGET} ${.IMPSRC}
71 .endif
73 # _setjmp/_longjmp
74 .PATH: ${LIBSTAND_SRC}/${LIBSTAND_ARCH}
75 .if ${LIBSTAND_ARCH} == "x86_64" || ${LIBSTAND_ARCH} == "i386"
76 # really only required for i386
77 CFLAGS+=-I${LIBSTAND_SRC}/../libc/${MACHINE_ARCH}
78 .endif
79 SRCS+= _setjmp.S
81 # decompression functionality from libz
82 # NOTE: crc32.c is used from libz and not libkern
83 .include "../libz/Makefile.stand"
85 # iscsi_crc32() for hammer2
86 .PATH: ${LIBSTAND_SRC}/../../sys/libkern
87 SRCS+= icrc32.c
89 # decompression functionality from libbz2
90 BZ2DIR= ${LIBSTAND_SRC}/../../contrib/bzip2
91 .PATH: ${BZ2DIR}
92 CFLAGS+=-I${BZ2DIR} -DBZ_NO_STDIO -DBZ_NO_COMPRESS
93 SRCS+= bzlib.c crctable.c decompress.c huffman.c randtable.c
95 # io routines
96 SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
97 fstat.c close.c lseek.c open.c read.c write.c readdir.c
99 # uuid routines
100 SRCS+= uuid_from_string.c uuid_to_string.c
102 # uuid routines from libc
103 .PATH: ${LIBC_SRC}/uuid
104 SRCS+= uuid_create_nil.c
106 # network routines
107 SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
109 # network info services:
110 SRCS+= bootp.c rarp.c bootparam.c
112 # boot filesystems
113 SRCS+= ufs.c nfs.c cd9660.c tftp.c bzipfs.c gzipfs.c
114 SRCS+= netif.c nfs.c
115 SRCS+= dosfs.c ext2fs.c
116 SRCS+= splitfs.c
117 SRCS+= hammer1.c
118 SRCS+= hammer2.c
120 .include <bsd.lib.mk>