1# $FreeBSD: stable/10/lib/libstand/Makefile 312403 2017-01-19 07:29:52Z delphij $ 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 12LIBSTAND_SRC?= ${.CURDIR} 13LIBSTAND_CPUARCH?=${MACHINE_CPUARCH} 14LIBC_SRC= ${LIBSTAND_SRC}/../libc 15 16LIB= stand 17NO_PROFILE= 18NO_PIC= 19INCS?= stand.h 20MAN?= libstand.3 21 22WARNS?= 0 23 24CFLAGS+= -ffreestanding -Wformat 25CFLAGS+= -I${LIBSTAND_SRC} 26 27.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" 28CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float 29.endif 30.if ${MACHINE_CPUARCH} == "i386" 31CFLAGS.gcc+= -mpreferred-stack-boundary=2 32.endif 33.if ${MACHINE_CPUARCH} == "amd64" 34CFLAGS+= -fPIC -mno-red-zone 35.endif 36.if ${MACHINE} == "pc98" 37CFLAGS+= -Os 38.endif 39.if ${MACHINE_CPUARCH} == "powerpc" 40CFLAGS+= -msoft-float -D_STANDALONE -DNETIF_DEBUG 41.endif 42.if ${MACHINE_CPUARCH} == "arm" 43CFLAGS+= -msoft-float -D_STANDALONE 44.endif 45.if ${MACHINE_CPUARCH} == "mips" 46CFLAGS+= -G0 -fno-pic -mno-abicalls 47.endif 48 49# standalone components and stuff we have modified locally 50SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c environment.c getopt.c gets.c \ 51 globals.c pager.c printf.c strdup.c strerror.c strtol.c strtoul.c random.c \ 52 sbrk.c twiddle.c zalloc.c zalloc_malloc.c 53 54# private (pruned) versions of libc string functions 55SRCS+= strcasecmp.c 56 57.PATH: ${LIBC_SRC}/net 58 59SRCS+= ntoh.c 60 61# string functions from libc 62.PATH: ${LIBC_SRC}/string 63.if ${MACHINE_CPUARCH} != "ia64" 64SRCS+= bcmp.c bcopy.c bzero.c ffs.c memccpy.c memchr.c memcmp.c memcpy.c \ 65 memmove.c memset.c qdivrem.c strcat.c strchr.c strcmp.c strcpy.c \ 66 strcspn.c strlcat.c strlcpy.c strlen.c strncat.c strncmp.c strncpy.c \ 67 strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c 68.endif 69.if ${MACHINE_CPUARCH} == "arm" 70.PATH: ${LIBC_SRC}/arm/gen 71 72.if ${MK_ARM_EABI} == "no" 73SRCS+= divsi3.S 74.else 75# Compiler support functions 76.PATH: ${LIBSTAND_SRC}/../../contrib/compiler-rt/lib/ 77# __clzsi2 and ctzsi2 for various builtin functions 78SRCS+= clzsi2.c ctzsi2.c 79# Divide and modulus functions called by the compiler 80SRCS+= divmoddi4.c divmodsi4.c divdi3.c divsi3.c moddi3.c modsi3.c 81SRCS+= udivmoddi4.c udivmodsi4.c udivdi3.c udivsi3.c umoddi3.c umodsi3.c 82 83.PATH: ${LIBSTAND_SRC}/../../contrib/compiler-rt/lib/arm/ 84SRCS+= aeabi_idivmod.S aeabi_ldivmod.S aeabi_uidivmod.S aeabi_uldivmod.S 85SRCS+= aeabi_memcmp.S aeabi_memcpy.S aeabi_memmove.S aeabi_memset.S 86.endif 87 88.endif 89.if ${MACHINE_CPUARCH} == "ia64" 90.PATH: ${LIBC_SRC}/ia64/string 91SRCS+= bcmp.c bcopy.S bzero.S ffs.S memccpy.c memchr.c memcmp.c memcpy.S \ 92 memmove.S memset.c strcat.c strchr.c strcmp.c strcpy.c strcspn.c \ 93 strlcat.c strlcpy.c \ 94 strlen.c strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \ 95 strspn.c strstr.c strtok.c swab.c 96 97.PATH: ${LIBC_SRC}/ia64/gen 98SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S 99SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S 100.endif 101.if ${MACHINE_CPUARCH} == "powerpc" 102.PATH: ${LIBC_SRC}/quad 103SRCS+= ashldi3.c ashrdi3.c 104.PATH: ${LIBC_SRC}/powerpc/gen 105SRCS+= syncicache.c 106.endif 107 108# uuid functions from libc 109.PATH: ${LIBC_SRC}/uuid 110SRCS+= uuid_equal.c uuid_is_nil.c 111 112# _setjmp/_longjmp 113.if ${MACHINE_ARCH} == "powerpc64" 114.PATH: ${LIBSTAND_SRC}/powerpc 115.else 116.PATH: ${LIBSTAND_SRC}/${LIBSTAND_CPUARCH} 117.endif 118SRCS+= _setjmp.S 119 120# decompression functionality from libbz2 121# NOTE: to actually test this functionality after libbz2 upgrade compile 122# loader(8) with LOADER_BZIP2_SUPPORT defined 123.PATH: ${LIBSTAND_SRC}/../../contrib/bzip2 124CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS 125SRCS+= libstand_bzlib_private.h 126 127.for file in bzlib.c crctable.c decompress.c huffman.c randtable.c 128SRCS+= _${file} 129CLEANFILES+= _${file} 130 131_${file}: ${file} 132 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" ${.ALLSRC} > ${.TARGET} 133.endfor 134 135CLEANFILES+= libstand_bzlib_private.h 136libstand_bzlib_private.h: bzlib_private.h 137 sed -e 's|<stdlib.h>|"stand.h"|' \ 138 ${.ALLSRC} > ${.TARGET} 139 140# decompression functionality from libz 141.PATH: ${LIBSTAND_SRC}/../../contrib/zlib 142CFLAGS+=-DHAVE_MEMCPY -I${LIBSTAND_SRC}/../../contrib/zlib 143SRCS+= adler32.c crc32.c libstand_zutil.h libstand_gzguts.h 144 145.for file in infback.c inffast.c inflate.c inftrees.c zutil.c 146SRCS+= _${file} 147CLEANFILES+= _${file} 148 149_${file}: ${file} 150 sed -e "s|zutil\.h|libstand_zutil.h|" \ 151 -e "s|gzguts\.h|libstand_gzguts.h|" \ 152 ${.ALLSRC} > ${.TARGET} 153.endfor 154 155# depend on stand.h being able to be included multiple times 156.for file in zutil.h gzguts.h 157CLEANFILES+= libstand_${file} 158libstand_${file}: ${file} 159 sed -e 's|<fcntl.h>|"stand.h"|' \ 160 -e 's|<stddef.h>|"stand.h"|' \ 161 -e 's|<string.h>|"stand.h"|' \ 162 -e 's|<stdio.h>|"stand.h"|' \ 163 -e 's|<stdlib.h>|"stand.h"|' \ 164 ${.ALLSRC} > ${.TARGET} 165.endfor 166 167# io routines 168SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \ 169 fstat.c close.c lseek.c open.c read.c write.c readdir.c 170 171# network routines 172SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c 173 174# network info services: 175SRCS+= bootp.c rarp.c bootparam.c 176 177# boot filesystems 178SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c 179SRCS+= dosfs.c ext2fs.c 180SRCS+= splitfs.c 181.if ${MK_NAND} != "no" 182SRCS+= nandfs.c 183.endif 184 185.include <bsd.lib.mk> 186 187