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 $
6 # - We don't use the libc strerror/sys_errlist because the string table is
19 LIBSTAND_SRC?= ${.CURDIR}
20 LIBSTAND_ARCH?= ${MACHINE_ARCH}
22 # Mostly OK, some of the libc imports are a bit noisy
23 CFLAGS+= -ffreestanding
25 .if (${CFLAGS:M-flto} && ${CCVER:Mgcc*})
26 CFLAGS+= -fno-builtin # LTO exposes too much stuff
29 .if ${LIBSTAND_ARCH} == "x86_64"
30 CFLAGS+= -mno-red-zone -fPIC
33 .if ${LIBSTAND_ARCH} == "i386"
35 CFLAGS+= -mpreferred-stack-boundary=2
41 .if ${LIBSTAND_ARCH} == "i386" || ${LIBSTAND_ARCH} == "x86_64"
42 CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float
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
50 # private (pruned) versions of libc string functions
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
61 # math stuff, thus no -flto!
63 ${CC} ${CFLAGS:N-flto} -c -o ${.TARGET} ${.IMPSRC}
65 .PATH: ${LIBSTAND_SRC}/../../sys/libkern
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}
76 # decompression functionality from libbz2
77 BZ2DIR= ${LIBSTAND_SRC}/../../contrib/bzip2
79 CFLAGS+=-I${BZ2DIR} -DBZ_NO_STDIO -DBZ_NO_COMPRESS
80 SRCS+= bzlib.c crctable.c decompress.c huffman.c randtable.c bzlib.h \
83 # check your belt - ugly bzip2 stuff ahead
87 ${file}: ${BZ2DIR}/${file} ${file}.diff
88 patch -o ${.TARGET} < ${.ALLSRC:M*.diff} ${.ALLSRC:M*.[ch]}
91 .include "../libz/Makefile.stand"
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
98 SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
100 # network info services:
101 SRCS+= bootp.c rarp.c bootparam.c
104 SRCS+= ufs.c nfs.c cd9660.c tftp.c zipfs.c bzipfs.c gzipfs.c
106 SRCS+= dosfs.c ext2fs.c
111 .include <bsd.lib.mk>