Home | History | Annotate | Line # | Download | only in libc
Makefile revision 1.125
      1 #	$NetBSD: Makefile,v 1.125 2005/12/20 19:31:47 christos 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 USE_SHLIBDIR=	yes
     21 
     22 .include <bsd.own.mk>
     23 
     24 WARNS=4
     25 LIB=		c
     26 CPPFLAGS+=	-D_LIBC -DLIBC_SCCS -DSYSLIBC_SCCS -D_REENTRANT
     27 CPPFLAGS+=	-I${.CURDIR}/include -I${.CURDIR}
     28 
     29 .if (${USE_HESIOD} != "no")
     30 CPPFLAGS+=	-DHESIOD
     31 .endif
     32 
     33 .if (${USE_INET6} != "no")
     34 CPPFLAGS+=	-DINET6
     35 .endif
     36 
     37 CPPFLAGS+=	-DNLS
     38 
     39 .if (${USE_YP} != "no")
     40 CPPFLAGS+=	-DYP
     41 .endif
     42 
     43 .if ${MACHINE_ARCH} == "i386"
     44 # Set lint to exit on warnings
     45 LINTFLAGS+=	-w
     46 .endif
     47 # ignore 'empty translation unit' warnings.
     48 LINTFLAGS+=	-X 272
     49 
     50 .if exists(${.CURDIR}/arch/${MACHINE_ARCH})
     51 ARCHSUBDIR=	${MACHINE_ARCH}
     52 .elif exists(${.CURDIR}/arch/${MACHINE_CPU}) 
     53 ARCHSUBDIR=	${MACHINE_CPU}
     54 .else
     55 .BEGIN:
     56 	@echo no ARCHSUBDIR for ${MACHINE_ARCH} nor ${MACHINE_CPU}
     57 	@false
     58 .endif
     59 
     60 ARCHDIR=	${.CURDIR}/arch/${ARCHSUBDIR}
     61 AFLAGS+=	-I${ARCHDIR}
     62 .if defined(DESTDIR)
     63 AFLAGS+=	-nostdinc -idirafter ${DESTDIR}/usr/include
     64 .endif
     65 CLEANFILES+=	tags
     66 
     67 # Don't try to lint the C library against itself when creating llib-lc.ln
     68 LLIBS=
     69 
     70 INCSDIR=	/usr/include
     71 
     72 .if exists (${ARCHDIR}/Makefile.inc)
     73 .PATH:	${ARCHDIR}
     74 .include "${ARCHDIR}/Makefile.inc"
     75 .endif
     76 .if exists (${ARCHDIR}/genassym.cf)
     77 DPSRCS+=	assym.h
     78 CLEANFILES+=	assym.h assym.h.tmp
     79 
     80 assym.h: ${ARCHDIR}/genassym.cf
     81 	${_MKTARGET_CREATE}
     82 	${TOOL_GENASSYM} -- ${CC} ${CFLAGS} \
     83 		${CPPFLAGS} ${CPPFLAGS.assym.h} ${PROF} \
     84 		< ${ARCHDIR}/genassym.cf > assym.h.tmp && \
     85 	mv -f assym.h.tmp assym.h
     86 .endif
     87 
     88 .include "${.CURDIR}/../../common/lib/libc/Makefile.inc"
     89 .include "${.CURDIR}/db/Makefile.inc"
     90 .include "${.CURDIR}/citrus/Makefile.inc"
     91 .include "${.CURDIR}/compat-43/Makefile.inc"
     92 .include "${.CURDIR}/compat/Makefile.inc"
     93 .include "${.CURDIR}/dlfcn/Makefile.inc"
     94 .include "${.CURDIR}/gen/Makefile.inc"
     95 .include "${.CURDIR}/gmon/Makefile.inc"
     96 .include "${.CURDIR}/hash/Makefile.inc"
     97 .include "${.CURDIR}/iconv/Makefile.inc"
     98 .include "${.CURDIR}/inet/Makefile.inc"
     99 .include "${.CURDIR}/isc/Makefile.inc"
    100 .include "${.CURDIR}/locale/Makefile.inc"
    101 .include "${.CURDIR}/md/Makefile.inc"
    102 .include "${.CURDIR}/net/Makefile.inc"
    103 .include "${.CURDIR}/nameser/Makefile.inc"
    104 .include "${.CURDIR}/nls/Makefile.inc"
    105 .if (${MACHINE_ARCH} != "alpha") && (${MACHINE_ARCH} != "sparc64")
    106 .include "${.CURDIR}/quad/Makefile.inc"
    107 .endif
    108 .include "${.CURDIR}/regex/Makefile.inc"
    109 .include "${.CURDIR}/resolv/Makefile.inc"
    110 .include "${.CURDIR}/rpc/Makefile.inc"
    111 .include "${.CURDIR}/stdio/Makefile.inc"
    112 .include "${.CURDIR}/stdlib/Makefile.inc"
    113 .include "${.CURDIR}/string/Makefile.inc"
    114 .include "${.CURDIR}/termios/Makefile.inc"
    115 .include "${.CURDIR}/thread-stub/Makefile.inc"
    116 .include "${.CURDIR}/time/Makefile.inc"
    117 .include "${.CURDIR}/sys/Makefile.inc"
    118 .include "${.CURDIR}/uuid/Makefile.inc"
    119 .if (${MKYP} != "no")
    120 .include "${.CURDIR}/yp/Makefile.inc"
    121 .endif
    122 
    123 NLS=	C.msg Pig.msg ca.msg cs.msg de.msg es.msg fi.msg fr.msg nl.msg \
    124 	no.msg pl.msg sk.msg sv.msg
    125 
    126 LIBKERN=	${NETBSDSRCDIR}/sys/lib/libkern
    127 
    128 KSRCS=	bcopy.c bcmp.c bswap16.c bswap32.c bswap64.c bzero.c ffs.c \
    129 	strcat.c strchr.c strcmp.c strcpy.c strlen.c \
    130 	strncmp.c strncpy.c strrchr.c \
    131 	htonl.c htons.c ntohl.c ntohs.c md5c.c \
    132 	memchr.c memcmp.c memcpy.c memmove.c memset.c \
    133 	index.c rindex.c
    134 .if (${MACHINE_ARCH} != "alpha") && (${MACHINE_ARCH} != "sparc64")
    135 KSRCS+=	adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \
    136 	lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \
    137 	subdi3.c  ucmpdi2.c udivdi3.c umoddi3.c xordi3.c
    138 KINCLUDES+=	quad/quad.h
    139 .endif
    140 
    141 copy-to-libkern:	copy-to-libkern-machind copy-to-libkern-machdep
    142 
    143 copy-to-libkern-machind: ${KSRCS}
    144 	cp -p ${.ALLSRC} ${LIBKERN}
    145 .if defined(KINCLUDES) && !empty(KINCLUDES)
    146 	(cd ${.CURDIR} ; cp -p ${KINCLUDES} ${LIBKERN})
    147 .endif
    148 
    149 copy-to-libkern-machdep: ${KMSRCS}
    150 .if defined(KMSRCS) && !empty(KMSRCS)
    151 	cp -p ${.ALLSRC} ${LIBKERN}/arch/${ARCHSUBDIR}
    152 .endif
    153 .if defined(KMINCLUDES) && !empty(KMINCLUDES)
    154 	(cd ${.CURDIR} ; cp -p ${KMINCLUDES} ${LIBKERN}/arch/${ARCHSUBDIR})
    155 .endif
    156 
    157 rm-from-libkern:
    158 	for i in ${KSRCS}; do rm -f ${LIBKERN}/$$i; done
    159 .if defined(KMSRCS) && !empty(KMSRCS)
    160 	for i in ${KMSRCS}; do rm -f ${LIBKERN}/arch/${ARCHSUBDIR}/$$i; done
    161 .endif
    162 
    163 realall: tags
    164 tags: ${SRCS}
    165 	${_MKTARGET_CREATE}
    166 	-${TOOL_CTAGS} -w ${.ALLSRC:M*.c}
    167 	-egrep "^ENTRY(.*)|^FUNC(.*)|^SYSCALL(.*)" /dev/null ${.ALLSRC:M*.S} | \
    168 	    sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
    169 	    >> ${.TARGET}; sort -o ${.TARGET} ${.TARGET}
    170 
    171 FILES=		tags
    172 FILESNAME=	libc.tags
    173 FILESDIR=	/var/db
    174 
    175 
    176 # workaround for I18N stuffs: build singlebyte setlocale() for libc.a,
    177 # multibyte for libc.so.  the quirk should be removed when we support
    178 # dlopen() from within statically linked binaries.
    179 CSHLIBFLAGS+=	-D_I18N_DYNAMIC
    180 
    181 .include <bsd.lib.mk>
    182