radare2/libr/Makefile

183 lines
5.8 KiB
Makefile
Raw Normal View History

include ../global.mk
include config.mk
include ../config-user.mk
include ../mk/${COMPILER}.mk
DESTDIR:=$(call rmbdlslash,$(DESTDIR))
PREFIX?=${PWD}/../prefix
PFX=$(call rmdblslash,${DESTDIR}/${PREFIX})
LFX=$(call rmdblslash,${DESTDIR}/${LIBDIR})
IFX=$(call rmdblslash,${DESTDIR}/${INCLUDEDIR})
2014-09-01 13:50:04 +00:00
PWD=$(call rmdblslash,$(shell pwd))
LIBS0=util hash
2015-06-01 23:21:56 +00:00
LIBS1=reg cons db magic bp search config socket
LIBS2=syscall lang io crypto flags
LIBS3=fs anal bin
LIBS4=parse
2012-10-03 23:49:04 +00:00
LIBS5=asm debug
LIBS6=egg
#LIBS6+=print
2012-10-03 23:20:00 +00:00
LIBS7=core
LIBS=$(LIBS0) $(LIBS1) $(LIBS2) $(LIBS3) $(LIBS4) $(LIBS5) $(LIBS6) $(LIBS7)
.PHONY: $(LIBS)
all:
${MAKE} $(LIBS0)
${MAKE} $(LIBS1)
${MAKE} $(LIBS2)
${MAKE} $(LIBS3)
${MAKE} $(LIBS4)
${MAKE} $(LIBS5)
${MAKE} $(LIBS6)
${MAKE} $(LIBS7)
ifeq (${WITHNONPIC},1)
${MAKE} libr.a
endif
# looks hacky :D
2013-04-12 00:39:46 +00:00
#AR=arm-linux-androideabi-ar
2013-09-07 00:20:38 +00:00
libr.a:
rm -rf .libr
mkdir .libr
for a in */libr_*.a ; do \
mkdir -p .libr/$$a ; \
cp -f $$a .libr/$$a ; \
(cd .libr/$$a ; ${AR} x *.a ; rm -f *.a ) ; \
done
2013-10-01 21:06:21 +00:00
${AR} qv libr.a `find .libr/ | grep '\\.o$$'`
2013-09-07 00:20:38 +00:00
rm -rf .libr
gnu_libr.a: $(shell ls */libr_*.a 2>/dev/null)
rm -f libr.a
echo CREATE libr.a > libr.m
for a in */libr_*.a ; do echo ADDLIB $$a >> libr.m ; done
echo SAVE >> libr.m
# ar -M is a gnu-ism .. try to find a proper portable way to do that
${CC_AR} -M < libr.m
rm -f libr.m
2012-10-03 23:20:00 +00:00
$(LIBS):
@echo "DIR $@"
@${MAKE} -C $@
pkgcfg:
@for lib in ${LIBS}; do ( cd $${lib} && ${MAKE} pkgcfg ); done
cd asm && ${MAKE} pkgcfg NAME=libr DEPS="r_`echo ${LIBS}|sed -e 's, , r_,g'`"
# TODO: Magically generate libr.pc.acr here using LIBS and so :)
install-pkgconfig:
${INSTALL_DIR} "${LFX}/pkgconfig"
for a in ../pkgcfg/*.pc ; do ${INSTALL_DATA} $$a "${LFX}/pkgconfig" ; done
install-includes:
${INSTALL_DIR} "${IFX}/libr"
(cd include && for a in *.h ; do ${INSTALL_DATA} $$a "${IFX}/libr" ; done)
${INSTALL_DIR} "${IFX}/libr/sflib"
2011-12-01 19:17:40 +00:00
(cd include/sflib && for a in * ; do \
${INSTALL_DIR} "${IFX}/libr/sflib/$$a" ; \
2011-12-01 19:17:40 +00:00
for b in $$a/*.h ; do \
${INSTALL_DATA} $$b "${IFX}/libr/sflib/$$b" ; \
2011-12-01 19:17:40 +00:00
done ; \
done)
${INSTALL_DIR} "${IFX}/libr/sdb"
2012-10-11 08:44:22 +00:00
(cd include/sdb && for a in * ; do \
${INSTALL_DATA} $$a "${IFX}/libr/sdb/$$a" ; \
2012-10-11 08:44:22 +00:00
done)
symstall install-symlink:
mkdir -p "${PFX}/bin" \
"${IFX}" \
"${LFX}/pkgconfig" \
"${LFX}/radare2/${VERSION}"
rm -rf "${IFX}/libr" && ln -fs "${PWD}/include" "${IFX}/libr"
cd ../pkgcfg && for a in *.pc ; do \
if [ -e "${PWD}/../pkgcfg/$${a}" ] ; then \
ln -fs "${PWD}/../pkgcfg/$${a}" "${LFX}/pkgconfig/$${a}" ; \
fi ; \
done
@$(foreach lib,${LIBS}, \
ln -fs "${PWD}/$(lib)/libr_$(lib).${EXT_SO}" \
"${LFX}/libr_$(lib).${EXT_SO}" ; \
ln -fs "${PWD}/$(lib)/libr_$(lib).${EXT_SO}" \
"${LFX}/$(call libname-version,libr_$(lib).${EXT_SO},${LIBVERSION})" ; \
ln -fs "${PWD}/$(lib)/libr_$(lib).${EXT_AR}" "${LFX}/libr_$(lib).${EXT_AR}" ; \
$(foreach module,$(wildcard $(lib)/p/*.${EXT_SO}), \
ln -fs "${PWD}/$(module)" "${LFX}/radare2/${VERSION}/" ; \
) \
( cd "${LFX}/radare2" ; ln -fs "${VERSION}" last ) ; \
)
install: install-includes install-pkgconfig
# TODO :Use INSTALL_DATA_DIR instead of mkdir
# libraries
@${INSTALL_DIR} "${LFX}"
@$(foreach lib,$(shell find * -type f | grep -e '\.${EXT_SO}$$' | grep -Ev '(lib|parse)/t/' | grep lib | grep -v /bin/ | grep -v /p/), \
echo " ${LFX}/$(call libpath-to-name-version,$(lib),${LIBVERSION})"; \
${INSTALL_LIB} "$(lib)" "${LFX}/$(call libpath-to-name-version,$(lib),${LIBVERSION})"; \
( cd "${LFX}" ; ln -fs "$(call libpath-to-name-version,$(lib),${LIBVERSION})" "$(call libpath-to-name,$(lib))" ) ; \
)
# object archives
@for a in `find * -type f | grep -e '\.a$$' | grep -v fs/p` ; do \
echo " ${LFX}/$$a"; ${INSTALL_DATA} $$a ${LFX} ; done
# plugins
@${INSTALL_DIR} "${LFX}/radare2/${VERSION}"
@for a in `find */p -perm -u+x -type f | grep -v exe | grep -v dll | grep ${EXT_SO}`; \
do echo " ${LFX}/radare2/${VERSION}/$$a"; \
2014-12-11 01:23:17 +00:00
${INSTALL_LIB} "$$a" "${LFX}/radare2/${VERSION}" ; done
cd "${LFX}/radare2" ; ln -fs "${VERSION}" last
2013-12-14 01:23:20 +00:00
#@echo "lang/p/radare.* ${DESTDIR}/${PFX}/${LIBDIR}/radare2/${VERSION}"
#${INSTALL_DATA} lang/p/radare.* ${LFX}/radare2/${VERSION}
deinstall uninstall:
# libraries
-@for a in `find * | grep -e '\.${EXT_SO}$$' | grep -v 'lib/t' | grep lib` ; do \
a=`echo $$a | awk -F / '{ print $$NF; }'`; \
echo "${LFX}/$$a" ; rm -f "${LFX}/$$a" ; done
# object archives
-@for a in `find * | grep -e '\.a$$'` ; do \
a=`echo $$a | awk -F / '{ print $$NF; }'`; \
echo "${LFX}/$$a" ; rm -f "${LFX}/$$a" ; done
# includes
-if [ -h "${IFX}/libr" ]; then \
rm -f "${IFX}/libr" ; \
else \
(cd include && for a in * ; do rm -f "${IFX}/libr/$$a" ; done) ; \
fi
# programs
-@for a in `find */t -perm -u+x -type f | grep 2`; do \
a=`echo $$a|awk -F / '{ print $$NF; }'`; \
echo "${PFX}/bin/$$a" ; rm -f "${PFX}/bin/$$a" ; done
# plugins
-@for a in `find */p -perm -u+x -type f`; do \
a="${LFX}/radare2/${VERSION}/`echo $$a|awk -F / '{ print $$NF; }'`"; \
echo $$a ; rm -f $$a ; done
rm -rf "${LFX}/radare2/${VERSION}"
rm -f "${LFX}/pkgconfig/libr.pc"
rm -f "${LFX}/pkgconfig/r_"*.pc
# test programs
rm -rf "${PFX}/bin/libr-test"
# TODO: use for a in LIBS (like in binr/Makefile)
rm -rf "${IFX}/libr"
rm -rf "${LFX}/libr_*.so.${LIBVERSION}"
rm -rf "${LFX}/libr_*.so.0"
rm -rf "${LFX}/libr_*.so"
rm -rf "${LFX}/libr_*.a"
rm -rf "${LFX}/libr2.so"*
rm -rf "${LFX}/libr2.a"
rm -rf "${LFX}/libr.so"*
rm -rf "${LFX}/libr.a"
rm -rf "${DESTDIR}${DATADIR}/share/doc/radare2"
@echo libr aka radare2 has been uninstalled from PREFIX=${PFX}
clean:
for lib in ${LIBS}; do ( cd $${lib} && ${MAKE} clean ); done
2009-06-15 02:44:05 +00:00
2010-07-13 09:59:55 +00:00
mrproper:
for lib in ${LIBS}; do ( cd $${lib} && ${MAKE} mrproper ); done
* Initial import of the 'configure-plugins' script - accepts --static and --shared to setup which plugins you want to build statically in the library or dynamically - normalize .mk and plugin file names to adopt a single standard - WARNING: huge commit * Added 'mk/sloc.mk' with 'sloc' target to count lines with sloccount everywhere (yeah!) --HG-- rename : libr/asm/p/x86bea.mk => libr/asm/p/x86_bea.mk rename : libr/asm/p/x86nasm.mk => libr/asm/p/x86_nasm.mk rename : libr/asm/p/x86olly.mk => libr/asm/p/x86_olly.mk rename : libr/config.h => libr/config.h.head rename : libr/config.mk => libr/config.mk.head rename : libr/debug/p/dbg_gdb.c => libr/debug/p/debug_gdb.c rename : libr/debug/p/dbg_ptrace.c => libr/debug/p/debug_ptrace.c rename : libr/debug/p/dbg_libgdbwrap/Makefile => libr/debug/p/libgdbwrap/Makefile rename : libr/debug/p/dbg_libgdbwrap/README => libr/debug/p/libgdbwrap/README rename : libr/debug/p/dbg_libgdbwrap/client.c => libr/debug/p/libgdbwrap/client.c rename : libr/debug/p/dbg_libgdbwrap/gdbwrapper.c => libr/debug/p/libgdbwrap/gdbwrapper.c rename : libr/debug/p/dbg_libgdbwrap/include/gdbwrapper-internals.h => libr/debug/p/libgdbwrap/include/gdbwrapper-internals.h rename : libr/debug/p/dbg_libgdbwrap/include/gdbwrapper-stddef.h => libr/debug/p/libgdbwrap/include/gdbwrapper-stddef.h rename : libr/debug/p/dbg_libgdbwrap/include/gdbwrapper.h => libr/debug/p/libgdbwrap/include/gdbwrapper.h rename : libr/debug/p/dbg_libgdbwrap/include/libaspect.h => libr/debug/p/libgdbwrap/include/libaspect.h rename : libr/debug/p/dbg_libgdbwrap/include/libe2dbg.h => libr/debug/p/libgdbwrap/include/libe2dbg.h rename : libr/debug/p/dbg_libgdbwrap/include/revm.h => libr/debug/p/libgdbwrap/include/revm.h rename : libr/debug/p/dbg_libgdbwrap/interface.c => libr/debug/p/libgdbwrap/interface.c rename : libr/io/p/dbg.mk => libr/io/p/debug.mk rename : libr/io/p/io_dbg.c => libr/io/p/io_debug.c
2010-01-13 22:42:49 +00:00
.PHONY: sloc mrproper clean pkgcfg install deinstall uninstall libr
.PHONY: install-includes install-pkgconfig install-symlink all