blob: 401bbdacdbefb5d715d0231cc42b2b67a5c22efd [file] [log] [blame]
Toomas Soome199767f2015-10-25 00:06:51 +03001# $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
9MAN=
10
11.include <bsd.own.mk>
12MK_SSP= no
13
14LIBSTAND_SRC= ${.CURDIR}/../../../../lib/libstand
15LIBC_SRC= ${LIBSTAND_SRC}/../libc
16
17.PATH: ${LIBSTAND_SRC}
18LIB= stand
19INTERNALLIB=
20MK_PROFILE= no
21NO_PIC=
22
23WARNS?= 0
24
25# standalone components and stuff we have modified locally
26SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
27 globals.c pager.c printf.c strdup.c strerror.c strtol.c strtoul.c random.c \
28 sbrk.c twiddle.c zalloc.c zalloc_malloc.c
29
30# private (pruned) versions of libc string functions
31SRCS+= strcasecmp.c
32
33.PATH: ${LIBC_SRC}/net
34
35SRCS+= ntoh.c
36
37# string functions from libc
38.PATH: ${LIBC_SRC}/string
39.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "powerpc" || \
40 ${MACHINE_CPUARCH} == "sparc64" || ${MACHINE_CPUARCH} == "amd64" || \
41 ${MACHINE_CPUARCH} == "arm"
42SRCS+= bcmp.c bcopy.c bzero.c ffs.c memccpy.c memchr.c memcmp.c memcpy.c \
43 memmove.c memset.c qdivrem.c strcat.c strchr.c strcmp.c strcpy.c \
44 strcspn.c strlen.c strncat.c strncmp.c strncpy.c strpbrk.c \
45 strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
46.endif
47.if ${MACHINE_CPUARCH} == "arm"
48.PATH: ${LIBC_SRC}/arm/gen
49SRCS+= divsi3.S
50.endif
51.if ${MACHINE_CPUARCH} == "powerpc"
52.PATH: ${LIBC_SRC}/quad
53SRCS+= ashldi3.c ashrdi3.c
54.PATH: ${LIBC_SRC}/powerpc/gen
55SRCS+= syncicache.c
56.endif
57
58# uuid functions from libc
59.PATH: ${LIBC_SRC}/uuid
60SRCS+= uuid_equal.c uuid_is_nil.c
61
62# _setjmp/_longjmp
63.if ${MACHINE_CPUARCH} == "amd64"
64.PATH: ${LIBSTAND_SRC}/amd64
65.elif ${MACHINE_ARCH} == "powerpc64"
66.PATH: ${LIBSTAND_SRC}/powerpc
67.else
68.PATH: ${LIBSTAND_SRC}/${MACHINE_CPUARCH}
69.endif
70SRCS+= _setjmp.S
71
72# decompression functionality from libbz2
73# NOTE: to actually test this functionality after libbz2 upgrade compile
74# loader(8) with LOADER_BZIP2_SUPPORT defined
75.PATH: ${LIBSTAND_SRC}/../../contrib/bzip2
76CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS
77SRCS+= libstand_bzlib_private.h
78
79.for file in bzlib.c crctable.c decompress.c huffman.c randtable.c
80SRCS+= _${file}
81CLEANFILES+= _${file}
82
83_${file}: ${file}
84 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" \
85 ${.ALLSRC} > ${.TARGET}
86.endfor
87
88CLEANFILES+= libstand_bzlib_private.h
89libstand_bzlib_private.h: bzlib_private.h
90 sed -e 's|<stdlib.h>|"stand.h"|' \
91 ${.ALLSRC} > ${.TARGET}
92
93# decompression functionality from libz
94.PATH: ${LIBSTAND_SRC}/../libz
95CFLAGS+=-DHAVE_MEMCPY -I${LIBSTAND_SRC}/../libz
96SRCS+= adler32.c crc32.c libstand_zutil.h libstand_gzguts.h
97
98.for file in infback.c inffast.c inflate.c inftrees.c zutil.c
99SRCS+= _${file}
100CLEANFILES+= _${file}
101
102_${file}: ${file}
103 sed -e "s|zutil\.h|libstand_zutil.h|" \
104 -e "s|gzguts\.h|libstand_gzguts.h|" \
105 ${.ALLSRC} > ${.TARGET}
106.endfor
107
108# depend on stand.h being able to be included multiple times
109.for file in zutil.h gzguts.h
110CLEANFILES+= libstand_${file}
111libstand_${file}: ${file}
112 sed -e 's|<fcntl.h>|"stand.h"|' \
113 -e 's|<stddef.h>|"stand.h"|' \
114 -e 's|<string.h>|"stand.h"|' \
115 -e 's|<stdio.h>|"stand.h"|' \
116 -e 's|<stdlib.h>|"stand.h"|' \
117 ${.ALLSRC} > ${.TARGET}
118.endfor
119
120# io routines
121SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
122 fstat.c close.c lseek.c open.c read.c write.c readdir.c
123
124# network routines
125SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
126
127# network info services:
128SRCS+= bootp.c rarp.c bootparam.c
129
130# boot filesystems
131SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c
132SRCS+= dosfs.c ext2fs.c
133SRCS+= splitfs.c
134
135.include <bsd.stand.mk>
136.include <bsd.lib.mk>