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