Merge branch 'vendor/LIBRESSL'
[dragonfly.git] / lib / libstand / Makefile
1 # $FreeBSD: src/lib/libstand/Makefile,v 1.14.2.10 2002/07/22 14:21:50 ru Exp $
2 #
3 # Originally from       $NetBSD: Makefile,v 1.21 1997/10/26 22:08:38 lukem Exp $
4 #
5 # Notes:
6 # - We don't use the libc strerror/sys_errlist because the string table is
7 #   quite large.
8 #
9
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=
18
19 LIBSTAND_SRC?=  ${.CURDIR}
20 LIBSTAND_ARCH?= ${MACHINE_ARCH}
21 LIBC_SRC=       ${LIBSTAND_SRC}/../libc
22
23 # Mostly OK, some of the libc imports are a bit noisy
24 CFLAGS+=        -ffreestanding
25
26 .if (${CFLAGS:M-flto} && ${CCVER:Mgcc*})
27 CFLAGS+=        -fno-builtin    # LTO exposes too much stuff
28 .endif
29
30 .if ${LIBSTAND_ARCH} == "x86_64"
31 CFLAGS+=        -mno-red-zone -fPIC
32 .endif
33
34 .if ${LIBSTAND_ARCH} == "i386"
35 .if ${CCVER:Mgcc*}
36 CFLAGS+=        -mpreferred-stack-boundary=2
37 .endif
38 FORCE_CPUTYPE=  i386
39 CFLAGS+=        -m32
40 .endif
41
42 .if ${LIBSTAND_ARCH} == "i386" || ${LIBSTAND_ARCH} == "x86_64"
43 CFLAGS+=        -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float
44 .endif
45
46 # standalone components and stuff we have modified locally
47 SRCS+=  __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
48         globals.c pager.c printf.c random.c \
49         strdup.c strerror.c strtol.c strtoul.c sbrk.c \
50         twiddle.c zalloc.c zalloc_malloc.c
51
52 # private (pruned) versions of libc string functions
53 SRCS+=  strcasecmp.c
54
55 # string functions from libc
56 .PATH:  ${LIBSTAND_SRC}/../libc/string
57 .if ${LIBSTAND_ARCH} == "x86_64" || ${LIBSTAND_ARCH} == "i386"
58 SRCS+=  bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
59         memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
60         strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
61         strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
62
63 # math stuff, thus no -flto!
64 qdivrem.o:      qdivrem.c
65         ${CC} ${CFLAGS:N-flto} -c -o ${.TARGET} ${.IMPSRC}
66 .endif
67 .PATH:  ${LIBSTAND_SRC}/../../sys/libkern
68 SRCS+=  icrc32.c
69
70 # _setjmp/_longjmp
71 .PATH:  ${LIBSTAND_SRC}/${LIBSTAND_ARCH}
72 .if ${LIBSTAND_ARCH} == "x86_64" || ${LIBSTAND_ARCH} == "i386"
73 # really only required for i386
74 CFLAGS+=-I${LIBSTAND_SRC}/../libc/${MACHINE_ARCH}
75 .endif
76 SRCS+=  _setjmp.S
77
78 # decompression functionality from libbz2
79 BZ2DIR= ${LIBSTAND_SRC}/../../contrib/bzip2
80 .PATH:  ${BZ2DIR}
81 CFLAGS+=-I${BZ2DIR} -DBZ_NO_STDIO -DBZ_NO_COMPRESS
82 SRCS+=  bzlib.c crctable.c decompress.c huffman.c randtable.c bzlib.h \
83         bzlib_private.h
84
85 # check your belt - ugly bzip2 stuff ahead
86 .for file in bzlib.c
87 CLEANFILES+=   ${file}
88
89 ${file}: ${BZ2DIR}/${file} ${file}.diff
90         patch -o ${.TARGET} < ${.ALLSRC:M*.diff} ${.ALLSRC:M*.[ch]}
91 .endfor
92
93 .include "../libz/Makefile.stand"
94
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
98
99 # uuid routines
100 SRCS+=  uuid_from_string.c uuid_to_string.c
101
102 # uuid routines from libc
103 .PATH: ${LIBC_SRC}/uuid
104 SRCS+=  uuid_create_nil.c
105
106 # network routines
107 SRCS+=  arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
108
109 # network info services:
110 SRCS+=  bootp.c rarp.c bootparam.c
111
112 # boot filesystems
113 SRCS+=  ufs.c nfs.c cd9660.c tftp.c zipfs.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
119
120 .include <bsd.lib.mk>