Home | History | Annotate | Line # | Download | only in libc
Makefile revision 1.98.2.6
      1 #	$NetBSD: Makefile,v 1.98.2.6 2002/03/22 20:41:49 nathanw Exp $
      2 #	@(#)Makefile	8.2 (Berkeley) 2/3/94
      3 #
      4 # All library objects contain sccsid strings by default; they may be
      5 # excluded as a space-saving measure.  To produce a library that does
      6 # not contain these strings, delete -DLIBC_SCCS and -DSYSLIBC_SCCS
      7 # from CPPFLAGS below.  To remove these strings from just the system call
      8 # stubs, remove just -DSYSLIBC_SCCS from CPPFLAGS.
      9 #
     10 # The NLS (message catalog) functions are always in libc.  To choose that
     11 # strerror(), perror(), strsignal(), psignal(), etc. actually call the NLS
     12 # functions, put -DNLS on the CPPFLAGS line below.
     13 #
     14 # The YP functions are always in libc. To choose that getpwent() and friends
     15 # actually call the YP functions, put -DYP on the CPPFLAGS line below.
     16 #
     17 # The Hesiod functions are always in libc. To choose that getpwent() and friends
     18 # actually call the Hesiod functions, put -DHESIOD on the CPPFLAGS line below.
     19 
     20 .include <bsd.own.mk>
     21 
     22 LIB=		c
     23 USE_SHLIBDIR=	yes
     24 CPPFLAGS+=	-D_LIBC -DLIBC_SCCS -DSYSLIBC_SCCS -D_REENTRANT
     25 CPPFLAGS+=	-I${.CURDIR}/include
     26 
     27 .if (${USE_HESIOD} != "no")
     28 CPPFLAGS+=	-DHESIOD
     29 .endif
     30 
     31 CPPFLAGS+=	-DINET6
     32 CPPFLAGS+=	-DNLS
     33 
     34 .if (${USE_YP} != "no")
     35 CPPFLAGS+=	-DYP
     36 .endif
     37 
     38 LDADD+=		 -lsyscall
     39 
     40 .if ${MACHINE_ARCH} == "i386"
     41 # Set lint to exit on warnings
     42 LINTFLAGS+=	-w
     43 .endif
     44 # ignore 'empty translation unit' warnings.
     45 LINTFLAGS+=	-X 272
     46 
     47 .if exists(${.CURDIR}/arch/${MACHINE_ARCH})
     48 ARCHSUBDIR=	${MACHINE_ARCH}
     49 .elif exists(${.CURDIR}/arch/${MACHINE_CPU}) 
     50 ARCHSUBDIR=	${MACHINE_CPU}
     51 .else
     52 .BEGIN:
     53 	@echo no ARCHSUBDIR for ${MACHINE_ARCH} nor ${MACHINE_CPU}
     54 	@false
     55 .endif
     56 
     57 ARCHDIR=	${.CURDIR}/arch/${ARCHSUBDIR}
     58 AINC=		-I${ARCHDIR}
     59 .if defined(DESTDIR)
     60 AINC+=		-nostdinc -idirafter ${DESTDIR}/usr/include
     61 .endif
     62 CLEANFILES+=	tags
     63 
     64 # Don't try to lint the C library against itself when creating llib-lc.ln
     65 LLIBS=
     66 
     67 INCSDIR=	/usr/include
     68 
     69 .if exists (${ARCHDIR}/Makefile.inc)
     70 .PATH:	${ARCHDIR}
     71 .include "${ARCHDIR}/Makefile.inc"
     72 .endif
     73 
     74 .include "${.CURDIR}/db/Makefile.inc"
     75 .include "${.CURDIR}/compat-43/Makefile.inc"
     76 .include "${.CURDIR}/dlfcn/Makefile.inc"
     77 .include "${.CURDIR}/gen/Makefile.inc"
     78 .include "${.CURDIR}/gmon/Makefile.inc"
     79 .include "${.CURDIR}/hash/Makefile.inc"
     80 .include "${.CURDIR}/citrus/Makefile.inc"
     81 .include "${.CURDIR}/locale/Makefile.inc"
     82 .include "${.CURDIR}/md/Makefile.inc"
     83 .include "${.CURDIR}/net/Makefile.inc"
     84 .include "${.CURDIR}/nls/Makefile.inc"
     85 .if (${MACHINE_ARCH} != "alpha") && (${MACHINE_ARCH} != "sparc64")
     86 .include "${.CURDIR}/quad/Makefile.inc"
     87 .endif
     88 .include "${.CURDIR}/regex/Makefile.inc"
     89 .include "${.CURDIR}/rpc/Makefile.inc"
     90 .include "${.CURDIR}/stdio/Makefile.inc"
     91 .include "${.CURDIR}/stdlib/Makefile.inc"
     92 .include "${.CURDIR}/string/Makefile.inc"
     93 .include "${.CURDIR}/termios/Makefile.inc"
     94 .include "${.CURDIR}/thread-stub/Makefile.inc"
     95 .include "${.CURDIR}/time/Makefile.inc"
     96 .include "${.CURDIR}/sys/Makefile.inc"
     97 .if (${MKYP} != "no")
     98 .include "${.CURDIR}/yp/Makefile.inc"
     99 .endif
    100 
    101 NLS=	C.msg Pig.msg cs.msg de.msg es.msg fi.msg fr.msg nl.msg no.msg \
    102 	sv.msg pl.msg
    103 
    104 LIBKERN=	${.CURDIR}/../../sys/lib/libkern
    105 
    106 KSRCS=	bcopy.c bcmp.c bswap16.c bswap32.c bswap64.c bzero.c ffs.c \
    107 	strcat.c strchr.c strcmp.c strcpy.c strlen.c \
    108 	strncmp.c strncpy.c strrchr.c \
    109 	htonl.c htons.c ntohl.c ntohs.c md5c.c \
    110 	memchr.c memcmp.c memcpy.c memmove.c memset.c \
    111 	index.c rindex.c
    112 .if (${MACHINE_ARCH} != "alpha") && (${MACHINE_ARCH} != "sparc64")
    113 KSRCS+=	adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \
    114 	lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \
    115 	subdi3.c  ucmpdi2.c udivdi3.c umoddi3.c xordi3.c
    116 KINCLUDES+=	quad/quad.h
    117 .endif
    118 
    119 copy-to-libkern:	copy-to-libkern-machind copy-to-libkern-machdep
    120 
    121 copy-to-libkern-machind: ${KSRCS}
    122 	cp -p ${.ALLSRC} ${LIBKERN}
    123 .if defined(KINCLUDES) && !empty(KINCLUDES)
    124 	(cd ${.CURDIR} ; cp -p ${KINCLUDES} ${LIBKERN})
    125 .endif
    126 
    127 copy-to-libkern-machdep: ${KMSRCS}
    128 .if defined(KMSRCS) && !empty(KMSRCS)
    129 	cp -p ${.ALLSRC} ${LIBKERN}/arch/${ARCHSUBDIR}
    130 .endif
    131 .if defined(KMINCLUDES) && !empty(KMINCLUDES)
    132 	(cd ${.CURDIR} ; cp -p ${KMINCLUDES} ${LIBKERN}/arch/${ARCHSUBDIR})
    133 .endif
    134 
    135 rm-from-libkern:
    136 	for i in ${KSRCS}; do rm -f ${LIBKERN}/$$i; done
    137 .if defined(KMSRCS) && !empty(KMSRCS)
    138 	for i in ${KMSRCS}; do rm -f ${LIBKERN}/arch/${ARCHSUBDIR}/$$i; done
    139 .endif
    140 
    141 CTAGS?=		ctags
    142 
    143 realall: tags
    144 tags: ${SRCS}
    145 	${CTAGS} -w ${.ALLSRC:M*.c}
    146 	egrep "^ENTRY(.*)|^FUNC(.*)|^SYSCALL(.*)" /dev/null ${.ALLSRC:M*.S} | \
    147 	    sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
    148 	    >> ${.TARGET}; sort -o ${.TARGET} ${.TARGET}
    149 
    150 FILES=		tags
    151 FILESNAME=	libc.tags
    152 FILESDIR=	/var/db
    153 
    154 .include <bsd.lib.mk>
    155 
    156 # workaround for I18N stuffs: build singlebyte setlocale() for libc.a,
    157 # multibyte for libc.so.  the quirk should be removed when we support
    158 # dlopen() from within statically linked binaries.
    159 CPICFLAGS+=	-D_I18N_DYNAMIC
    160