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