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
27 .if ${MACHINE_CPUARCH} == "i386"
30 .if ${MACHINE} == "pc98"
33 .if ${MACHINE_CPUARCH} == "powerpc"
34 CFLAGS+= -msoft-float -D_STANDALONE -DNETIF_DEBUG
36 .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc64"
39 .if ${MACHINE_CPUARCH} == "arm"
40 CFLAGS+= -msoft-float -D_STANDALONE
43 # standalone components and stuff we have modified locally
44 SRCS+= zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
45 globals.c pager.c printf.c strdup.c strerror.c strtol.c random.c \
46 sbrk.c twiddle.c zalloc.c zalloc_malloc.c
48 # private (pruned) versions of libc string functions
51 .PATH: ${.CURDIR}/../libc/net
55 # string functions from libc
56 .PATH: ${.CURDIR}/../libc/string
57 .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "powerpc" || \
58 ${MACHINE_CPUARCH} == "sparc64" || ${MACHINE_CPUARCH} == "amd64" || \
59 ${MACHINE_CPUARCH} == "arm"
60 SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
61 memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
62 strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
63 strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
65 .if ${MACHINE_CPUARCH} == "arm"
66 .PATH: ${.CURDIR}/../libc/arm/gen
69 .if ${MACHINE_CPUARCH} == "ia64"
70 .PATH: ${.CURDIR}/../libc/ia64/string
71 SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
72 memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
73 strcmp.c strcpy.c strcspn.c strlen.c \
74 strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
75 strspn.c strstr.c strtok.c swab.c
77 .PATH: ${.CURDIR}/../libc/ia64/gen
78 SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S
79 SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S
81 .if ${MACHINE_CPUARCH} == "powerpc"
82 .PATH: ${.CURDIR}/../libc/quad
83 SRCS+= ashldi3.c ashrdi3.c
84 .PATH: ${.CURDIR}/../libc/powerpc/gen
88 # uuid functions from libc
89 .PATH: ${.CURDIR}/../libc/uuid
90 SRCS+= uuid_equal.c uuid_is_nil.c
93 .if ${MACHINE_CPUARCH} == "amd64"
94 .PATH: ${.CURDIR}/i386
95 .elif ${MACHINE_ARCH} == "powerpc64"
96 .PATH: ${.CURDIR}/powerpc
98 .PATH: ${.CURDIR}/${MACHINE_CPUARCH}
102 # decompression functionality from libbz2
103 # NOTE: to actually test this functionality after libbz2 upgrade compile
104 # loader(8) with LOADER_BZIP2_SUPPORT defined
105 .PATH: ${.CURDIR}/../../contrib/bzip2
106 CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS
107 SRCS+= libstand_bzlib_private.h
109 .for file in bzlib.c crctable.c decompress.c huffman.c randtable.c
111 CLEANFILES+= _${file}
114 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" ${.ALLSRC} > ${.TARGET}
117 CLEANFILES+= libstand_bzlib_private.h
118 libstand_bzlib_private.h: bzlib_private.h
119 sed -e 's|<stdlib.h>|"stand.h"|' \
120 ${.ALLSRC} > ${.TARGET}
122 # decompression functionality from libz
123 .PATH: ${.CURDIR}/../libz
124 CFLAGS+=-DHAVE_MEMCPY -I${.CURDIR}/../libz
125 SRCS+= adler32.c crc32.c libstand_zutil.h
127 .for file in infback.c inffast.c inflate.c inftrees.c zutil.c
129 CLEANFILES+= _${file}
132 sed "s|zutil\.h|libstand_zutil.h|" ${.ALLSRC} > ${.TARGET}
135 # depend on stand.h being able to be included multiple times
136 CLEANFILES+= libstand_zutil.h
137 libstand_zutil.h: zutil.h
138 sed -e 's|<stddef.h>|"stand.h"|' \
139 -e 's|<string.h>|"stand.h"|' \
140 -e 's|<stdlib.h>|"stand.h"|' \
141 ${.ALLSRC} > ${.TARGET}
144 SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
145 fstat.c close.c lseek.c open.c read.c write.c readdir.c
148 SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
150 # network info services:
151 SRCS+= bootp.c rarp.c bootparam.c
154 SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c
155 SRCS+= dosfs.c ext2fs.c
158 .include <bsd.lib.mk>
160 .if ${MACHINE_CPUARCH} == "amd64"
161 beforedepend ${OBJS}: machine
162 cleandepend: cleanmachine
167 ln -s ${.CURDIR}/../../sys/i386/include machine