Deleted Added
sdiff udiff text old ( 178664 ) new ( 180012 )
full compact
1# $FreeBSD: head/lib/libstand/Makefile 178664 2008-04-29 17:42:42Z ru $
2# Originally from $NetBSD: Makefile,v 1.21 1997/10/26 22:08:38 lukem Exp $
3#
4# Notes:
5# - We don't use the libc strerror/sys_errlist because the string table is
6# quite large.
7#
8
9LIB= stand
10NO_PROFILE=
11NO_PIC=
12INCS= stand.h
13MAN= libstand.3
14
15CFLAGS+= -ffreestanding -Wformat
16CFLAGS+= -I${.CURDIR}
17
18.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
19CFLAGS+= -mpreferred-stack-boundary=2
20CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2
21.endif
22.if ${MACHINE_ARCH} == "i386"
23CFLAGS+= -mno-sse3
24.endif
25.if ${MACHINE} == "pc98"
26CFLAGS+= -Os
27.endif
28.if ${MACHINE_ARCH} == "powerpc"
29CFLAGS+= -msoft-float -D_STANDALONE
30.endif
31.if ${MACHINE_ARCH} == "amd64"
32CFLAGS+= -m32 -I.
33.endif
34
35# standalone components and stuff we have modified locally
36SRCS+= zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
37 globals.c pager.c printf.c strdup.c strerror.c strtol.c random.c \
38 sbrk.c twiddle.c zalloc.c zalloc_malloc.c
39
40# private (pruned) versions of libc string functions
41SRCS+= strcasecmp.c
42
43.PATH: ${.CURDIR}/../libc/net
44
45SRCS+= ntoh.c
46
47# string functions from libc
48.PATH: ${.CURDIR}/../libc/string
49.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
50 ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "amd64"
51SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
52 memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
53 strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
54 strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
55.endif
56.if ${MACHINE_ARCH} == "ia64"
57.PATH: ${.CURDIR}/../libc/ia64/string
58SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
59 memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
60 strcmp.c strcpy.c strcspn.c strlen.c \
61 strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
62 strspn.c strstr.c strtok.c swab.c
63
64.PATH: ${.CURDIR}/../libc/ia64/gen
65SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S
66SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S
67.endif
68.if ${MACHINE_ARCH} == "powerpc"
69.PATH: ${.CURDIR}/../libc/quad
70SRCS+= ashldi3.c ashrdi3.c
71.PATH: ${.CURDIR}/../libc/powerpc/gen
72SRCS+= syncicache.c
73.endif
74
75# uuid functions from libc
76.PATH: ${.CURDIR}/../libc/uuid
77SRCS+= uuid_equal.c uuid_is_nil.c
78
79# _setjmp/_longjmp
80.if ${MACHINE_ARCH} == "amd64"
81.PATH: ${.CURDIR}/i386
82.else
83.PATH: ${.CURDIR}/${MACHINE_ARCH}
84.endif
85SRCS+= _setjmp.S
86
87# decompression functionality from libbz2
88# NOTE: to actually test this functionality after libbz2 upgrade compile
89# loader(8) with LOADER_BZIP2_SUPPORT defined
90.PATH: ${.CURDIR}/../../contrib/bzip2
91CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS
92SRCS+= libstand_bzlib_private.h
93
94.for file in bzlib.c crctable.c decompress.c huffman.c randtable.c
95SRCS+= _${file}
96CLEANFILES+= _${file}
97
98_${file}: ${file}
99 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" ${.ALLSRC} > ${.TARGET}
100.endfor
101
102CLEANFILES+= libstand_bzlib_private.h
103libstand_bzlib_private.h: bzlib_private.h
104 sed -e 's|<stdlib.h>|"stand.h"|' \
105 ${.ALLSRC} > ${.TARGET}
106
107# decompression functionality from libz
108.PATH: ${.CURDIR}/../libz
109CFLAGS+=-DHAVE_MEMCPY -I${.CURDIR}/../libz
110SRCS+= adler32.c crc32.c libstand_zutil.h
111
112.for file in infback.c inffast.c inflate.c inftrees.c zutil.c
113SRCS+= _${file}
114CLEANFILES+= _${file}
115
116_${file}: ${file}
117 sed "s|zutil\.h|libstand_zutil.h|" ${.ALLSRC} > ${.TARGET}
118.endfor
119
120# depend on stand.h being able to be included multiple times
121CLEANFILES+= libstand_zutil.h
122libstand_zutil.h: zutil.h
123 sed -e 's|<stddef.h>|"stand.h"|' \
124 -e 's|<string.h>|"stand.h"|' \
125 -e 's|<stdlib.h>|"stand.h"|' \
126 ${.ALLSRC} > ${.TARGET}
127
128# io routines
129SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
130 fstat.c close.c lseek.c open.c read.c write.c readdir.c
131
132# network routines
133SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
134
135# network info services:
136SRCS+= bootp.c rarp.c bootparam.c
137
138# boot filesystems
139SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c
140SRCS+= dosfs.c ext2fs.c
141SRCS+= splitfs.c
142
143.include <bsd.lib.mk>
144
145.if ${MACHINE_ARCH} == "amd64"
146beforedepend ${OBJS}: machine
147cleandepend: cleanmachine
148cleanmachine:
149 rm -f machine
150
151machine:
152 ln -s ${.CURDIR}/../../sys/i386/include machine
153.endif