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