Makefile revision 1.155       1 #	$NetBSD: Makefile,v 1.155 2013/04/25 15:39:26 matt 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 "Makefile.inc"
     21 
     22 LIB=		c
     23 CPPFLAGS+=	-I${.CURDIR}/include -I${.CURDIR}
     24 
     25 LIBCDIR=	${.CURDIR}
     26 
     27 .if exists (${ARCHDIR}/Makefile.inc)
     28 .PATH:	${ARCHDIR}
     29 .include "${ARCHDIR}/Makefile.inc"
     30 .endif
     31 
     32 .if exists (${ARCHDIR}/genassym.cf)
     33 DPSRCS+=	assym.h
     34 CLEANFILES+=	assym.h assym.h.tmp
     35 
     36 assym.h: ${ARCHDIR}/genassym.cf
     37 	${_MKTARGET_CREATE}
     38 	${TOOL_GENASSYM} -- ${CC} ${CFLAGS} \
     39 		${CPPFLAGS} ${CPPFLAGS.assym.h} ${PROF} \
     40 		< ${ARCHDIR}/genassym.cf > assym.h.tmp && \
     41 	mv -f assym.h.tmp assym.h
     42 .endif
     43 
     44 # The following controls how to build compatibility code for old NetBSD
     45 # binaries. If BUILD_LEGACY is yes, then we build a separate library; otherwise
     46 # we include the code in libc.
     47 .if empty(MACHINE_ARCH:Mearm*)
     48 BUILD_LEGACY?= no
     49 .if "${BUILD_LEGACY}" == "yes"
     50 SUBDIR=compat
     51 .include <bsd.subdir.mk>
     52 .else
     53 COMPATDIR=${.CURDIR}/compat
     54 .include "${.CURDIR}/compat/Makefile.inc"
     55 # Marker for compat code that can't be easily isolated
     56 CPPFLAGS+=	-D__BUILD_LEGACY
     57 .endif
     58 .else # XXX temp
     59 COMPATDIR=${.CURDIR}/compat
     60 .PATH: ${COMPATDIR}/sys
     61 SRCS+=	compat___lwp_park50.c
     62 MAN+=	getdirentries.3
     63 CPPFLAGS+=	-D__BUILD_LEGACY
     64 CPPFLAGS+=	-I${NETBSDSRCDIR}/sys
     65 .endif
     66 
     67 .include "${.CURDIR}/../../common/lib/libc/Makefile.inc"
     68 .include "${.CURDIR}/atomic/Makefile.inc"
     69 .include "${.CURDIR}/cdb/Makefile.inc"
     70 .include "${.CURDIR}/db/Makefile.inc"
     71 .include "${.CURDIR}/citrus/Makefile.inc"
     72 .include "${.CURDIR}/compat-43/Makefile.inc"
     73 .include "${.CURDIR}/dlfcn/Makefile.inc"
     74 .include "${.CURDIR}/gdtoa/Makefile.inc"
     75 .include "${.CURDIR}/gen/Makefile.inc"
     76 .include "${.CURDIR}/gmon/Makefile.inc"
     77 .include "${.CURDIR}/hash/Makefile.inc"
     78 .include "${.CURDIR}/iconv/Makefile.inc"
     79 .include "${.CURDIR}/inet/Makefile.inc"
     80 .include "${.CURDIR}/isc/Makefile.inc"
     81 .include "${.CURDIR}/locale/Makefile.inc"
     82 .include "${.CURDIR}/md/Makefile.inc"
     83 .include "${.CURDIR}/misc/Makefile.inc"
     84 .include "${.CURDIR}/net/Makefile.inc"
     85 .include "${.CURDIR}/nameser/Makefile.inc"
     86 .include "${.CURDIR}/nls/Makefile.inc"
     87 .if (${MACHINE_ARCH} != "alpha") && (${ARCHSUBDIR} != "sparc64")
     88 .include "${.CURDIR}/quad/Makefile.inc"
     89 .endif
     90 .if (${USE_LIBTRE} == "yes")
     91 .include "${NETBSDSRCDIR}/external/bsd/tre/Makefile.inc"
     92 .else
     93 .include "${.CURDIR}/regex/Makefile.inc"
     94 .endif
     95 .include "${.CURDIR}/resolv/Makefile.inc"
     96 .include "${.CURDIR}/rpc/Makefile.inc"
     97 .include "${.CURDIR}/ssp/Makefile.inc"
     98 .include "${.CURDIR}/stdio/Makefile.inc"
     99 .include "${.CURDIR}/stdlib/Makefile.inc"
    100 .include "${.CURDIR}/string/Makefile.inc"
    101 .include "${.CURDIR}/termios/Makefile.inc"
    102 .include "${.CURDIR}/thread-stub/Makefile.inc"
    103 .include "${.CURDIR}/time/Makefile.inc"
    104 .include "${.CURDIR}/tls/Makefile.inc"
    105 .include "${.CURDIR}/sys/Makefile.inc"
    106 .include "${.CURDIR}/uuid/Makefile.inc"
    107 .if (${MKYP} != "no")
    108 .include "${.CURDIR}/yp/Makefile.inc"
    109 .endif
    110 
    111 # Remove from SRCS the .c files for any .S files added by the MD makefiles,
    112 # also remove from SRCS the .c files for the .S and .c files in NO_SRCS.
    113 # Add the .c file for .S files (in both variables) to LSRCS so that the
    114 # 'normal' .c file for assembly files is used for the lint librray.
    115 #
    116 # Usage:
    117 # Add .S files to NO_SRSC when another .S file provides the entry points.
    118 # Add .c files to NO_SRSC when another .c file provides the entry points.
    119 # (lint is run on all .c files in SRCS)
    120 
    121 .for check_file in ${SRCS:M*.S} ${NO_SRCS}
    122 unwanted_file := ${SRCS:M${check_file:.S=.c}}
    123 .if "${unwanted_file}" != ""
    124 SRCS := ${SRCS:N${unwanted_file}}
    125 .if "${unwanted_file}" != "${check_file}"
    126 LSRCS := ${LSRCS} ${unwanted_file}
    127 .endif
    128 .endif
    129 .endfor
    130 
    131 NLS=	C.msg Pig.msg ca.msg cs.msg de.msg es.msg fi.msg fr.msg nl.msg \
    132 	no.msg pl.msg sk.msg sv.msg
    133 
    134 realall: tags
    135 tags: ${SRCS}
    136 	${_MKTARGET_CREATE}
    137 	-${TOOL_CTAGS} -w ${.ALLSRC:M*.c}
    138 	-egrep "^ENTRY(.*)|^FUNC(.*)|^SYSCALL(.*)" /dev/null ${.ALLSRC:M*.S} | \
    139 	    sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
    140 	    >> ${.TARGET}; sort -o ${.TARGET} ${.TARGET}
    141 
    142 FILES=		tags
    143 FILESNAME=	libc.tags
    144 FILESDIR=	/var/db
    145 
    146 
    147 # workaround for I18N stuffs: build singlebyte setlocale() for libc.a,
    148 # multibyte for libc.so.  the quirk should be removed when we support
    149 # dlopen() from within statically linked binaries.
    150 CSHLIBFLAGS+=	-D_I18N_DYNAMIC
    151 
    152 .include <bsd.lib.mk>
    153 
    154 # force the dynamic linker to initialize libc first
    155 SHLIB_SHFLAGS+=	-Wl,-z,initfirst
    156