1 # $FreeBSD: src/lib/libstand/Makefile,v 1.14.2.10 2002/07/22 14:21:50 ru Exp $
2 # $DragonFly: src/lib/libstand/Makefile,v 1.12 2008/10/28 16:54:09 swildner Exp $
4 # Originally from $NetBSD: Makefile,v 1.21 1997/10/26 22:08:38 lukem Exp $
7 # - We don't use the libc strerror/sys_errlist because the string table is
17 # Mostly OK, some of the libc imports are a bit noisy
18 CFLAGS+= -ffreestanding -std=c99
20 .if ${MACHINE_ARCH} == "amd64"
21 CFLAGS+= -m32 -mpreferred-stack-boundary=2
23 .if ${MACHINE_ARCH} == "i386"
24 CFLAGS+= -mpreferred-stack-boundary=2
28 # standalone components and stuff we have modified locally
29 SRCS+= __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
30 globals.c pager.c printf.c strdup.c strerror.c strtol.c random.c \
31 sbrk.c twiddle.c zalloc.c zalloc_malloc.c
33 # private (pruned) versions of libc string functions
36 # string functions from libc
37 .PATH: ${.CURDIR}/../libc/string
38 .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
39 SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
40 memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
41 strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
42 strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
44 .PATH: ${.CURDIR}/../libc/quad
45 .if ${MACHINE_ARCH} == "i386"
50 .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
51 .PATH: ${.CURDIR}/i386
54 # really only required for i386
55 CFLAGS+=-I${.CURDIR}/../libc/${MACHINE_ARCH}
58 # decompression functionality from libbz2
59 BZ2DIR= ${.CURDIR}/../../contrib/bzip2-1.0
61 CFLAGS+=-I${BZ2DIR} -DBZ_NO_STDIO -DBZ_NO_COMPRESS
62 SRCS+= bzlib.c crctable.c decompress.c huffman.c randtable.c bzlib.h \
65 # check your belt - ugly bzip2 stuff ahead
69 ${file}: ${BZ2DIR}/${file} ${file}.diff
70 patch -o ${.TARGET} < ${.ALLSRC:M*.diff} ${.ALLSRC:M*.[ch]}
73 .include "../libz/Makefile.stand"
76 SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
77 fstat.c close.c lseek.c open.c read.c write.c readdir.c
80 SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
82 # network info services:
83 SRCS+= bootp.c rarp.c bootparam.c
86 SRCS+= ufs.c nfs.c cd9660.c tftp.c zipfs.c bzipfs.c gzipfs.c
88 SRCS+= dosfs.c ext2fs.c
94 .if ${MACHINE_ARCH} == "amd64"
97 beforedepend ${OBJS}: machine cpu
101 ${LN} -fs ${.CURDIR}/../../sys/cpu/i386/include/* machine
102 ${LN} -fs ${.CURDIR}/../../sys/platform/pc32/include/* machine
105 ${LN} -fs ${.CURDIR}/../../sys/cpu/i386/include cpu
107 CLEANDIRS+= machine cpu