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+= gzguts.h 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 strtoul.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 memccpy.c memchr.c memcmp.c memcpy.c \
58 memmove.c memset.c qdivrem.c strcat.c strchr.c strcmp.c strcpy.c \
59 strcspn.c strlen.c strncat.c strncmp.c strncpy.c strpbrk.c \
60 strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
62 .if ${MACHINE_CPUARCH} == "arm"
63 .PATH: ${.CURDIR}/../libc/arm/gen
65 .if ${MK_ARM_EABI} == "no"
68 # Compiler support functions
69 .PATH: ${.CURDIR}/../../contrib/compiler-rt/lib/
70 SRCS+= divmoddi4.c divmodsi4.c divdi3.c divsi3.c moddi3.c modsi3.c
71 SRCS+= udivmoddi4.c udivmodsi4.c udivdi3.c udivsi3.c umoddi3.c umodsi3.c
73 .PATH: ${.CURDIR}/../../contrib/compiler-rt/lib/arm/
74 SRCS+= aeabi_idivmod.S aeabi_ldivmod.S aeabi_uidivmod.S aeabi_uldivmod.S
75 SRCS+= aeabi_memcmp.S aeabi_memcpy.S aeabi_memmove.S aeabi_memset.S
79 .if ${MACHINE_CPUARCH} == "ia64"
80 .PATH: ${.CURDIR}/../libc/ia64/string
81 SRCS+= bcmp.c bcopy.S bzero.S ffs.S memccpy.c memchr.c memcmp.c memcpy.S \
82 memmove.S memset.c strcat.c strchr.c strcmp.c strcpy.c strcspn.c \
83 strlen.c strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
84 strspn.c strstr.c strtok.c swab.c
86 .PATH: ${.CURDIR}/../libc/ia64/gen
87 SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S
88 SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S
90 .if ${MACHINE_CPUARCH} == "powerpc"
91 .PATH: ${.CURDIR}/../libc/quad
92 SRCS+= ashldi3.c ashrdi3.c
93 .PATH: ${.CURDIR}/../libc/powerpc/gen
97 # uuid functions from libc
98 .PATH: ${.CURDIR}/../libc/uuid
99 SRCS+= uuid_equal.c uuid_is_nil.c
102 .if ${MACHINE_CPUARCH} == "amd64"
103 .PATH: ${.CURDIR}/i386
104 .elif ${MACHINE_ARCH} == "powerpc64"
105 .PATH: ${.CURDIR}/powerpc
107 .PATH: ${.CURDIR}/${MACHINE_CPUARCH}
111 # decompression functionality from libbz2
112 # NOTE: to actually test this functionality after libbz2 upgrade compile
113 # loader(8) with LOADER_BZIP2_SUPPORT defined
114 .PATH: ${.CURDIR}/../../contrib/bzip2
115 CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS
116 SRCS+= libstand_bzlib_private.h
118 .for file in bzlib.c crctable.c decompress.c huffman.c randtable.c
120 CLEANFILES+= _${file}
123 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" ${.ALLSRC} > ${.TARGET}
126 CLEANFILES+= libstand_bzlib_private.h
127 libstand_bzlib_private.h: bzlib_private.h
128 sed -e 's|<stdlib.h>|"stand.h"|' \
129 ${.ALLSRC} > ${.TARGET}
131 # decompression functionality from libz
132 .PATH: ${.CURDIR}/../libz
133 CFLAGS+=-DHAVE_MEMCPY -I${.CURDIR}/../libz
134 SRCS+= adler32.c crc32.c libstand_zutil.h libstand_gzguts.h
136 .for file in infback.c inffast.c inflate.c inftrees.c zutil.c
138 CLEANFILES+= _${file}
141 sed -e "s|zutil\.h|libstand_zutil.h|" \
142 -e "s|gzguts\.h|libstand_gzguts.h|" \
143 ${.ALLSRC} > ${.TARGET}
146 # depend on stand.h being able to be included multiple times
147 .for file in zutil.h gzguts.h
148 CLEANFILES+= libstand_${file}
149 libstand_${file}: ${file}
150 sed -e 's|<fcntl.h>|"stand.h"|' \
151 -e 's|<stddef.h>|"stand.h"|' \
152 -e 's|<string.h>|"stand.h"|' \
153 -e 's|<stdio.h>|"stand.h"|' \
154 -e 's|<stdlib.h>|"stand.h"|' \
155 ${.ALLSRC} > ${.TARGET}
159 SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
160 fstat.c close.c lseek.c open.c read.c write.c readdir.c
163 SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
165 # network info services:
166 SRCS+= bootp.c rarp.c bootparam.c
169 SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c
170 SRCS+= dosfs.c ext2fs.c
172 .if ${MK_NAND} != "no"
176 .include <bsd.lib.mk>
178 .if ${MACHINE_CPUARCH} == "amd64"
179 beforedepend ${OBJS}: machine
180 cleandepend: cleanmachine
185 ln -s ${.CURDIR}/../../sys/i386/include machine