1# $NetBSD: Makefile.inc,v 1.19 2002/11/02 07:49:57 perry Exp $ 2# 3# Configuration variables (default values are below): 4# 5# S must be set to the top of the 'sys' tree. 6# COMPATDST 7# may be set to the location of the directory where library 8# objects are to be built. Defaults to ${.OBJDIR}/lib/compat. 9# COMPAT_AS 10# may be set to 'obj' to build a object from the library's 11# object files. (Otherwise, a library will be built.) 12# Defaults to 'library'. 13# COMPATMISCMAKEFLAGS 14# Miscellaneous flags to be passed to the library's Makefile when 15# building. See library's Makefile for more details about 16# supported flags and their default values. 17 18# Default values: 19COMPATDST?= ${.OBJDIR}/lib/compat 20COMPAT_AS?= library 21COMPATDOTDIR?= ../../. 22 23COMPATDIR= ${S:S@^.@${COMPATDOTDIR}@:Q}/compat/common 24.if (${COMPAT_AS} == "obj") 25COMPATLIB= ${COMPATDST}/libcompat.o 26COMPATLIB_PROF= ${COMPATDST}/libcompat.po 27.else 28COMPATLIB= ${COMPATDST}/libcompat.a 29COMPATLIB_PROF= ${COMPATDST}/libcompat_p.a 30.endif 31 32LIBCOMPATLNBN= llib-lcompat.ln 33COMPATLIBLN= ${COMPATDST}/${LIBCOMPATLNBN} 34 35COMPATMAKE= \ 36 cd ${COMPATDST} && ${MAKE} -f ${COMPATDIR:Q}/Makefile \ 37 COMPATDIR=${COMPATDIR:Q} \ 38 CC=${CC:Q} CFLAGS=${CFLAGS:Q} \ 39 AS=${AS:Q} AFLAGS=${AFLAGS:Q} \ 40 AR=${AR:Q} NM=${NM:Q} \ 41 LORDER=${LORDER:Q} \ 42 TSORT=${TSORT:Q} \ 43 RANLIB=${RANLIB:Q} \ 44 LD=${LD:Q} LDFLAGS=${LDFLAGS:Q} \ 45 STRIP=${STRIP:Q} \ 46 MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:Q} \ 47 COMPATCPPFLAGS=${CPPFLAGS:S@^-I.@-I${COMPATDOTDIR}@g:Q} \ 48 LINTFLAGS=${KERNLINTFLAGS:Q} \ 49 ${COMPATMISCMAKEFLAGS} 50 51${COMPATLIB}: .NOTMAIN .MAKE __always_make_compatlib 52 @echo making sure the compat library is up to date... 53.if (${COMPAT_AS} == "library") 54 @${COMPATMAKE} libcompat.a 55.else 56 @${COMPATMAKE} libcompat.o 57.endif 58 59${COMPATLIB_PROF}: .NOTMAIN .MAKE __always_make_compatlib 60 @echo making sure the profiled compat library is up to date... 61.if (${COMPAT_AS} == "library") 62 @${COMPATMAKE} libcompat_p.a 63.else 64 @${COMPATMAKE} libcompat.po 65.endif 66 67${COMPATLIBLN}: .NOTMAIN .MAKE __always_make_compatlib 68 @echo making sure the compat lint library is up to date... 69 @${COMPATMAKE} ${LIBCOMPATLNBN} 70 71clean: .NOTMAIN cleancompatlib 72cleancompatlib: .NOTMAIN .MAKE __always_make_compatlib 73 @echo cleaning the compat library objects 74 @${COMPATMAKE} clean 75 76cleandir distclean: .NOTMAIN cleandircompatlib 77cleandircompatlib: .NOTMAIN .MAKE __always_make_compatlib 78 @echo cleandiring the compat library objects 79 @${COMPATMAKE} cleandir 80 81depend: .NOTMAIN dependcompatlib 82dependcompatlib: .NOTMAIN .MAKE __always_make_compatlib 83 @echo depending the compat library objects 84 @${COMPATMAKE} depend 85 86__always_make_compatlib: .NOTMAIN 87 @mkdir -p ${COMPATDST} 88 89.PHONY: __always_make_compatlib 90.PHONY: cleancompatlib cleandircompatlib dependcompatlib 91