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