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