1# $FreeBSD$ 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 9MK_PROFILE= no 10MK_SSP= no 11 12.include <src.opts.mk> 13 14LIBSTAND_SRC?= ${.CURDIR} 15LIBSTAND_CPUARCH?=${MACHINE_CPUARCH} 16LIBC_SRC= ${LIBSTAND_SRC}/../libc 17 18LIB= stand 19NO_PIC= 20INCS?= stand.h 21MAN?= libstand.3 22 23WARNS?= 0 24 25CFLAGS+= -I${LIBSTAND_SRC} 26 27# standalone components and stuff we have modified locally 28SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \ 29 globals.c pager.c printf.c strdup.c strerror.c strtol.c strtoul.c random.c \ 30 sbrk.c twiddle.c zalloc.c zalloc_malloc.c 31 32# private (pruned) versions of libc string functions 33SRCS+= strcasecmp.c 34 35.PATH: ${LIBC_SRC}/net 36 37SRCS+= ntoh.c 38 39# string functions from libc 40.PATH: ${LIBC_SRC}/string 41SRCS+= bcmp.c bcopy.c bzero.c ffs.c fls.c \ 42 memccpy.c memchr.c memcmp.c memcpy.c memmove.c memset.c \ 43 qdivrem.c strcat.c strchr.c strcmp.c strcpy.c \ 44 strcspn.c strlcat.c strlcpy.c strlen.c strncat.c strncmp.c strncpy.c \ 45 strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c 46.if ${MACHINE_CPUARCH} == "arm" 47.PATH: ${LIBC_SRC}/arm/gen 48 49# Do not generate movt/movw, because the relocation fixup for them does not 50# translate to the -Bsymbolic -pie format required by self_reloc() in loader(8). 51# Also, the fpu is not available in a standalone environment. 52CFLAGS.clang+= -mllvm -arm-use-movt=0 53CFLAGS.clang+= -mfpu=none 54 55# Compiler support functions 56.PATH: ${LIBSTAND_SRC}/../../contrib/compiler-rt/lib/builtins/ 57# __clzsi2 and ctzsi2 for various builtin functions 58SRCS+= clzsi2.c ctzsi2.c 59# Divide and modulus functions called by the compiler 60SRCS+= divmoddi4.c divmodsi4.c divdi3.c divsi3.c moddi3.c modsi3.c 61SRCS+= udivmoddi4.c udivmodsi4.c udivdi3.c udivsi3.c umoddi3.c umodsi3.c 62 63.PATH: ${LIBSTAND_SRC}/../../contrib/compiler-rt/lib/builtins/arm/ 64SRCS+= aeabi_idivmod.S aeabi_ldivmod.S aeabi_uidivmod.S aeabi_uldivmod.S 65SRCS+= aeabi_memcmp.S aeabi_memcpy.S aeabi_memmove.S aeabi_memset.S 66.endif 67 68.if ${MACHINE_CPUARCH} == "aarch64" 69.PATH: ${LIBC_SRC}/aarch64/gen 70.endif 71 72.if ${MACHINE_CPUARCH} == "powerpc" 73.PATH: ${LIBC_SRC}/quad 74SRCS+= ashldi3.c ashrdi3.c 75SRCS+= syncicache.c 76.endif 77 78# uuid functions from libc 79.PATH: ${LIBC_SRC}/uuid 80SRCS+= uuid_create_nil.c uuid_equal.c uuid_from_string.c uuid_is_nil.c uuid_to_string.c 81 82# _setjmp/_longjmp 83.PATH: ${LIBSTAND_SRC}/${LIBSTAND_CPUARCH} 84SRCS+= _setjmp.S 85 86# decompression functionality from libbz2 87# NOTE: to actually test this functionality after libbz2 upgrade compile 88# loader(8) with LOADER_BZIP2_SUPPORT defined 89.PATH: ${LIBSTAND_SRC}/../../contrib/bzip2 90CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS 91SRCS+= libstand_bzlib_private.h 92 93.for file in bzlib.c crctable.c decompress.c huffman.c randtable.c 94SRCS+= _${file} 95CLEANFILES+= _${file} 96 97_${file}: ${file} 98 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" \ 99 ${.ALLSRC} > ${.TARGET} 100.endfor 101 102CLEANFILES+= libstand_bzlib_private.h 103libstand_bzlib_private.h: bzlib_private.h 104 sed -e 's|<stdlib.h>|"stand.h"|' \ 105 ${.ALLSRC} > ${.TARGET} 106 107# decompression functionality from libz 108.PATH: ${LIBSTAND_SRC}/../libz 109CFLAGS+=-DHAVE_MEMCPY -I${LIBSTAND_SRC}/../libz 110SRCS+= adler32.c crc32.c libstand_zutil.h libstand_gzguts.h 111 112.for file in infback.c inffast.c inflate.c inftrees.c zutil.c 113SRCS+= _${file} 114CLEANFILES+= _${file} 115 116_${file}: ${file} 117 sed -e "s|zutil\.h|libstand_zutil.h|" \ 118 -e "s|gzguts\.h|libstand_gzguts.h|" \ 119 ${.ALLSRC} > ${.TARGET} 120.endfor 121 122# depend on stand.h being able to be included multiple times 123.for file in zutil.h gzguts.h 124CLEANFILES+= libstand_${file} 125libstand_${file}: ${file} 126 sed -e 's|<fcntl.h>|"stand.h"|' \ 127 -e 's|<stddef.h>|"stand.h"|' \ 128 -e 's|<string.h>|"stand.h"|' \ 129 -e 's|<stdio.h>|"stand.h"|' \ 130 -e 's|<stdlib.h>|"stand.h"|' \ 131 ${.ALLSRC} > ${.TARGET} 132.endfor 133 134# io routines 135SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \ 136 fstat.c close.c lseek.c open.c read.c write.c readdir.c 137 138# network routines 139SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c 140 141# network info services: 142SRCS+= bootp.c rarp.c bootparam.c 143 144# boot filesystems 145SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c 146SRCS+= dosfs.c ext2fs.c 147SRCS+= splitfs.c 148SRCS+= pkgfs.c 149.if ${MK_NAND} != "no" 150SRCS+= nandfs.c 151.endif 152 153.include <bsd.stand.mk> 154.include <bsd.lib.mk> 155