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