1*ebfedea0SLionel Sambuc# $NetBSD: Makefile.rules.inc,v 1.7 2012/09/05 19:31:04 christos Exp $ 2*ebfedea0SLionel Sambuc 3*ebfedea0SLionel SambucSRCS+= ${HEIMSRCS:N*.et:N*.in:N*.asn1} 4*ebfedea0SLionel Sambuc 5*ebfedea0SLionel Sambuc.for et_src in ${HEIMSRCS:M*.et} 6*ebfedea0SLionel SambucCLEANFILES+= ${et_src:.et=.c} ${et_src:.et=.h} 7*ebfedea0SLionel SambucDPSRCS+= ${et_src:.et=.c} ${et_src:.et=.h} 8*ebfedea0SLionel SambucCOMPILE_ET_INCS+= ${et_src:.et=.h} 9*ebfedea0SLionel SambucOBJS+= ${et_src:.et=.o} 10*ebfedea0SLionel Sambuc 11*ebfedea0SLionel Sambuc${et_src:.et=.c} ${et_src:.et=.h}: ${et_src} ${TOOL_COMPILE_ET} 12*ebfedea0SLionel Sambuc ${TOOL_COMPILE_ET} ${.ALLSRC:[1]} 13*ebfedea0SLionel Sambuc 14*ebfedea0SLionel Sambuc.endfor 15*ebfedea0SLionel Sambuc 16*ebfedea0SLionel Sambuc.for src in ${HEIMSRCS:M*.asn1} 17*ebfedea0SLionel SambucASN1_FILES.${src} ?= asn1_${src:.asn1=_asn1.x} 18*ebfedea0SLionel Sambuc 19*ebfedea0SLionel Sambuc.if ${ASN1_FILES.${src}:[\#]} == 1 20*ebfedea0SLionel SambucASN1_OPTS.${src} ?= --one-code-file 21*ebfedea0SLionel Sambuc.endif 22*ebfedea0SLionel Sambuc 23*ebfedea0SLionel SambucCLEANFILES+= \ 24*ebfedea0SLionel Sambuc ${src:.asn1=_asn1_files} \ 25*ebfedea0SLionel Sambuc ${src:.asn1=_asn1-template.c} \ 26*ebfedea0SLionel Sambuc ${ASN1_FILES.${src}} \ 27*ebfedea0SLionel Sambuc ${ASN1_FILES.${src}:.x=.c} \ 28*ebfedea0SLionel Sambuc ${src:.asn1=_asn1.h} \ 29*ebfedea0SLionel Sambuc ${src:.asn1=_asn1.hx} \ 30*ebfedea0SLionel Sambuc ${src:.asn1=_asn1-priv.h} \ 31*ebfedea0SLionel Sambuc ${src:.asn1=_asn1-priv.hx} \ 32*ebfedea0SLionel Sambuc ${src:.asn1=.ts} 33*ebfedea0SLionel Sambuc 34*ebfedea0SLionel SambucASN1_INCS += ${src:.asn1=_asn1.h} 35*ebfedea0SLionel Sambuc 36*ebfedea0SLionel SambucDPSRCS += ${src:.asn1=_asn1.h} ${src:.asn1=_asn1-priv.h} 37*ebfedea0SLionel SambucOBJS += ${ASN1_FILES.${src}:.x=.o} 38*ebfedea0SLionel Sambuc 39*ebfedea0SLionel Sambuc${ASN1_FILES.${src}} ${src:.asn1=_asn1.h} ${src:.asn1=_asn1-priv.h}: \ 40*ebfedea0SLionel Sambuc ${src:.asn1=.ts} 41*ebfedea0SLionel Sambuc 42*ebfedea0SLionel Sambuc.if exists(${src:.asn1=.opt}) 43*ebfedea0SLionel Sambuc${src:.asn1=.ts}: ${src} ${src:.asn1=.opt} ${TOOL_ASN1_COMPILE} 44*ebfedea0SLionel Sambuc @touch $@ 45*ebfedea0SLionel Sambuc ${TOOL_ASN1_COMPILE} \ 46*ebfedea0SLionel Sambuc ${ASN1_OPTS.${src}} \ 47*ebfedea0SLionel Sambuc --option-file=${.ALLSRC:[2]} \ 48*ebfedea0SLionel Sambuc ${.ALLSRC:[1]} ${src:.asn1=_asn1} 49*ebfedea0SLionel Sambuc @${TOOL_SED} -E \ 50*ebfedea0SLionel Sambuc -e 's,#include <(.*)_asn1\.h>,#include <krb5/\1_asn1.h>,' \ 51*ebfedea0SLionel Sambuc 2> /dev/null < ${src:.asn1=_asn1.hx} > ${src:.asn1=_asn1.h} 52*ebfedea0SLionel Sambuc @cmp -s ${src:.asn1=_asn1-priv.hx} ${src:.asn1=_asn1-priv.h} \ 53*ebfedea0SLionel Sambuc 2> /dev/null || \ 54*ebfedea0SLionel Sambuc cp ${src:.asn1=_asn1-priv.hx} ${src:.asn1=_asn1-priv.h} 55*ebfedea0SLionel Sambuc.else 56*ebfedea0SLionel Sambuc${src:.asn1=.ts}: ${src} ${TOOL_ASN1_COMPILE} 57*ebfedea0SLionel Sambuc @touch $@ 58*ebfedea0SLionel Sambuc ${TOOL_ASN1_COMPILE} \ 59*ebfedea0SLionel Sambuc ${ASN1_OPTS.${src}} \ 60*ebfedea0SLionel Sambuc ${.ALLSRC:[1]} ${src:.asn1=_asn1} 61*ebfedea0SLionel Sambuc @${TOOL_SED} -E \ 62*ebfedea0SLionel Sambuc -e 's,#include <(.*)_asn1\.h>,#include <krb5/\1_asn1.h>,' \ 63*ebfedea0SLionel Sambuc 2> /dev/null < ${src:.asn1=_asn1.hx} > ${src:.asn1=_asn1.h} 64*ebfedea0SLionel Sambuc @cmp -s ${src:.asn1=_asn1-priv.hx} ${src:.asn1=_asn1-priv.h} \ 65*ebfedea0SLionel Sambuc 2> /dev/null || \ 66*ebfedea0SLionel Sambuc cp ${src:.asn1=_asn1-priv.hx} ${src:.asn1=_asn1-priv.h} 67*ebfedea0SLionel Sambuc.endif 68*ebfedea0SLionel Sambuc 69*ebfedea0SLionel Sambuc.if ${MKREPRO:Uno} == "yes" 70*ebfedea0SLionel SambucNORMALIZE_SRC=-e "s@${NETBSDSRCDIR}@/usr/src@g" 71*ebfedea0SLionel Sambuc.endif 72*ebfedea0SLionel Sambuc 73*ebfedea0SLionel Sambuc.for x2c in ${ASN1_FILES.${src}} 74*ebfedea0SLionel Sambuc${x2c:.x=.c}: ${x2c} 75*ebfedea0SLionel Sambuc @${TOOL_SED} ${NORMALIZE_SRC} < ${x2c} > ${x2c}.r 76*ebfedea0SLionel Sambuc @cmp -s ${x2c}.r ${x2c:.x=.c} 2> /dev/null || cp ${x2c}.r ${x2c:.x=.c} 77*ebfedea0SLionel Sambuc @rm -f ${x2c}.r 78*ebfedea0SLionel Sambuc.endfor 79*ebfedea0SLionel Sambuc 80*ebfedea0SLionel Sambuc.endfor 81*ebfedea0SLionel Sambuc 82*ebfedea0SLionel Sambuc# 83*ebfedea0SLionel Sambuc# and for slc: 84*ebfedea0SLionel Sambuc 85*ebfedea0SLionel Sambuc.for slc_src in ${HEIMSRCS:M*.in} 86*ebfedea0SLionel SambucCLEANFILES+= ${slc_src:.in=.c} ${slc_src:.in=.h} 87*ebfedea0SLionel SambucDPSRCS+= ${slc_src:.in=.c} ${slc_src:.in=.h} 88*ebfedea0SLionel SambucOBJS+= ${slc_src:.in=.o} 89*ebfedea0SLionel SambucSLC_INCS+= ${slc_src:.in=.h} 90*ebfedea0SLionel Sambuc 91*ebfedea0SLionel Sambuc${slc_src:.in=.c} ${slc_src:.in=.h}: ${slc_src} 92*ebfedea0SLionel Sambuc ${TOOL_SLC} ${.ALLSRC} 93*ebfedea0SLionel Sambuc 94*ebfedea0SLionel Sambuc.endfor 95*ebfedea0SLionel Sambuc 96*ebfedea0SLionel Sambuc# 97*ebfedea0SLionel Sambuc# And a tiny bit of logic for bsd.prog.mk: 98*ebfedea0SLionel Sambuc 99*ebfedea0SLionel Sambuc.if defined(PROG) && defined(OBJS) 100*ebfedea0SLionel SambucOBJS.${PROG} += ${OBJS} 101*ebfedea0SLionel Sambuc.endif 102*ebfedea0SLionel Sambuc 103*ebfedea0SLionel Sambuc.if defined(LIB) && exists(version-script.map) && !defined(NO_VERSION_SCRIPT) 104*ebfedea0SLionel Sambucversion-script.map: 105*ebfedea0SLionel Sambuc 106*ebfedea0SLionel SambucLDFLAGS.lib${LIB} += -Wl,--version-script=${version-script.map:P} 107*ebfedea0SLionel Sambuc.endif 108