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