Makefile revision 201381
1# $FreeBSD: head/lib/libstand/Makefile 201381 2010-01-02 09:58:07Z ed $ 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 12LIB= stand 13NO_PROFILE= 14NO_PIC= 15INCS= stand.h 16MAN= libstand.3 17 18WARNS?= 0 19 20CFLAGS+= -ffreestanding -Wformat 21CFLAGS+= -I${.CURDIR} 22 23.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" 24CFLAGS+= -mpreferred-stack-boundary=2 25CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2 26.endif 27.if ${MACHINE_ARCH} == "i386" 28CFLAGS+= -mno-sse3 29.endif 30.if ${MACHINE} == "pc98" 31CFLAGS+= -Os 32.endif 33.if ${MACHINE_ARCH} == "powerpc" 34CFLAGS+= -msoft-float -D_STANDALONE 35.endif 36.if ${MACHINE_ARCH} == "amd64" 37CFLAGS+= -m32 -I. 38.endif 39.if ${MACHINE_ARCH} == "arm" 40CFLAGS+= -msoft-float -D_STANDALONE 41.endif 42 43# standalone components and stuff we have modified locally 44SRCS+= 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 47 48# private (pruned) versions of libc string functions 49SRCS+= strcasecmp.c 50 51.PATH: ${.CURDIR}/../libc/net 52 53SRCS+= ntoh.c 54 55# string functions from libc 56.PATH: ${.CURDIR}/../libc/string 57.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \ 58 ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "amd64" || \ 59 ${MACHINE_ARCH} == "arm" 60SRCS+= 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 64.endif 65.if ${MACHINE_ARCH} == "arm" 66.PATH: ${.CURDIR}/../libc/arm/gen 67SRCS+= divsi3.S 68.endif 69.if ${MACHINE_ARCH} == "ia64" 70.PATH: ${.CURDIR}/../libc/ia64/string 71SRCS+= 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 76 77.PATH: ${.CURDIR}/../libc/ia64/gen 78SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S 79SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S 80.endif 81.if ${MACHINE_ARCH} == "powerpc" 82.PATH: ${.CURDIR}/../libc/quad 83SRCS+= ashldi3.c ashrdi3.c 84.PATH: ${.CURDIR}/../libc/powerpc/gen 85SRCS+= syncicache.c 86.endif 87 88# uuid functions from libc 89.PATH: ${.CURDIR}/../libc/uuid 90SRCS+= uuid_equal.c uuid_is_nil.c 91 92# _setjmp/_longjmp 93.if ${MACHINE_ARCH} == "amd64" 94.PATH: ${.CURDIR}/i386 95.else 96.PATH: ${.CURDIR}/${MACHINE_ARCH} 97.endif 98SRCS+= _setjmp.S 99 100# decompression functionality from libbz2 101# NOTE: to actually test this functionality after libbz2 upgrade compile 102# loader(8) with LOADER_BZIP2_SUPPORT defined 103.PATH: ${.CURDIR}/../../contrib/bzip2 104CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS 105SRCS+= libstand_bzlib_private.h 106 107.for file in bzlib.c crctable.c decompress.c huffman.c randtable.c 108SRCS+= _${file} 109CLEANFILES+= _${file} 110 111_${file}: ${file} 112 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" ${.ALLSRC} > ${.TARGET} 113.endfor 114 115CLEANFILES+= libstand_bzlib_private.h 116libstand_bzlib_private.h: bzlib_private.h 117 sed -e 's|<stdlib.h>|"stand.h"|' \ 118 ${.ALLSRC} > ${.TARGET} 119 120# decompression functionality from libz 121.PATH: ${.CURDIR}/../libz 122CFLAGS+=-DHAVE_MEMCPY -I${.CURDIR}/../libz 123SRCS+= adler32.c crc32.c libstand_zutil.h 124 125.for file in infback.c inffast.c inflate.c inftrees.c zutil.c 126SRCS+= _${file} 127CLEANFILES+= _${file} 128 129_${file}: ${file} 130 sed "s|zutil\.h|libstand_zutil.h|" ${.ALLSRC} > ${.TARGET} 131.endfor 132 133# depend on stand.h being able to be included multiple times 134CLEANFILES+= libstand_zutil.h 135libstand_zutil.h: zutil.h 136 sed -e 's|<stddef.h>|"stand.h"|' \ 137 -e 's|<string.h>|"stand.h"|' \ 138 -e 's|<stdlib.h>|"stand.h"|' \ 139 ${.ALLSRC} > ${.TARGET} 140 141# io routines 142SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \ 143 fstat.c close.c lseek.c open.c read.c write.c readdir.c 144 145# network routines 146SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c 147 148# network info services: 149SRCS+= bootp.c rarp.c bootparam.c 150 151# boot filesystems 152SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c 153SRCS+= dosfs.c ext2fs.c 154SRCS+= splitfs.c 155 156.include <bsd.lib.mk> 157 158.if ${MACHINE_ARCH} == "amd64" 159beforedepend ${OBJS}: machine 160cleandepend: cleanmachine 161cleanmachine: 162 rm -f machine 163 164machine: 165 ln -s ${.CURDIR}/../../sys/i386/include machine 166.endif 167