Makefile revision 139106
1# $FreeBSD: head/lib/libstand/Makefile 139106 2004-12-21 09:33:47Z ru $ 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 9LIB= stand 10NO_PROFILE= 11NO_PIC= 12INCS= stand.h 13MAN= libstand.3 14 15CFLAGS+= -ffreestanding -Wformat 16CFLAGS+= -I${.CURDIR} 17 18.if ${MACHINE_ARCH} == "alpha" 19CFLAGS+= -mno-fp-regs 20.endif 21.if ${MACHINE_ARCH} == "i386" 22CFLAGS+= -mpreferred-stack-boundary=2 23.endif 24.if ${MACHINE_ARCH} == "powerpc" 25CFLAGS+= -msoft-float -D_STANDALONE 26.endif 27.if ${MACHINE_ARCH} == "amd64" 28CFLAGS+= -m32 29.endif 30 31# standalone components and stuff we have modified locally 32SRCS+= zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \ 33 globals.c pager.c printf.c strdup.c strerror.c strtol.c random.c \ 34 sbrk.c twiddle.c zalloc.c zalloc_malloc.c 35 36# private (pruned) versions of libc string functions 37SRCS+= strcasecmp.c 38 39# byte order functions from libc 40.if ${MACHINE_ARCH} != "amd64" 41.PATH: ${.CURDIR}/../libc/${MACHINE_ARCH}/net 42.else 43.PATH: ${.CURDIR}/../libc/i386/net 44.endif 45SRCS+= htons.S ntohs.S htonl.S ntohl.S 46 47# string functions from libc 48.PATH: ${.CURDIR}/../libc/string 49.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \ 50 ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "amd64" 51SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \ 52 memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \ 53 strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \ 54 strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c 55.endif 56.if ${MACHINE_ARCH} == "alpha" 57.PATH: ${.CURDIR}/../libc/alpha/string 58SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \ 59 memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \ 60 strcmp.c strcpy.c strcspn.c strlen.c \ 61 strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \ 62 strspn.c strstr.c strtok.c swab.c 63 64SRCS+= __divqu.S __divq.S __divlu.S __divl.S 65SRCS+= __remqu.S __remq.S __remlu.S __reml.S 66 67CLEANFILES+= __divqu.S __divq.S __divlu.S __divl.S 68CLEANFILES+= __remqu.S __remq.S __remlu.S __reml.S 69 70 71__divqu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4 72 m4 -DNAME=__divqu -DOP=div -DS=false -DWORDSIZE=64 \ 73 ${.ALLSRC} > ${.TARGET} 74 75__divq.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4 76 m4 -DNAME=__divq -DOP=div -DS=true -DWORDSIZE=64 \ 77 ${.ALLSRC} > ${.TARGET} 78 79__divlu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4 80 m4 -DNAME=__divlu -DOP=div -DS=false -DWORDSIZE=32 \ 81 ${.ALLSRC} > ${.TARGET} 82 83__divl.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4 84 m4 -DNAME=__divl -DOP=div -DS=true -DWORDSIZE=32 \ 85 ${.ALLSRC} > ${.TARGET} 86 87__remqu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4 88 m4 -DNAME=__remqu -DOP=rem -DS=false -DWORDSIZE=64 \ 89 ${.ALLSRC} > ${.TARGET} 90 91__remq.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4 92 m4 -DNAME=__remq -DOP=rem -DS=true -DWORDSIZE=64 \ 93 ${.ALLSRC} > ${.TARGET} 94 95__remlu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4 96 m4 -DNAME=__remlu -DOP=rem -DS=false -DWORDSIZE=32 \ 97 ${.ALLSRC} > ${.TARGET} 98 99__reml.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4 100 m4 -DNAME=__reml -DOP=rem -DS=true -DWORDSIZE=32 \ 101 ${.ALLSRC} > ${.TARGET} 102.endif 103.if ${MACHINE_ARCH} == "ia64" 104.PATH: ${.CURDIR}/../libc/ia64/string 105SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \ 106 memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \ 107 strcmp.c strcpy.c strcspn.c strlen.c \ 108 strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \ 109 strspn.c strstr.c strtok.c swab.c 110 111.PATH: ${.CURDIR}/../libc/ia64/gen 112SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S 113SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S 114.endif 115.if ${MACHINE_ARCH} == "powerpc" 116.PATH: ${.CURDIR}/../libc/quad 117SRCS+= ashldi3.c ashrdi3.c 118.PATH: ${.CURDIR}/../libc/powerpc/gen 119SRCS+= syncicache.c 120.endif 121 122# _setjmp/_longjmp 123.if ${MACHINE_ARCH} == "amd64" 124.PATH: ${.CURDIR}/i386 125.else 126.PATH: ${.CURDIR}/${MACHINE_ARCH} 127.endif 128SRCS+= _setjmp.S 129 130# decompression functionality from libbz2 131.PATH: ${.CURDIR}/../../contrib/bzip2 132CFLAGS+=-I. -DBZ_NO_STDIO -DBZ_NO_COMPRESS 133SRCS+= _bzlib.c _crctable.c _decompress.c _huffman.c _randtable.c _bzlib.h \ 134 _bzlib_private.h 135 136# check your belt - ugly bzip2 stuff ahead 137.for file in bzlib.c bzlib.h bzlib_private.h 138CLEANFILES+= _${file} _${file}.orig 139 140_${file}: ${file} ${file}.diff 141 patch -s -b .orig -o ${.TARGET} < ${.ALLSRC:M*.diff} ${.ALLSRC:M*.[ch]} 142.endfor 143 144.for file in crctable.c decompress.c huffman.c randtable.c 145CLEANFILES+= _${file} 146 147_${file}: ${file} 148 sed "s|bzlib_private\.h|_bzlib_private.h|" ${.ALLSRC} > ${.TARGET} 149.endfor 150 151# decompression functionality from libz 152.PATH: ${.CURDIR}/../libz 153CFLAGS+=-DHAVE_MEMCPY -I${.CURDIR}/../libz 154SRCS+= adler32.c crc32.c _infback.c _inffast.c _inflate.c \ 155 _inftrees.c _zutil.c _zutil.h 156 157# aargh 158.for file in zutil.h 159CLEANFILES+= _${file} _${file}.orig 160 161_${file}: ${file} ${file}.diff 162 patch -s -b .orig -o ${.TARGET} < ${.ALLSRC:M*.diff} ${.ALLSRC:M*.[ch]} 163.endfor 164 165.for file in infback.c inffast.c inflate.c inftrees.c zutil.c 166CLEANFILES+= _${file} 167 168_${file}: ${file} 169 sed "s|zutil\.h|_zutil.h|" ${.ALLSRC} > ${.TARGET} 170.endfor 171 172# io routines 173SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \ 174 fstat.c close.c lseek.c open.c read.c write.c readdir.c 175 176# network routines 177SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c 178 179# network info services: 180SRCS+= bootp.c rarp.c bootparam.c 181 182# boot filesystems 183SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c 184SRCS+= dosfs.c ext2fs.c 185SRCS+= splitfs.c 186 187.include <bsd.lib.mk> 188 189.if ${MACHINE_ARCH} == "amd64" 190${SRCS:M*.c:R:S/$/.o/g}: machine 191 192beforedepend: machine 193 194machine: 195 ln -s ${.CURDIR}/../../sys/i386/include machine 196.endif 197