xref: /freebsd/lib/libelf/Makefile (revision e5e23ecc470b682b0304c9f57ccb5be73ae44f84)
13eb1a62eSJoseph Koshy# $FreeBSD$
2*e5e23eccSBryan Drewery
3*e5e23eccSBryan DrewerySHLIBDIR?= /lib
4*e5e23eccSBryan Drewery
5edbef29bSKai Wang.include <bsd.own.mk>
6edbef29bSKai Wang
7edbef29bSKai WangTOP=	${.CURDIR}/../../contrib/elftoolchain
8edbef29bSKai WangSRCDIR=	${TOP}/libelf
9edbef29bSKai Wang
10edbef29bSKai Wang.PATH:	${SRCDIR}
113eb1a62eSJoseph Koshy
123eb1a62eSJoseph KoshyLIB=	elf
133eb1a62eSJoseph Koshy
14edbef29bSKai WangSRCS=	elf.c							\
15edbef29bSKai Wang	elf_begin.c						\
163eb1a62eSJoseph Koshy	elf_cntl.c						\
173eb1a62eSJoseph Koshy	elf_end.c elf_errmsg.c elf_errno.c			\
183eb1a62eSJoseph Koshy	elf_data.c						\
193eb1a62eSJoseph Koshy	elf_fill.c						\
203eb1a62eSJoseph Koshy	elf_flag.c						\
213eb1a62eSJoseph Koshy	elf_getarhdr.c						\
223eb1a62eSJoseph Koshy	elf_getarsym.c						\
233eb1a62eSJoseph Koshy	elf_getbase.c						\
243eb1a62eSJoseph Koshy	elf_getident.c						\
253eb1a62eSJoseph Koshy	elf_hash.c						\
263eb1a62eSJoseph Koshy	elf_kind.c						\
273eb1a62eSJoseph Koshy	elf_memory.c						\
283eb1a62eSJoseph Koshy	elf_next.c						\
29edbef29bSKai Wang	elf_open.c						\
303eb1a62eSJoseph Koshy	elf_rand.c						\
313eb1a62eSJoseph Koshy	elf_rawfile.c						\
32f6c0f35eSJoseph Koshy	elf_phnum.c						\
333eb1a62eSJoseph Koshy	elf_shnum.c						\
343eb1a62eSJoseph Koshy	elf_shstrndx.c						\
353eb1a62eSJoseph Koshy	elf_scn.c						\
363eb1a62eSJoseph Koshy	elf_strptr.c						\
373eb1a62eSJoseph Koshy	elf_update.c						\
383eb1a62eSJoseph Koshy	elf_version.c						\
392dacb27eSJoseph Koshy	gelf_cap.c						\
403eb1a62eSJoseph Koshy	gelf_checksum.c						\
413eb1a62eSJoseph Koshy	gelf_dyn.c						\
423eb1a62eSJoseph Koshy	gelf_ehdr.c						\
432dacb27eSJoseph Koshy	gelf_getclass.c						\
442dacb27eSJoseph Koshy	gelf_fsize.c						\
452dacb27eSJoseph Koshy	gelf_move.c						\
463eb1a62eSJoseph Koshy	gelf_phdr.c						\
473eb1a62eSJoseph Koshy	gelf_rel.c						\
483eb1a62eSJoseph Koshy	gelf_rela.c						\
493eb1a62eSJoseph Koshy	gelf_shdr.c						\
503eb1a62eSJoseph Koshy	gelf_sym.c						\
512dacb27eSJoseph Koshy	gelf_syminfo.c						\
523eb1a62eSJoseph Koshy	gelf_symshndx.c						\
533eb1a62eSJoseph Koshy	gelf_xlate.c						\
543eb1a62eSJoseph Koshy	libelf_align.c						\
553eb1a62eSJoseph Koshy	libelf_allocate.c					\
563eb1a62eSJoseph Koshy	libelf_ar.c						\
57d961c5b4SKai Wang	libelf_ar_util.c					\
583eb1a62eSJoseph Koshy	libelf_checksum.c					\
593eb1a62eSJoseph Koshy	libelf_data.c						\
603eb1a62eSJoseph Koshy	libelf_ehdr.c						\
61f6c0f35eSJoseph Koshy	libelf_extended.c					\
62edbef29bSKai Wang	libelf_memory.c						\
63edbef29bSKai Wang	libelf_open.c						\
643eb1a62eSJoseph Koshy	libelf_phdr.c						\
653eb1a62eSJoseph Koshy	libelf_shdr.c						\
669167cd63SJoseph Koshy	libelf_xlate.c						\
679167cd63SJoseph Koshy	${GENSRCS}
683eb1a62eSJoseph Koshy
69edbef29bSKai WangINCS=		libelf.h gelf.h
70ec280fdbSAndrew Turner
714aa63711SBryan Drewery# This same hack is in lib/libdwarf/Makefile and usr.bin/readelf/Makefile
726eabfa96SKai Wang# We need to link against the correct version of these files. One
736eabfa96SKai Wang# solution is to include ../../sys in the include path. This causes
746eabfa96SKai Wang# problems when a header file in sys depends on a file in another
756eabfa96SKai Wang# part of the tree, e.g. a machine dependent header.
766eabfa96SKai Wang#
776eabfa96SKai WangSRCS+=	sys/elf32.h sys/elf64.h sys/elf_common.h
786eabfa96SKai Wang
7973eee246SRuslan ErmilovGENSRCS=	libelf_fsize.c libelf_msize.c libelf_convert.c
8073eee246SRuslan ErmilovCLEANFILES=	${GENSRCS}
816eabfa96SKai WangCLEANDIRS=	sys
827c4a6907SKai WangCFLAGS+=	-I. -I${SRCDIR} -I${TOP}/common
833eb1a62eSJoseph Koshy
84b791fbe6SBryan Drewerysys/elf32.h sys/elf64.h sys/elf_common.h: ${.CURDIR}/../../sys/${.TARGET} .NOMETA
856eabfa96SKai Wang	mkdir -p ${.OBJDIR}/sys
86b791fbe6SBryan Drewery	ln -sf ${.ALLSRC} ${.TARGET}
876eabfa96SKai Wang
8888d795a0SKai WangSHLIB_MAJOR=	2
893eb1a62eSJoseph Koshy
903eb1a62eSJoseph KoshyMAN=	elf.3							\
913eb1a62eSJoseph Koshy	elf_begin.3						\
923eb1a62eSJoseph Koshy	elf_cntl.3						\
9386f5401bSKai Wang	elf_end.3						\
9486f5401bSKai Wang	elf_errmsg.3						\
953eb1a62eSJoseph Koshy	elf_fill.3						\
963eb1a62eSJoseph Koshy	elf_flagdata.3						\
973eb1a62eSJoseph Koshy	elf_getarhdr.3						\
983eb1a62eSJoseph Koshy	elf_getarsym.3						\
993eb1a62eSJoseph Koshy	elf_getbase.3						\
1003eb1a62eSJoseph Koshy	elf_getdata.3						\
1013eb1a62eSJoseph Koshy	elf_getident.3						\
1023eb1a62eSJoseph Koshy	elf_getscn.3						\
10386f5401bSKai Wang	elf_getphdrnum.3					\
104f6c0f35eSJoseph Koshy	elf_getphnum.3						\
10586f5401bSKai Wang	elf_getshdrnum.3					\
1063eb1a62eSJoseph Koshy	elf_getshnum.3						\
10786f5401bSKai Wang	elf_getshdrstrndx.3					\
1083eb1a62eSJoseph Koshy	elf_getshstrndx.3					\
1093eb1a62eSJoseph Koshy	elf_hash.3						\
1103eb1a62eSJoseph Koshy	elf_kind.3						\
1113eb1a62eSJoseph Koshy	elf_memory.3						\
1123eb1a62eSJoseph Koshy	elf_next.3						\
113edbef29bSKai Wang	elf_open.3						\
1143eb1a62eSJoseph Koshy	elf_rawfile.3						\
1153eb1a62eSJoseph Koshy	elf_rand.3						\
1163eb1a62eSJoseph Koshy	elf_strptr.3						\
1173eb1a62eSJoseph Koshy	elf_update.3						\
1183eb1a62eSJoseph Koshy	elf_version.3						\
1193eb1a62eSJoseph Koshy	gelf.3							\
1203eb1a62eSJoseph Koshy	gelf_checksum.3						\
1213eb1a62eSJoseph Koshy	gelf_fsize.3						\
1223eb1a62eSJoseph Koshy	gelf_getcap.3						\
1233eb1a62eSJoseph Koshy	gelf_getclass.3						\
1243eb1a62eSJoseph Koshy	gelf_getdyn.3						\
1253eb1a62eSJoseph Koshy	gelf_getehdr.3						\
1263eb1a62eSJoseph Koshy	gelf_getmove.3						\
1273eb1a62eSJoseph Koshy	gelf_getphdr.3						\
1283eb1a62eSJoseph Koshy	gelf_getrel.3						\
1293eb1a62eSJoseph Koshy	gelf_getrela.3						\
1303eb1a62eSJoseph Koshy	gelf_getshdr.3						\
1313eb1a62eSJoseph Koshy	gelf_getsym.3						\
1323eb1a62eSJoseph Koshy	gelf_getsyminfo.3					\
1333eb1a62eSJoseph Koshy	gelf_getsymshndx.3					\
1343eb1a62eSJoseph Koshy	gelf_newehdr.3						\
1353eb1a62eSJoseph Koshy	gelf_newphdr.3						\
1363eb1a62eSJoseph Koshy	gelf_update_ehdr.3					\
1373eb1a62eSJoseph Koshy	gelf_xlatetof.3
1383eb1a62eSJoseph Koshy
1393eb1a62eSJoseph KoshyMLINKS+= \
1403eb1a62eSJoseph Koshy	elf_errmsg.3 elf_errno.3		\
141edbef29bSKai Wang	elf_flagdata.3 elf_flagarhdr.3		\
1423eb1a62eSJoseph Koshy	elf_flagdata.3 elf_flagehdr.3		\
1433eb1a62eSJoseph Koshy	elf_flagdata.3 elf_flagelf.3		\
1443eb1a62eSJoseph Koshy	elf_flagdata.3 elf_flagphdr.3		\
1453eb1a62eSJoseph Koshy	elf_flagdata.3 elf_flagscn.3		\
1463eb1a62eSJoseph Koshy	elf_flagdata.3 elf_flagshdr.3		\
1473eb1a62eSJoseph Koshy	elf_getdata.3 elf_newdata.3		\
1483eb1a62eSJoseph Koshy	elf_getdata.3 elf_rawdata.3		\
1493eb1a62eSJoseph Koshy	elf_getscn.3 elf_ndxscn.3		\
1503eb1a62eSJoseph Koshy	elf_getscn.3 elf_newscn.3		\
1513eb1a62eSJoseph Koshy	elf_getscn.3 elf_nextscn.3		\
1523eb1a62eSJoseph Koshy	elf_getshstrndx.3 elf_setshstrndx.3	\
153edbef29bSKai Wang	elf_open.3 elf_openmemory.3             \
1543eb1a62eSJoseph Koshy	gelf_getcap.3 gelf_update_cap.3		\
1553eb1a62eSJoseph Koshy	gelf_getdyn.3 gelf_update_dyn.3		\
1563eb1a62eSJoseph Koshy	gelf_getmove.3 gelf_update_move.3	\
1573eb1a62eSJoseph Koshy	gelf_getrel.3 gelf_update_rel.3		\
1583eb1a62eSJoseph Koshy	gelf_getrela.3 gelf_update_rela.3	\
1593eb1a62eSJoseph Koshy	gelf_getsym.3 gelf_update_sym.3		\
1603eb1a62eSJoseph Koshy	gelf_getsyminfo.3 gelf_update_syminfo.3	\
1613eb1a62eSJoseph Koshy	gelf_getsymshndx.3 gelf_update_symshndx.3 \
1623eb1a62eSJoseph Koshy	gelf_update_ehdr.3 gelf_update_phdr.3	\
1633eb1a62eSJoseph Koshy	gelf_update_ehdr.3 gelf_update_shdr.3	\
1643eb1a62eSJoseph Koshy	gelf_xlatetof.3 gelf_xlatetom.3
1653eb1a62eSJoseph Koshy
1663eb1a62eSJoseph Koshy.for E in 32 64
1673eb1a62eSJoseph KoshyMLINKS+= \
1683eb1a62eSJoseph Koshy	gelf_checksum.3	elf${E}_checksum.3 	\
1693eb1a62eSJoseph Koshy	gelf_fsize.3	elf${E}_fsize.3 	\
1703eb1a62eSJoseph Koshy	gelf_getehdr.3	elf${E}_getehdr.3	\
1713eb1a62eSJoseph Koshy	gelf_getphdr.3	elf${E}_getphdr.3	\
1723eb1a62eSJoseph Koshy	gelf_getshdr.3	elf${E}_getshdr.3	\
1733eb1a62eSJoseph Koshy	gelf_newehdr.3	elf${E}_newehdr.3	\
1743eb1a62eSJoseph Koshy	gelf_newphdr.3	elf${E}_newphdr.3	\
1753eb1a62eSJoseph Koshy	gelf_xlatetof.3	elf${E}_xlatetof.3	\
1763eb1a62eSJoseph Koshy	gelf_xlatetof.3	elf${E}_xlatetom.3
1773eb1a62eSJoseph Koshy.endfor
1783eb1a62eSJoseph Koshy
179edbef29bSKai WangVERSION_MAP=           ${SRCDIR}/Version.map
1803eb1a62eSJoseph Koshy
1813eb1a62eSJoseph Koshylibelf_convert.c:	elf_types.m4 libelf_convert.m4
1823eb1a62eSJoseph Koshylibelf_fsize.c:		elf_types.m4 libelf_fsize.m4
1833eb1a62eSJoseph Koshylibelf_msize.c:		elf_types.m4 libelf_msize.m4
1843eb1a62eSJoseph Koshy
1853eb1a62eSJoseph Koshy.include <bsd.lib.mk>
1863eb1a62eSJoseph Koshy
1879167cd63SJoseph Koshy# Keep the .SUFFIXES line after the include of bsd.lib.mk
1883eb1a62eSJoseph Koshy.SUFFIXES:	.m4 .c
1893eb1a62eSJoseph Koshy.m4.c:
190edbef29bSKai Wang	m4 -D SRCDIR=${SRCDIR} ${M4FLAGS} ${.IMPSRC} > ${.TARGET}
191edbef29bSKai Wang
192