9ff11a54dd66699a41c587e15d05f3d7a05ffd61
[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
22 # Mostly OK, some of the libc imports are a bit noisy
23 CFLAGS+=        -ffreestanding
24
25 .if (${CFLAGS:M-flto} && ${CCVER:Mgcc*})
26 CFLAGS+=        -fno-builtin    # LTO exposes too much stuff
27 .endif
28
29 .if ${LIBSTAND_ARCH} == "x86_64"
30 CFLAGS+=        -mno-red-zone -fPIC
31 .endif
32
33 .if ${LIBSTAND_ARCH} == "i386"
34 .if ${CCVER:Mgcc*}
35 CFLAGS+=        -mpreferred-stack-boundary=2
36 .endif
37 FORCE_CPUTYPE=  i386
38 CFLAGS+=        -m32
39 .endif
40
41 .if ${LIBSTAND_ARCH} == "i386" || ${LIBSTAND_ARCH} == "x86_64"
42 CFLAGS+=        -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float
43 .endif
44
45 # standalone components and stuff we have modified locally
46 SRCS+=  __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
47         globals.c pager.c printf.c strdup.c strerror.c strtol.c random.c \
48         sbrk.c twiddle.c zalloc.c zalloc_malloc.c
49
50 # private (pruned) versions of libc string functions
51 SRCS+=  strcasecmp.c
52
53 # string functions from libc
54 .PATH:  ${LIBSTAND_SRC}/../libc/string
55 .if ${LIBSTAND_ARCH} == "x86_64" || ${LIBSTAND_ARCH} == "i386"
56 SRCS+=  bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
57         memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
58         strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
59         strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
60
61 # math stuff, thus no -flto!
62 qdivrem.o:      qdivrem.c
63         ${CC} ${CFLAGS:N-flto} -c -o ${.TARGET} ${.IMPSRC}
64 .endif
65 .PATH:  ${LIBSTAND_SRC}/../../sys/libkern
66 SRCS+=  icrc32.c
67
68 # _setjmp/_longjmp
69 .PATH:  ${LIBSTAND_SRC}/${LIBSTAND_ARCH}
70 .if ${LIBSTAND_ARCH} == "x86_64" || ${LIBSTAND_ARCH} == "i386"
71 # really only required for i386
72 CFLAGS+=-I${LIBSTAND_SRC}/../libc/${MACHINE_ARCH}
73 .endif
74 SRCS+=  _setjmp.S
75
76 # decompression functionality from libbz2
77 BZ2DIR= ${LIBSTAND_SRC}/../../contrib/bzip2
78 .PATH:  ${BZ2DIR}
79 CFLAGS+=-I${BZ2DIR} -DBZ_NO_STDIO -DBZ_NO_COMPRESS
80 SRCS+=  bzlib.c crctable.c decompress.c huffman.c randtable.c bzlib.h \
81         bzlib_private.h
82
83 # check your belt - ugly bzip2 stuff ahead
84 .for file in bzlib.c
85 CLEANFILES+=   ${file}
86
87 ${file}: ${BZ2DIR}/${file} ${file}.diff
88         patch -o ${.TARGET} < ${.ALLSRC:M*.diff} ${.ALLSRC:M*.[ch]}
89 .endfor
90
91 .include "../libz/Makefile.stand"
92
93 # io routines
94 SRCS+=  closeall.c dev.c ioctl.c nullfs.c stat.c \
95         fstat.c close.c lseek.c open.c read.c write.c readdir.c
96
97 # network routines
98 SRCS+=  arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
99
100 # network info services:
101 SRCS+=  bootp.c rarp.c bootparam.c
102
103 # boot filesystems
104 SRCS+=  ufs.c nfs.c cd9660.c tftp.c zipfs.c bzipfs.c gzipfs.c
105 SRCS+=  netif.c nfs.c
106 SRCS+=  dosfs.c ext2fs.c
107 SRCS+=  splitfs.c
108 SRCS+=  hammer1.c
109 SRCS+=  hammer2.c
110
111 .include <bsd.lib.mk>