1ad30f8e7SGabor Kovesdan# $NetBSD: Makefile.part,v 1.6 2008/10/25 22:35:36 apb Exp $ 2ad30f8e7SGabor Kovesdan 3ad30f8e7SGabor KovesdanPARTFILE?= ${.CURDIR}/${CODE}.part 4ad30f8e7SGabor KovesdanALIASFILE?= ${.CURDIR}/${CODE}.alias 5ad30f8e7SGabor Kovesdan.if !defined(NO_SEP) 6ad30f8e7SGabor KovesdanSEP?= - 7ad30f8e7SGabor Kovesdan.endif 8ad30f8e7SGabor Kovesdan.if exists(${PARTFILE}) 9ad30f8e7SGabor KovesdanPART!= sed '/^\#/d;/^ *$$/d' ${PARTFILE} 10ad30f8e7SGabor Kovesdan.endif 11ad30f8e7SGabor Kovesdan.if !defined(NO_EPREFIX) 12ad30f8e7SGabor KovesdanCODESETS?= ${PART:C/^/${CODE}${SEP}/} 13ad30f8e7SGabor KovesdanEPREFIX?= ${CODE}${SEP} 14ad30f8e7SGabor Kovesdan.else 15ad30f8e7SGabor KovesdanCODESETS?= ${PART} 16ad30f8e7SGabor KovesdanEPREFIX?= 17ad30f8e7SGabor Kovesdan.endif 18ad30f8e7SGabor KovesdanESUBDIR?= ${CODE} 19ad30f8e7SGabor KovesdanESDB?= ${CODESETS:C/$/.esdb/:S/:/@/} 20ad30f8e7SGabor Kovesdan 21ad30f8e7SGabor KovesdanFILES+= ${ESDB} 22ad30f8e7SGabor KovesdanFILESDIR= ${ESDBDIR}/${ESUBDIR} 23ad30f8e7SGabor Kovesdan 24ad30f8e7SGabor Kovesdan.SUFFIXES: .src .esdb 25ad30f8e7SGabor Kovesdan 26ad30f8e7SGabor Kovesdan.src.esdb: 27ad30f8e7SGabor Kovesdan ${MKESDB} -o $@ $> 28ad30f8e7SGabor Kovesdan 29ad30f8e7SGabor KovesdanCLEANFILES+= ${ESDB} esdb.dir.${ESUBDIR} esdb.alias.${ESUBDIR} 30ad30f8e7SGabor Kovesdan 31ad30f8e7SGabor Kovesdan# ---------------------------------------------------------------------- 32ad30f8e7SGabor Kovesdan# esdb.dir 33ad30f8e7SGabor Kovesdan# 34ad30f8e7SGabor Kovesdanesdb.dir.${ESUBDIR}: ${PARTFILE} 35ad30f8e7SGabor Kovesdan echo "# ${CODE}" >${.TARGET} 36ad30f8e7SGabor Kovesdan.for i in ${PART} 37ad30f8e7SGabor Kovesdan printf "%-32s%s\n" "${EPREFIX}$i" \ 38ad30f8e7SGabor Kovesdan "${ESUBDIR}/${EPREFIX}${i:S/:/@/}.esdb" >>${.TARGET} 39ad30f8e7SGabor Kovesdan.endfor 40ad30f8e7SGabor Kovesdan echo >>${.TARGET} 41ad30f8e7SGabor Kovesdan 42ad30f8e7SGabor Kovesdan# ---------------------------------------------------------------------- 43ad30f8e7SGabor Kovesdan# esdb.alias 44ad30f8e7SGabor Kovesdan# 45ad30f8e7SGabor Kovesdan.for i in ${PART:S/:/@/} 46ad30f8e7SGabor Kovesdan${CODE}_$i_aliases!= echo \ 47ad30f8e7SGabor Kovesdan `sed \ 48ad30f8e7SGabor Kovesdan '/^\#/d;/^ *$$/d;/^${i:S/@/:/}[ ]/!d;s/^[^ ]*[ ]*//' \ 49ad30f8e7SGabor Kovesdan ${ALIASFILE}` 50ad30f8e7SGabor Kovesdan.endfor 51ad30f8e7SGabor Kovesdanesdb.alias.${ESUBDIR}: ${PARTFILE} ${ALIASFILE} 52ad30f8e7SGabor Kovesdan echo "# ${CODE}" >${.TARGET} 53ad30f8e7SGabor Kovesdan.for i in ${PART:S/:/@/} 54ad30f8e7SGabor Kovesdan.for j in ${${CODE}_$i_aliases} 55ad30f8e7SGabor Kovesdan printf "%-32s%s\n" "$j" "${EPREFIX}${i:S/@/:/}" >>${.TARGET} 56ad30f8e7SGabor Kovesdan.endfor 57ad30f8e7SGabor Kovesdan.endfor 58ad30f8e7SGabor Kovesdan echo >>${.TARGET} 59ad30f8e7SGabor Kovesdan 605e8745ccSBryan Drewery.if !defined(_SKIP_BUILD) 6173465ff7SBryan Dreweryall: esdb.dir.${ESUBDIR} esdb.alias.${ESUBDIR} codesets 625e8745ccSBryan Drewery.endif 63ad30f8e7SGabor Kovesdancodesets: ${ESDB} 64ad30f8e7SGabor Kovesdan 65ad30f8e7SGabor Kovesdan.if !defined(NO_PREPROC) 66ad30f8e7SGabor Kovesdan.for i in ${PART} 67*6ea8e4deSBryan Drewery.if !exists(${.CURDIR}/${EPREFIX}${i:S/:/@/}.src) 68ad30f8e7SGabor Kovesdan${EPREFIX}${i:S/:/@/}.src: ${CODE}.src 69480364a4SBryan Drewery sed ${SED_EXP:S@%%PART%%@${i}@} ${.ALLSRC} > ${.TARGET} 70480364a4SBryan Drewery @echo ${.TARGET} >>.tmpfiles 71*6ea8e4deSBryan Drewery.endif 72ad30f8e7SGabor Kovesdan.endfor 73ad30f8e7SGabor Kovesdan.endif 74ad30f8e7SGabor Kovesdan 75ad30f8e7SGabor Kovesdan.if exists(.tmpfiles) 76ad30f8e7SGabor KovesdanTMPFILES!= cat .tmpfiles 77ad30f8e7SGabor KovesdanCLEANFILES+= ${TMPFILES} .tmpfiles 78ad30f8e7SGabor Kovesdan.endif 79ad30f8e7SGabor Kovesdan 80ad30f8e7SGabor Kovesdan.include "./Makefile.inc" 81ad30f8e7SGabor Kovesdan.include <bsd.prog.mk> 82