2 # Originally from $NetBSD: Makefile,v 1.21 1997/10/26 22:08:38 lukem Exp $
5 # - We don't use the libc strerror/sys_errlist because the string table is
20 CFLAGS+= -ffreestanding -Wformat
23 .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
24 CFLAGS+= -mpreferred-stack-boundary=2
25 CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float
27 .if ${MACHINE} == "pc98"
30 .if ${MACHINE_CPUARCH} == "powerpc"
31 CFLAGS+= -msoft-float -D_STANDALONE -DNETIF_DEBUG
33 .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc64"
36 .if ${MACHINE_CPUARCH} == "arm"
37 CFLAGS+= -msoft-float -D_STANDALONE
40 # standalone components and stuff we have modified locally
41 SRCS+= zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
42 globals.c pager.c printf.c strdup.c strerror.c strtol.c random.c \
43 sbrk.c twiddle.c zalloc.c zalloc_malloc.c
45 # private (pruned) versions of libc string functions
48 .PATH: ${.CURDIR}/../libc/net
52 # string functions from libc
53 .PATH: ${.CURDIR}/../libc/string
54 .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "powerpc" || \
55 ${MACHINE_CPUARCH} == "sparc64" || ${MACHINE_CPUARCH} == "amd64" || \
56 ${MACHINE_CPUARCH} == "arm"
57 SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
58 memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
59 strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
60 strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
62 .if ${MACHINE_CPUARCH} == "arm"
63 .PATH: ${.CURDIR}/../libc/arm/gen
66 .if ${MACHINE_CPUARCH} == "ia64"
67 .PATH: ${.CURDIR}/../libc/ia64/string
68 SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
69 memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
70 strcmp.c strcpy.c strcspn.c strlen.c \
71 strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
72 strspn.c strstr.c strtok.c swab.c
74 .PATH: ${.CURDIR}/../libc/ia64/gen
75 SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S
76 SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S
78 .if ${MACHINE_CPUARCH} == "powerpc"
79 .PATH: ${.CURDIR}/../libc/quad
80 SRCS+= ashldi3.c ashrdi3.c
81 .PATH: ${.CURDIR}/../libc/powerpc/gen
85 # uuid functions from libc
86 .PATH: ${.CURDIR}/../libc/uuid
87 SRCS+= uuid_equal.c uuid_is_nil.c
90 .if ${MACHINE_CPUARCH} == "amd64"
91 .PATH: ${.CURDIR}/i386
92 .elif ${MACHINE_ARCH} == "powerpc64"
93 .PATH: ${.CURDIR}/powerpc
95 .PATH: ${.CURDIR}/${MACHINE_CPUARCH}
99 # decompression functionality from libbz2
100 # NOTE: to actually test this functionality after libbz2 upgrade compile
101 # loader(8) with LOADER_BZIP2_SUPPORT defined
102 .PATH: ${.CURDIR}/../../contrib/bzip2
103 CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS
104 SRCS+= libstand_bzlib_private.h
106 .for file in bzlib.c crctable.c decompress.c huffman.c randtable.c
108 CLEANFILES+= _${file}
111 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" ${.ALLSRC} > ${.TARGET}
114 CLEANFILES+= libstand_bzlib_private.h
115 libstand_bzlib_private.h: bzlib_private.h
116 sed -e 's|<stdlib.h>|"stand.h"|' \
117 ${.ALLSRC} > ${.TARGET}
119 # decompression functionality from libz
120 .PATH: ${.CURDIR}/../libz
121 CFLAGS+=-DHAVE_MEMCPY -I${.CURDIR}/../libz
122 SRCS+= adler32.c crc32.c libstand_zutil.h
124 .for file in infback.c inffast.c inflate.c inftrees.c zutil.c
126 CLEANFILES+= _${file}
129 sed "s|zutil\.h|libstand_zutil.h|" ${.ALLSRC} > ${.TARGET}
132 # depend on stand.h being able to be included multiple times
133 CLEANFILES+= libstand_zutil.h
134 libstand_zutil.h: zutil.h
135 sed -e 's|<stddef.h>|"stand.h"|' \
136 -e 's|<string.h>|"stand.h"|' \
137 -e 's|<stdlib.h>|"stand.h"|' \
138 ${.ALLSRC} > ${.TARGET}
141 SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
142 fstat.c close.c lseek.c open.c read.c write.c readdir.c
145 SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
147 # network info services:
148 SRCS+= bootp.c rarp.c bootparam.c
151 SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c
152 SRCS+= dosfs.c ext2fs.c
155 .include <bsd.lib.mk>
157 .if ${MACHINE_CPUARCH} == "amd64"
158 beforedepend ${OBJS}: machine
159 cleandepend: cleanmachine
164 ln -s ${.CURDIR}/../../sys/i386/include machine