13eb1a62eSJoseph Koshy# $FreeBSD$ 2edbef29bSKai Wang.include <bsd.own.mk> 3edbef29bSKai Wang 4edbef29bSKai WangTOP= ${.CURDIR}/../../contrib/elftoolchain 5edbef29bSKai WangSRCDIR= ${TOP}/libelf 6edbef29bSKai Wang 7edbef29bSKai Wang.PATH: ${SRCDIR} 83eb1a62eSJoseph Koshy 93eb1a62eSJoseph KoshyLIB= elf 103eb1a62eSJoseph Koshy 11edbef29bSKai WangSRCS= elf.c \ 12edbef29bSKai Wang elf_begin.c \ 133eb1a62eSJoseph Koshy elf_cntl.c \ 143eb1a62eSJoseph Koshy elf_end.c elf_errmsg.c elf_errno.c \ 153eb1a62eSJoseph Koshy elf_data.c \ 163eb1a62eSJoseph Koshy elf_fill.c \ 173eb1a62eSJoseph Koshy elf_flag.c \ 183eb1a62eSJoseph Koshy elf_getarhdr.c \ 193eb1a62eSJoseph Koshy elf_getarsym.c \ 203eb1a62eSJoseph Koshy elf_getbase.c \ 213eb1a62eSJoseph Koshy elf_getident.c \ 223eb1a62eSJoseph Koshy elf_hash.c \ 233eb1a62eSJoseph Koshy elf_kind.c \ 243eb1a62eSJoseph Koshy elf_memory.c \ 253eb1a62eSJoseph Koshy elf_next.c \ 26edbef29bSKai Wang elf_open.c \ 273eb1a62eSJoseph Koshy elf_rand.c \ 283eb1a62eSJoseph Koshy elf_rawfile.c \ 29f6c0f35eSJoseph Koshy elf_phnum.c \ 303eb1a62eSJoseph Koshy elf_shnum.c \ 313eb1a62eSJoseph Koshy elf_shstrndx.c \ 323eb1a62eSJoseph Koshy elf_scn.c \ 333eb1a62eSJoseph Koshy elf_strptr.c \ 343eb1a62eSJoseph Koshy elf_update.c \ 353eb1a62eSJoseph Koshy elf_version.c \ 362dacb27eSJoseph Koshy gelf_cap.c \ 373eb1a62eSJoseph Koshy gelf_checksum.c \ 383eb1a62eSJoseph Koshy gelf_dyn.c \ 393eb1a62eSJoseph Koshy gelf_ehdr.c \ 402dacb27eSJoseph Koshy gelf_getclass.c \ 412dacb27eSJoseph Koshy gelf_fsize.c \ 422dacb27eSJoseph Koshy gelf_move.c \ 433eb1a62eSJoseph Koshy gelf_phdr.c \ 443eb1a62eSJoseph Koshy gelf_rel.c \ 453eb1a62eSJoseph Koshy gelf_rela.c \ 463eb1a62eSJoseph Koshy gelf_shdr.c \ 473eb1a62eSJoseph Koshy gelf_sym.c \ 482dacb27eSJoseph Koshy gelf_syminfo.c \ 493eb1a62eSJoseph Koshy gelf_symshndx.c \ 503eb1a62eSJoseph Koshy gelf_xlate.c \ 513eb1a62eSJoseph Koshy libelf_align.c \ 523eb1a62eSJoseph Koshy libelf_allocate.c \ 533eb1a62eSJoseph Koshy libelf_ar.c \ 54d961c5b4SKai Wang libelf_ar_util.c \ 553eb1a62eSJoseph Koshy libelf_checksum.c \ 563eb1a62eSJoseph Koshy libelf_data.c \ 573eb1a62eSJoseph Koshy libelf_ehdr.c \ 58f6c0f35eSJoseph Koshy libelf_extended.c \ 59edbef29bSKai Wang libelf_memory.c \ 60edbef29bSKai Wang libelf_open.c \ 613eb1a62eSJoseph Koshy libelf_phdr.c \ 623eb1a62eSJoseph Koshy libelf_shdr.c \ 639167cd63SJoseph Koshy libelf_xlate.c \ 649167cd63SJoseph Koshy ${GENSRCS} 653eb1a62eSJoseph Koshy 66edbef29bSKai WangINCS= libelf.h gelf.h 67ec280fdbSAndrew Turner 68*6eabfa96SKai Wang# 69*6eabfa96SKai Wang# We need to link against the correct version of these files. One 70*6eabfa96SKai Wang# solution is to include ../../sys in the include path. This causes 71*6eabfa96SKai Wang# problems when a header file in sys depends on a file in another 72*6eabfa96SKai Wang# part of the tree, e.g. a machine dependent header. 73*6eabfa96SKai Wang# 74*6eabfa96SKai WangSRCS+= sys/elf32.h sys/elf64.h sys/elf_common.h 75*6eabfa96SKai Wang 7673eee246SRuslan ErmilovGENSRCS= libelf_fsize.c libelf_msize.c libelf_convert.c 7773eee246SRuslan ErmilovCLEANFILES= ${GENSRCS} 78*6eabfa96SKai WangCLEANDIRS= sys 797c4a6907SKai WangCFLAGS+= -I. -I${SRCDIR} -I${TOP}/common 803eb1a62eSJoseph Koshy 81*6eabfa96SKai Wangsys/elf32.h sys/elf64.h sys/elf_common.h: ${.CURDIR}/../../sys/${.TARGET} 82*6eabfa96SKai Wang mkdir -p ${.OBJDIR}/sys 83*6eabfa96SKai Wang ln -sf ${.CURDIR}/../../sys/${.TARGET} ${.TARGET} 84*6eabfa96SKai Wang 853eb1a62eSJoseph KoshySHLIB_MAJOR= 1 863eb1a62eSJoseph Koshy 873eb1a62eSJoseph KoshyMAN= elf.3 \ 883eb1a62eSJoseph Koshy elf_begin.3 \ 893eb1a62eSJoseph Koshy elf_cntl.3 \ 9086f5401bSKai Wang elf_end.3 \ 9186f5401bSKai Wang elf_errmsg.3 \ 923eb1a62eSJoseph Koshy elf_fill.3 \ 933eb1a62eSJoseph Koshy elf_flagdata.3 \ 943eb1a62eSJoseph Koshy elf_getarhdr.3 \ 953eb1a62eSJoseph Koshy elf_getarsym.3 \ 963eb1a62eSJoseph Koshy elf_getbase.3 \ 973eb1a62eSJoseph Koshy elf_getdata.3 \ 983eb1a62eSJoseph Koshy elf_getident.3 \ 993eb1a62eSJoseph Koshy elf_getscn.3 \ 10086f5401bSKai Wang elf_getphdrnum.3 \ 101f6c0f35eSJoseph Koshy elf_getphnum.3 \ 10286f5401bSKai Wang elf_getshdrnum.3 \ 1033eb1a62eSJoseph Koshy elf_getshnum.3 \ 10486f5401bSKai Wang elf_getshdrstrndx.3 \ 1053eb1a62eSJoseph Koshy elf_getshstrndx.3 \ 1063eb1a62eSJoseph Koshy elf_hash.3 \ 1073eb1a62eSJoseph Koshy elf_kind.3 \ 1083eb1a62eSJoseph Koshy elf_memory.3 \ 1093eb1a62eSJoseph Koshy elf_next.3 \ 110edbef29bSKai Wang elf_open.3 \ 1113eb1a62eSJoseph Koshy elf_rawfile.3 \ 1123eb1a62eSJoseph Koshy elf_rand.3 \ 1133eb1a62eSJoseph Koshy elf_strptr.3 \ 1143eb1a62eSJoseph Koshy elf_update.3 \ 1153eb1a62eSJoseph Koshy elf_version.3 \ 1163eb1a62eSJoseph Koshy gelf.3 \ 1173eb1a62eSJoseph Koshy gelf_checksum.3 \ 1183eb1a62eSJoseph Koshy gelf_fsize.3 \ 1193eb1a62eSJoseph Koshy gelf_getcap.3 \ 1203eb1a62eSJoseph Koshy gelf_getclass.3 \ 1213eb1a62eSJoseph Koshy gelf_getdyn.3 \ 1223eb1a62eSJoseph Koshy gelf_getehdr.3 \ 1233eb1a62eSJoseph Koshy gelf_getmove.3 \ 1243eb1a62eSJoseph Koshy gelf_getphdr.3 \ 1253eb1a62eSJoseph Koshy gelf_getrel.3 \ 1263eb1a62eSJoseph Koshy gelf_getrela.3 \ 1273eb1a62eSJoseph Koshy gelf_getshdr.3 \ 1283eb1a62eSJoseph Koshy gelf_getsym.3 \ 1293eb1a62eSJoseph Koshy gelf_getsyminfo.3 \ 1303eb1a62eSJoseph Koshy gelf_getsymshndx.3 \ 1313eb1a62eSJoseph Koshy gelf_newehdr.3 \ 1323eb1a62eSJoseph Koshy gelf_newphdr.3 \ 1333eb1a62eSJoseph Koshy gelf_update_ehdr.3 \ 1343eb1a62eSJoseph Koshy gelf_xlatetof.3 1353eb1a62eSJoseph Koshy 1363eb1a62eSJoseph KoshyMLINKS+= \ 1373eb1a62eSJoseph Koshy elf_errmsg.3 elf_errno.3 \ 138edbef29bSKai Wang elf_flagdata.3 elf_flagarhdr.3 \ 1393eb1a62eSJoseph Koshy elf_flagdata.3 elf_flagehdr.3 \ 1403eb1a62eSJoseph Koshy elf_flagdata.3 elf_flagelf.3 \ 1413eb1a62eSJoseph Koshy elf_flagdata.3 elf_flagphdr.3 \ 1423eb1a62eSJoseph Koshy elf_flagdata.3 elf_flagscn.3 \ 1433eb1a62eSJoseph Koshy elf_flagdata.3 elf_flagshdr.3 \ 1443eb1a62eSJoseph Koshy elf_getdata.3 elf_newdata.3 \ 1453eb1a62eSJoseph Koshy elf_getdata.3 elf_rawdata.3 \ 1463eb1a62eSJoseph Koshy elf_getscn.3 elf_ndxscn.3 \ 1473eb1a62eSJoseph Koshy elf_getscn.3 elf_newscn.3 \ 1483eb1a62eSJoseph Koshy elf_getscn.3 elf_nextscn.3 \ 1493eb1a62eSJoseph Koshy elf_getshstrndx.3 elf_setshstrndx.3 \ 150edbef29bSKai Wang elf_open.3 elf_openmemory.3 \ 1513eb1a62eSJoseph Koshy gelf_getcap.3 gelf_update_cap.3 \ 1523eb1a62eSJoseph Koshy gelf_getdyn.3 gelf_update_dyn.3 \ 1533eb1a62eSJoseph Koshy gelf_getmove.3 gelf_update_move.3 \ 1543eb1a62eSJoseph Koshy gelf_getrel.3 gelf_update_rel.3 \ 1553eb1a62eSJoseph Koshy gelf_getrela.3 gelf_update_rela.3 \ 1563eb1a62eSJoseph Koshy gelf_getsym.3 gelf_update_sym.3 \ 1573eb1a62eSJoseph Koshy gelf_getsyminfo.3 gelf_update_syminfo.3 \ 1583eb1a62eSJoseph Koshy gelf_getsymshndx.3 gelf_update_symshndx.3 \ 1593eb1a62eSJoseph Koshy gelf_update_ehdr.3 gelf_update_phdr.3 \ 1603eb1a62eSJoseph Koshy gelf_update_ehdr.3 gelf_update_shdr.3 \ 1613eb1a62eSJoseph Koshy gelf_xlatetof.3 gelf_xlatetom.3 1623eb1a62eSJoseph Koshy 1633eb1a62eSJoseph Koshy.for E in 32 64 1643eb1a62eSJoseph KoshyMLINKS+= \ 1653eb1a62eSJoseph Koshy gelf_checksum.3 elf${E}_checksum.3 \ 1663eb1a62eSJoseph Koshy gelf_fsize.3 elf${E}_fsize.3 \ 1673eb1a62eSJoseph Koshy gelf_getehdr.3 elf${E}_getehdr.3 \ 1683eb1a62eSJoseph Koshy gelf_getphdr.3 elf${E}_getphdr.3 \ 1693eb1a62eSJoseph Koshy gelf_getshdr.3 elf${E}_getshdr.3 \ 1703eb1a62eSJoseph Koshy gelf_newehdr.3 elf${E}_newehdr.3 \ 1713eb1a62eSJoseph Koshy gelf_newphdr.3 elf${E}_newphdr.3 \ 1723eb1a62eSJoseph Koshy gelf_xlatetof.3 elf${E}_xlatetof.3 \ 1733eb1a62eSJoseph Koshy gelf_xlatetof.3 elf${E}_xlatetom.3 1743eb1a62eSJoseph Koshy.endfor 1753eb1a62eSJoseph Koshy 176edbef29bSKai WangVERSION_MAP= ${SRCDIR}/Version.map 1773eb1a62eSJoseph Koshy 1783eb1a62eSJoseph Koshylibelf_convert.c: elf_types.m4 libelf_convert.m4 1793eb1a62eSJoseph Koshylibelf_fsize.c: elf_types.m4 libelf_fsize.m4 1803eb1a62eSJoseph Koshylibelf_msize.c: elf_types.m4 libelf_msize.m4 1813eb1a62eSJoseph Koshy 1823eb1a62eSJoseph Koshy.include <bsd.lib.mk> 1833eb1a62eSJoseph Koshy 1849167cd63SJoseph Koshy# Keep the .SUFFIXES line after the include of bsd.lib.mk 1853eb1a62eSJoseph Koshy.SUFFIXES: .m4 .c 1863eb1a62eSJoseph Koshy.m4.c: 187edbef29bSKai Wang m4 -D SRCDIR=${SRCDIR} ${M4FLAGS} ${.IMPSRC} > ${.TARGET} 188edbef29bSKai Wang 189