2010-01-18 21:14:19 +00:00
|
|
|
include ../global.mk
|
|
|
|
include config.mk
|
2014-12-11 00:50:26 +00:00
|
|
|
include ../config-user.mk
|
2013-09-06 22:39:08 +00:00
|
|
|
include ../mk/${COMPILER}.mk
|
2009-04-01 00:28:13 +00:00
|
|
|
|
2014-06-26 18:09:59 +00:00
|
|
|
DESTDIR:=$(call rmbdlslash,$(DESTDIR))
|
2009-04-01 00:28:13 +00:00
|
|
|
PREFIX?=${PWD}/../prefix
|
2014-06-26 18:09:59 +00:00
|
|
|
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))
|
2009-02-05 21:08:46 +00:00
|
|
|
|
2013-03-03 23:44:46 +00:00
|
|
|
LIBS0=util hash
|
2015-06-01 23:21:56 +00:00
|
|
|
LIBS1=reg cons db magic bp search config socket
|
2014-05-28 16:58:53 +00:00
|
|
|
LIBS2=syscall lang io crypto flags
|
|
|
|
LIBS3=fs anal bin
|
2013-12-31 04:30:39 +00:00
|
|
|
LIBS4=parse
|
2012-10-03 23:49:04 +00:00
|
|
|
LIBS5=asm debug
|
2013-01-22 04:06:12 +00:00
|
|
|
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)
|
2009-02-05 21:08:46 +00:00
|
|
|
|
2012-10-03 12:31:35 +00:00
|
|
|
all:
|
2014-05-07 23:32:06 +00:00
|
|
|
${MAKE} $(LIBS0)
|
|
|
|
${MAKE} $(LIBS1)
|
|
|
|
${MAKE} $(LIBS2)
|
|
|
|
${MAKE} $(LIBS3)
|
|
|
|
${MAKE} $(LIBS4)
|
|
|
|
${MAKE} $(LIBS5)
|
|
|
|
${MAKE} $(LIBS6)
|
|
|
|
${MAKE} $(LIBS7)
|
2013-01-04 13:34:58 +00:00
|
|
|
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)
|
2013-01-04 13:34:58 +00:00
|
|
|
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
|
2013-09-06 22:39:08 +00:00
|
|
|
${CC_AR} -M < libr.m
|
2013-01-04 13:34:58 +00:00
|
|
|
rm -f libr.m
|
2012-10-03 23:20:00 +00:00
|
|
|
|
|
|
|
$(LIBS):
|
|
|
|
@echo "DIR $@"
|
2014-05-07 23:32:06 +00:00
|
|
|
@${MAKE} -C $@
|
2009-02-05 21:08:46 +00:00
|
|
|
|
2009-07-16 00:30:20 +00:00
|
|
|
pkgcfg:
|
2012-10-03 12:31:35 +00:00
|
|
|
@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 :)
|
2009-07-16 00:30:20 +00:00
|
|
|
|
2010-01-25 10:54:25 +00:00
|
|
|
install-pkgconfig:
|
2014-07-09 23:13:04 +00:00
|
|
|
${INSTALL_DIR} "${LFX}/pkgconfig"
|
|
|
|
for a in ../pkgcfg/*.pc ; do ${INSTALL_DATA} $$a "${LFX}/pkgconfig" ; done
|
2010-01-25 10:54:25 +00:00
|
|
|
|
2010-01-27 00:50:26 +00:00
|
|
|
install-includes:
|
2014-07-09 23:13:04 +00:00
|
|
|
${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 \
|
2014-07-09 23:13:04 +00:00
|
|
|
${INSTALL_DIR} "${IFX}/libr/sflib/$$a" ; \
|
2011-12-01 19:17:40 +00:00
|
|
|
for b in $$a/*.h ; do \
|
2014-07-09 23:13:04 +00:00
|
|
|
${INSTALL_DATA} $$b "${IFX}/libr/sflib/$$b" ; \
|
2011-12-01 19:17:40 +00:00
|
|
|
done ; \
|
|
|
|
done)
|
2014-07-09 23:13:04 +00:00
|
|
|
${INSTALL_DIR} "${IFX}/libr/sdb"
|
2012-10-11 08:44:22 +00:00
|
|
|
(cd include/sdb && for a in * ; do \
|
2014-07-09 23:13:04 +00:00
|
|
|
${INSTALL_DATA} $$a "${IFX}/libr/sdb/$$a" ; \
|
2012-10-11 08:44:22 +00:00
|
|
|
done)
|
2010-01-27 00:50:26 +00:00
|
|
|
|
2012-10-03 12:31:35 +00:00
|
|
|
symstall install-symlink:
|
2014-07-09 23:13:04 +00:00
|
|
|
mkdir -p "${PFX}/bin" \
|
|
|
|
"${IFX}" \
|
|
|
|
"${LFX}/pkgconfig" \
|
|
|
|
"${LFX}/radare2/${VERSION}"
|
|
|
|
rm -rf "${IFX}/libr" && ln -fs "${PWD}/include" "${IFX}/libr"
|
2010-06-15 13:31:17 +00:00
|
|
|
cd ../pkgcfg && for a in *.pc ; do \
|
2014-07-09 23:13:04 +00:00
|
|
|
if [ -e "${PWD}/../pkgcfg/$${a}" ] ; then \
|
2015-07-08 19:49:30 +00:00
|
|
|
ln -fs "${PWD}/../pkgcfg/$${a}" \
|
|
|
|
"${LFX}/pkgconfig/$${a}" ; \
|
2010-06-15 13:31:17 +00:00
|
|
|
fi ; \
|
|
|
|
done
|
2014-03-09 09:51:26 +00:00
|
|
|
@$(foreach lib,${LIBS}, \
|
2014-07-09 23:13:04 +00:00
|
|
|
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}" ; \
|
2014-03-09 09:51:26 +00:00
|
|
|
$(foreach module,$(wildcard $(lib)/p/*.${EXT_SO}), \
|
2014-07-09 23:13:04 +00:00
|
|
|
ln -fs "${PWD}/$(module)" "${LFX}/radare2/${VERSION}/" ; \
|
2014-03-09 09:51:26 +00:00
|
|
|
) \
|
|
|
|
)
|
2015-07-08 19:49:30 +00:00
|
|
|
cd "${LFX}/radare2" ; rm -f last ; ln -fs "${VERSION}" last
|
2010-05-24 15:51:51 +00:00
|
|
|
|
2010-05-29 11:24:47 +00:00
|
|
|
install: install-includes install-pkgconfig
|
2009-04-20 10:31:12 +00:00
|
|
|
# TODO :Use INSTALL_DATA_DIR instead of mkdir
|
2009-02-05 21:08:46 +00:00
|
|
|
# libraries
|
2014-07-09 23:13:04 +00:00
|
|
|
@${INSTALL_DIR} "${LFX}"
|
2014-03-08 12:06:45 +00:00
|
|
|
@$(foreach lib,$(shell find * -type f | grep -e '\.${EXT_SO}$$' | grep -Ev '(lib|parse)/t/' | grep lib | grep -v /bin/ | grep -v /p/), \
|
2014-03-09 09:51:26 +00:00
|
|
|
echo " ${LFX}/$(call libpath-to-name-version,$(lib),${LIBVERSION})"; \
|
2014-07-09 23:13:04 +00:00
|
|
|
${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))" ) ; \
|
2014-03-08 12:06:45 +00:00
|
|
|
)
|
2009-02-05 21:08:46 +00:00
|
|
|
# object archives
|
2011-03-10 08:19:30 +00:00
|
|
|
@for a in `find * -type f | grep -e '\.a$$' | grep -v fs/p` ; do \
|
2011-07-19 09:25:11 +00:00
|
|
|
echo " ${LFX}/$$a"; ${INSTALL_DATA} $$a ${LFX} ; done
|
2009-02-06 17:22:27 +00:00
|
|
|
# plugins
|
2014-07-09 23:13:04 +00:00
|
|
|
@${INSTALL_DIR} "${LFX}/radare2/${VERSION}"
|
2011-03-10 08:19:30 +00:00
|
|
|
@for a in `find */p -perm -u+x -type f | grep -v exe | grep -v dll | grep ${EXT_SO}`; \
|
2011-07-19 09:25:11 +00:00
|
|
|
do echo " ${LFX}/radare2/${VERSION}/$$a"; \
|
2014-12-11 01:23:17 +00:00
|
|
|
${INSTALL_LIB} "$$a" "${LFX}/radare2/${VERSION}" ; done
|
2014-07-09 23:13:04 +00:00
|
|
|
cd "${LFX}/radare2" ; ln -fs "${VERSION}" last
|
2009-02-05 21:08:46 +00:00
|
|
|
|
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}
|
|
|
|
|
2009-04-03 11:11:17 +00:00
|
|
|
deinstall uninstall:
|
2009-03-06 00:38:23 +00:00
|
|
|
# libraries
|
2010-03-10 16:21:20 +00:00
|
|
|
-@for a in `find * | grep -e '\.${EXT_SO}$$' | grep -v 'lib/t' | grep lib` ; do \
|
2010-01-31 13:22:27 +00:00
|
|
|
a=`echo $$a | awk -F / '{ print $$NF; }'`; \
|
2014-07-09 23:13:04 +00:00
|
|
|
echo "${LFX}/$$a" ; rm -f "${LFX}/$$a" ; done
|
2010-05-29 11:24:47 +00:00
|
|
|
# object archives
|
2009-03-06 00:38:23 +00:00
|
|
|
-@for a in `find * | grep -e '\.a$$'` ; do \
|
2010-01-31 13:22:27 +00:00
|
|
|
a=`echo $$a | awk -F / '{ print $$NF; }'`; \
|
2014-07-09 23:13:04 +00:00
|
|
|
echo "${LFX}/$$a" ; rm -f "${LFX}/$$a" ; done
|
2010-05-29 11:24:47 +00:00
|
|
|
# includes
|
2014-07-09 23:13:04 +00:00
|
|
|
-if [ -h "${IFX}/libr" ]; then \
|
|
|
|
rm -f "${IFX}/libr" ; \
|
2011-07-20 17:26:07 +00:00
|
|
|
else \
|
2014-07-09 23:13:04 +00:00
|
|
|
(cd include && for a in * ; do rm -f "${IFX}/libr/$$a" ; done) ; \
|
2011-07-20 17:26:07 +00:00
|
|
|
fi
|
2010-05-29 11:24:47 +00:00
|
|
|
# programs
|
2010-02-21 19:21:36 +00:00
|
|
|
-@for a in `find */t -perm -u+x -type f | grep 2`; do \
|
2009-03-06 00:38:23 +00:00
|
|
|
a=`echo $$a|awk -F / '{ print $$NF; }'`; \
|
2014-07-09 23:13:04 +00:00
|
|
|
echo "${PFX}/bin/$$a" ; rm -f "${PFX}/bin/$$a" ; done
|
2009-03-06 00:38:23 +00:00
|
|
|
# plugins
|
2010-02-21 19:21:36 +00:00
|
|
|
-@for a in `find */p -perm -u+x -type f`; do \
|
2011-07-19 09:25:11 +00:00
|
|
|
a="${LFX}/radare2/${VERSION}/`echo $$a|awk -F / '{ print $$NF; }'`"; \
|
2009-03-06 00:38:23 +00:00
|
|
|
echo $$a ; rm -f $$a ; done
|
2014-07-09 23:13:04 +00:00
|
|
|
rm -rf "${LFX}/radare2/${VERSION}"
|
|
|
|
rm -f "${LFX}/pkgconfig/libr.pc"
|
|
|
|
rm -f "${LFX}/pkgconfig/r_"*.pc
|
2009-03-06 00:38:23 +00:00
|
|
|
# test programs
|
2014-07-09 23:13:04 +00:00
|
|
|
rm -rf "${PFX}/bin/libr-test"
|
2012-10-03 12:31:35 +00:00
|
|
|
# TODO: use for a in LIBS (like in binr/Makefile)
|
2014-07-09 23:13:04 +00:00
|
|
|
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"
|
2010-06-15 11:10:46 +00:00
|
|
|
@echo libr aka radare2 has been uninstalled from PREFIX=${PFX}
|
2009-03-06 00:38:23 +00:00
|
|
|
|
2009-02-05 21:08:46 +00:00
|
|
|
clean:
|
2012-10-03 12:31:35 +00:00
|
|
|
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:
|
2012-10-03 12:31:35 +00:00
|
|
|
for lib in ${LIBS}; do ( cd $${lib} && ${MAKE} mrproper ); done
|
2010-01-13 22:42:49 +00:00
|
|
|
|
2012-10-03 12:31:35 +00:00
|
|
|
.PHONY: sloc mrproper clean pkgcfg install deinstall uninstall libr
|
|
|
|
.PHONY: install-includes install-pkgconfig install-symlink all
|