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