1#	$NetBSD: Makefile,v 1.76 2011/12/25 06:09:08 tsutsui Exp $
2
3LIB=	sa
4NOPIC=	# defined
5NOPROFILE=# defined
6
7SA_USE_CREAD?= no		# Read compressed kernels
8SA_INCLUDE_NET?= yes		# Netboot via TFTP, NFS
9SA_USE_LOADFILE?= no		# Generic executable loading support
10SA_ENABLE_LS_OP?= no		# Filesystems ls operation
11
12#DEBUGCPPFLAGS= -DBOOTP_DEBUG -DNETIF_DEBUG -DETHER_DEBUG -DNFS_DEBUG -DRPC_DEBUG -DRARP_DEBUG -DARP_DEBUG -DNET_DEBUG -DDEBUG -DPARANOID
13CPPFLAGS=	-I${SADIR} ${SACPPFLAGS} ${SAMISCCPPFLAGS} \
14		-DCOMPAT_UFS ${DEBUGCPPFLAGS}
15
16#COPTS+= -ansi -pedantic -Wall
17
18.if defined(SA_EXTRADIR)
19.-include "${SA_EXTRADIR}/Makefile.inc"
20.endif
21
22.include <bsd.own.mk>
23
24.PATH.c: ${SADIR} ${.PARSEDIR}/../../../common/lib/libc/string
25
26# stand routines
27SRCS+=	alloc.c errno.c exit.c files.c \
28	getfile.c gets.c globals.c \
29	panic.c printf.c qsort.c snprintf.c sprintf.c strerror.c \
30	subr_prf.c twiddle.c vsprintf.c checkpasswd.c
31
32.if (${MACHINE_CPU} != "mips")
33SRCS+=	exec.c
34.endif
35
36# string routines
37.if ${MACHINE_ARCH} != "i386" && ${MACHINE_ARCH} != "x86_64"
38SRCS+=	memcmp.c memcpy.c memmove.c memset.c strchr.c
39.endif
40SRCS+=	bcopy.c bzero.c	# Remove me eventually.
41
42# io routines
43SRCS+=	closeall.c dev.c disklabel.c dkcksum.c ioctl.c nullfs.c stat.c fstat.c
44SRCS+=	close.c lseek.c open.c read.c write.c
45.if (${SA_USE_CREAD} == "yes")
46CPPFLAGS+= -D__INTERNAL_LIBSA_CREAD
47SRCS+=	cread.c
48.endif
49.if (${SA_ENABLE_LS_OP} == "yes")
50SRCS+= ls.c
51.endif
52
53.if (${SA_USE_LOADFILE} == "yes")
54SRCS+=	loadfile.c loadfile_ecoff.c loadfile_elf32.c lookup_elf32.c \
55	loadfile_elf64.c lookup_elf64.c
56.if (${MACHINE_CPU} != "mips")
57SRCS+=	loadfile_aout.c
58.endif
59.endif
60
61.if (${SA_INCLUDE_NET} == "yes")
62# network routines
63SRCS+=	arp.c ether.c ether_sprintf.c ip_cksum.c net.c netif.c rpc.c udp.c ip.c
64
65# network info services:
66SRCS+=	bootp.c rarp.c bootparam.c
67
68# boot filesystems
69SRCS+=	nfs.c tftp.c
70.endif
71
72SRCS+=	ffsv1.c ffsv2.c
73SRCS+=	lfsv1.c lfsv2.c
74SRCS+=	cd9660.c
75SRCS+=	ustarfs.c
76SRCS+=	dosfs.c
77SRCS+=	ext2fs.c
78SRCS+=	minixfs3.c
79SRCS+=	fnmatch.c
80# for historic compatibility ufs == ffsv1
81SRCS+=	ufs.c
82
83# only needed during build
84libinstall::
85
86.undef DESTDIR
87.include <bsd.lib.mk>
88
89lib${LIB}.o:: ${OBJS}
90	@echo building standard ${LIB} library
91	@rm -f lib${LIB}.o
92	@${LD} -r -o lib${LIB}.o `lorder ${OBJS} | tsort`
93
94.if defined(HAVE_GCC) || defined(HAVE_PCC)
95CPPFLAGS+=	-Wno-pointer-sign
96.endif
97
98.if defined(HAVE_GCC) && ${HAVE_GCC} >= 45 && ${MACHINE_ARCH} == "vax"
99COPTS.bootp.c+=	-O0
100.endif
101