Makefile.libkern revision 1.13
11.13Sbouyer#	$NetBSD: Makefile.libkern,v 1.13 2011/03/24 17:05:44 bouyer Exp $
21.1Spooka
31.1Spooka# 
41.1Spooka# Variable definitions for libkern.  
51.1Spooka#
61.1Spooka# Before including this, you _must_ set
71.1Spooka#   KERNDIR: location of sys/lib/libkern
81.1Spooka#
91.1Spooka# You *may* set:
101.1Spooka#   LIBKERN_ARCH: architecture subdir to be used
111.1Spooka#   KERNCPPFLAGS: see Makefile.inc
121.10Spooka#   KERNMISCCPPFLAGS: see Makefile.inc
131.1Spooka#
141.1Spooka
151.1Spooka.include <bsd.own.mk>
161.1Spooka
171.1Spooka.if defined(LIBKERN_ARCH) && !empty(LIBKERN_ARCH) && \
181.1Spooka    exists(${KERNDIR}/arch/${LIBKERN_ARCH})
191.1SpookaARCHSUBDIR=     ${LIBKERN_ARCH}
201.1Spooka.elif defined(MACHINE_ARCH) && !empty(MACHINE_ARCH) && \
211.1Spooka    exists(${KERNDIR}/arch/${MACHINE_ARCH})
221.1SpookaARCHSUBDIR=     ${MACHINE_ARCH}
231.1Spooka.elif defined(MACHINE_CPU) && !empty(MACHINE_CPU) && \
241.1Spooka    exists(${KERNDIR}/arch/${MACHINE_CPU})
251.1SpookaARCHSUBDIR=     ${MACHINE_CPU}
261.1Spooka.endif
271.1Spooka
281.1SpookaM= ${KERNDIR}/arch/${ARCHSUBDIR}
291.1Spooka
301.1SpookaCPPFLAGS+=	-I$M ${KERNCPPFLAGS} ${KERNMISCCPPFLAGS}
311.1Spooka
321.1Spooka.include "${.PARSEDIR}/../../../common/lib/libc/Makefile.inc"
331.1Spooka.include "${.PARSEDIR}/../../../common/lib/libutil/Makefile.inc"
341.1Spooka.include "${.PARSEDIR}/../../../common/lib/libprop/Makefile.inc"
351.13Sbouyer.include "${.PARSEDIR}/../../../common/lib/libquota/Makefile.inc"
361.1Spooka
371.1SpookaCPPFLAGS+=	-I${KERNDIR}/../../../common/include
381.1Spooka
391.1Spooka.PATH.c: ${KERNDIR}
401.1Spooka.if exists ($M/Makefile.inc)
411.1Spooka.PATH.c: $M
421.1Spooka.PATH.S: $M
431.1Spooka.include "$M/Makefile.inc"
441.1Spooka.endif
451.1Spooka
461.7Suebayasi.if (${MACHINE_ARCH} != "alpha") && \
471.11Smatt    (${MACHINE_ARCH} != "mips64eb" || !empty(CFLAGS:M-mabi=32)) && \
481.11Smatt    (${MACHINE_ARCH} != "mips64el" || !empty(CFLAGS:M-mabi=32)) && \
491.7Suebayasi    (${MACHINE_ARCH} != "powerpc64") && \
501.7Suebayasi    (${MACHINE_ARCH} != "sparc64") && \
511.12Sjakllsch    (${MACHINE_ARCH} != "x86_64" || !empty(CFLAGS:M-m32))
521.1Spooka# Quad support
531.1SpookaSRCS+=	adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \
541.1Spooka	lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \
551.1Spooka	subdi3.c  ucmpdi2.c udivdi3.c umoddi3.c xordi3.c
561.1Spooka.endif
571.1Spooka
581.1Spooka# Other stuff
591.9SpookaSRCS+=	kern_assert.c __main.c
601.1SpookaSRCS+=	__cmsg_alignbytes.c cpuset.c inet_addr.c intoa.c
611.8Suebayasi.if empty(SRCS:Mbyte_swap_8.*)
621.5SdslSRCS+=	bswap64.c
631.8Suebayasi.endif
641.1SpookaSRCS+=	md4c.c md5c.c rmd160.c sha1.c sha2.c
651.2SdarranSRCS+=	pmatch.c arc4random.c bcd.c mcount.c mertwist.c crc32.c
661.1Spooka
671.4SdslSRCS+=	strsep.c strstr.c
681.4SdslSRCS+=	strlcpy.c strlcat.c
691.5Sdsl
701.5SdslSRCS+=	imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c
711.4SdslSRCS+=	memcpy.c memmove.c
721.4SdslSRCS+=	strchr.c strrchr.c
731.8SuebayasiSRCS+=	memcmp.c
741.8Suebayasi.if empty(SRCS:Mmemset2.*)
751.8SuebayasiSRCS+=	memset.c 
761.8Suebayasi.endif
771.4SdslSRCS+=	popcount32.c popcount64.c
781.5SdslSRCS+=	strtoul.c strtoll.c strtoull.c strtoumax.c
791.5Sdsl
801.5SdslSRCS+=	scanc.c skpc.c
811.5SdslSRCS+=	random.c
821.1Spooka
831.5SdslSRCS+=	memchr.c
841.5SdslSRCS+=	strcat.c strcmp.c strcpy.c strlen.c
851.5SdslSRCS+=	strncmp.c strncpy.c
861.5SdslSRCS+=	strcasecmp.c strncasecmp.c
871.1Spooka
881.1SpookaSRCS+=	xlat_mbr_fstype.c
891.1Spooka
901.1SpookaSRCS+=	heapsort.c ptree.c rb.c
911.1Spooka
921.1Spooka# Files to clean up
931.1SpookaCLEANFILES+= lib${LIB}.o lib${LIB}.po
941.1Spooka
951.4Sdsl# Remove from SRCS the .c files for any .S files added by the MD makefiles,
961.5Sdsl# also remove from SRCS the .c files for the .c files in NO_SRCS.
971.5Sdsl# (Unlike libc, we don't worry about lint)
981.4Sdsl
991.4Sdsl.for check_file in ${SRCS:M*.S} ${NO_SRCS}
1001.4Sdslunwanted_file := ${SRCS:M${check_file:.S=.c}}
1011.4Sdsl.if "${unwanted_file}" != ""
1021.4SdslSRCS := ${SRCS:N${unwanted_file}}
1031.1Spooka.endif
1041.4Sdsl.endfor
105