2010-01-18 21:14:19 +00:00
|
|
|
include ../global.mk
|
|
|
|
include config.mk
|
2009-04-01 00:28:13 +00:00
|
|
|
|
|
|
|
PREFIX?=${PWD}/../prefix
|
2009-03-09 01:14:50 +00:00
|
|
|
PFX=${DESTDIR}${PREFIX}
|
|
|
|
#PREFIX=${PFX}
|
2009-02-05 21:08:46 +00:00
|
|
|
|
|
|
|
# Libraries
|
2010-08-19 22:36:22 +00:00
|
|
|
LIBLIST=util socket cons line lib io lang flags bin hash config syscall cmd reg
|
|
|
|
LIBLIST+=asm anal print parse search diff bp sign vm th db crypto debug core
|
2009-02-05 21:08:46 +00:00
|
|
|
|
|
|
|
# TODO : generate single library linking against the rest
|
|
|
|
#LIBSO=libr.so
|
|
|
|
#LIBAR=libr.a
|
|
|
|
|
2010-01-14 11:13:48 +00:00
|
|
|
all: libs libr
|
|
|
|
|
|
|
|
libs:
|
2010-01-09 00:14:37 +00:00
|
|
|
@for lib in ${LIBLIST}; do ( cd $${lib} && ${MAKE} all ); done
|
2009-02-05 21:08:46 +00:00
|
|
|
@echo Build done for: ${LIBLIST}
|
|
|
|
|
2010-03-25 09:18:59 +00:00
|
|
|
ifeq ($(ONELIB),1)
|
2010-01-21 20:22:30 +00:00
|
|
|
libr: .objs libr2.${EXT_SO} libr2.${EXT_AR}
|
2010-03-25 09:18:59 +00:00
|
|
|
else
|
|
|
|
libr:
|
|
|
|
endif
|
2010-01-14 11:13:48 +00:00
|
|
|
|
2010-01-21 20:22:30 +00:00
|
|
|
ifeq ($(WITHPIC),1)
|
|
|
|
libr2.${EXT_SO}:
|
2010-02-21 20:34:10 +00:00
|
|
|
ifeq ($(OSTYPE),darwin)
|
|
|
|
@echo Linkage of libr2.dylib is broken on OSX because of dupped .o in .objs extraction
|
|
|
|
else
|
2010-04-05 20:49:22 +00:00
|
|
|
${CC} ${LDFLAGS_SONAME}libr2.${EXT_SO} ${LDFLAGS_LIB} ${PIC_CFLAGS} .objs/*.o -o libr2.${EXT_SO}
|
2010-02-21 20:34:10 +00:00
|
|
|
endif
|
2010-01-26 00:28:33 +00:00
|
|
|
|
|
|
|
libr2.${EXT_AR}:
|
2010-09-15 11:10:10 +00:00
|
|
|
@echo NOTE: Use --without-pic in configure to create libr2.${EXT_AR}
|
2010-01-21 20:22:30 +00:00
|
|
|
else
|
|
|
|
libr2.${EXT_SO}:
|
2010-01-26 00:28:33 +00:00
|
|
|
|
|
|
|
libr2.${EXT_AR}:
|
|
|
|
ar -r libr2.${EXT_AR} .objs/*.o
|
2010-01-21 20:22:30 +00:00
|
|
|
endif
|
2010-01-14 11:13:48 +00:00
|
|
|
|
|
|
|
# XXX needs autodetection of deps to remake and so..
|
|
|
|
.objs:
|
|
|
|
mkdir -p .objs
|
2010-01-30 13:02:53 +00:00
|
|
|
-for a in ${LIBLIST} ; do \
|
2010-01-14 11:13:48 +00:00
|
|
|
(cd .objs && ar x ../$$a/libr_$$a.a) ; \
|
|
|
|
done
|
2010-01-13 23:12:41 +00:00
|
|
|
|
2009-07-16 00:30:20 +00:00
|
|
|
pkgcfg:
|
|
|
|
for lib in ${LIBLIST}; do ( cd $${lib} && ${MAKE} pkgcfg ); done
|
2009-07-16 09:40:00 +00:00
|
|
|
cd asm && ${MAKE} pkgcfg NAME=libr DEPS="r_`echo ${LIBLIST}|sed -e 's, , r_,g'`"
|
2009-07-16 00:30:20 +00:00
|
|
|
# TODO: Magically generate libr.pc.acr here using LIBLIST and so :)
|
|
|
|
|
2010-01-25 10:54:25 +00:00
|
|
|
install-pkgconfig:
|
|
|
|
@${INSTALL_DIR} ${PFX}/lib/pkgconfig
|
|
|
|
for a in ../pkgcfg/*.pc ; do ${INSTALL_DATA} $$a ${PFX}/lib/pkgconfig ; done
|
|
|
|
|
2010-01-27 00:50:26 +00:00
|
|
|
install-includes:
|
|
|
|
@${INSTALL_DIR} ${PFX}/include/libr
|
|
|
|
(cd include && ${INSTALL_DATA} * ${PFX}/include/libr)
|
|
|
|
|
2010-05-24 15:51:51 +00:00
|
|
|
install-symlink:
|
|
|
|
mkdir -p ${PFX}/bin
|
|
|
|
mkdir -p ${PFX}/include
|
2010-06-15 13:31:17 +00:00
|
|
|
mkdir -p ${PFX}/lib/pkgconfig
|
2010-05-24 15:51:51 +00:00
|
|
|
mkdir -p ${PFX}/lib/radare2
|
2010-06-15 13:31:17 +00:00
|
|
|
rm -f ${PFX}/include/libr && ln -fs ${PWD}/include ${PFX}/include/libr
|
|
|
|
cd ../pkgcfg && for a in *.pc ; do \
|
|
|
|
if [ -e ${PWD}/../pkgcfg/$${a} ] ; then \
|
|
|
|
ln -fs ${PWD}/../pkgcfg/$${a} ${PFX}/lib/pkgconfig/$${a} ; \
|
|
|
|
fi ; \
|
|
|
|
done
|
2010-05-24 15:51:51 +00:00
|
|
|
for a in ${LIBLIST} ; do \
|
|
|
|
ln -fs ${PWD}/$${a}/libr_$${a}.${EXT_SO} ${PFX}/lib/libr_$${a}.${EXT_SO} ; \
|
|
|
|
ln -fs ${PWD}/$${a}/libr_$${a}.${EXT_AR} ${PFX}/lib/libr_$${a}.${EXT_AR} ; \
|
|
|
|
for b in $${a}/p/*.${EXT_SO} ; do \
|
2010-06-15 13:31:17 +00:00
|
|
|
if [ -e ${PWD}/$${b} ] ; then \
|
|
|
|
ln -fs ${PWD}/$${b} ${PFX}/lib/radare2/ ; \
|
|
|
|
fi ; \
|
2010-05-24 15:51:51 +00:00
|
|
|
done ; \
|
|
|
|
done
|
|
|
|
|
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
|
2009-04-20 11:02:04 +00:00
|
|
|
@${INSTALL_DIR} ${PFX}/lib
|
2010-03-10 16:21:20 +00:00
|
|
|
@for a in `find * | grep -e '\.${EXT_SO}$$' | grep -v lib/t | grep lib` ; do \
|
2010-03-19 12:57:21 +00:00
|
|
|
echo "$$a ${PFX}/lib"; \
|
|
|
|
${INSTALL_DATA} $$a ${PFX}/lib ; \
|
|
|
|
done
|
2009-02-05 21:08:46 +00:00
|
|
|
# object archives
|
|
|
|
@for a in `find * | grep -e '\.a$$'` ; do \
|
2010-01-18 21:14:19 +00:00
|
|
|
echo "$$a ${PFX}/lib"; ${INSTALL_DATA} $$a ${PFX}/lib ; done
|
2009-02-06 17:22:27 +00:00
|
|
|
# plugins
|
2009-04-20 11:02:04 +00:00
|
|
|
@${INSTALL_DIR} ${PFX}/lib/radare2
|
2010-06-03 22:56:44 +00:00
|
|
|
@for a in `find */p -perm -u+x -type f | grep -v exe | grep -v dll`; \
|
2010-01-18 21:14:19 +00:00
|
|
|
do echo "$$a ${PFX}/lib/radare2"; \
|
|
|
|
${INSTALL_DATA} $$a ${PFX}/lib/radare2 ; done
|
2009-04-20 09:42:05 +00:00
|
|
|
${INSTALL_DATA} lang/p/radare.* ${PFX}/lib/radare2
|
2010-01-18 21:14:19 +00:00
|
|
|
echo "lang/p/radare.* ${PFX}/lib/radare2"
|
2009-02-05 21:08:46 +00:00
|
|
|
|
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; }'`; \
|
2010-06-15 11:10:46 +00:00
|
|
|
echo ${PFX}/lib/$$a ; rm -f ${PFX}/lib/$$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; }'`; \
|
2010-06-15 11:10:46 +00:00
|
|
|
echo ${PFX}/lib/$$a ; rm -f ${PFX}/lib/$$a ; done
|
2010-05-29 11:24:47 +00:00
|
|
|
# includes
|
2010-06-15 11:10:46 +00:00
|
|
|
-(cd include && for a in * ; do rm -f ${PFX}/libr/$$a ; done)
|
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; }'`; \
|
2010-06-15 11:10:46 +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 \
|
2010-06-15 11:10:46 +00:00
|
|
|
a="${PFX}/lib/radare2/`echo $$a|awk -F / '{ print $$NF; }'`"; \
|
2009-03-06 00:38:23 +00:00
|
|
|
echo $$a ; rm -f $$a ; done
|
2010-06-15 11:10:46 +00:00
|
|
|
rm -rf ${PFX}/lib/radare2
|
|
|
|
rm -f ${PFX}/lib/pkgconfig/libr.pc
|
|
|
|
rm -f ${PFX}/lib/pkgconfig/r_*.pc
|
2009-03-06 00:38:23 +00:00
|
|
|
# test programs
|
2010-06-15 11:10:46 +00:00
|
|
|
rm -rf ${PFX}/bin/libr-test
|
2010-06-15 12:10:42 +00:00
|
|
|
# TODO: use for a in LIBLIST (like in binr/Makefile)
|
|
|
|
rm -rf ${PFX}/include/libr
|
|
|
|
rm -rf ${PFX}/lib/libr_*.so
|
|
|
|
rm -rf ${PFX}/lib/libr_*.a
|
|
|
|
rm -rf ${PFX}/lib/libr.so
|
|
|
|
rm -rf ${PFX}/lib/libr.a
|
|
|
|
rm -rf ${PFX}/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:
|
|
|
|
for lib in ${LIBLIST}; do ( cd $${lib} && ${MAKE} clean ); done
|
2010-06-15 12:10:42 +00:00
|
|
|
rm -f libr2.so
|
2010-01-14 11:13:48 +00:00
|
|
|
rm -rf .objs
|
2009-06-15 02:44:05 +00:00
|
|
|
|
2010-07-13 09:59:55 +00:00
|
|
|
mrproper:
|
2010-06-15 12:10:42 +00:00
|
|
|
for lib in ${LIBLIST}; do ( cd $${lib} && ${MAKE} mrproper ); done
|
2010-07-13 09:59:55 +00:00
|
|
|
rm -f libr2.so
|
|
|
|
rm -rf .objs
|
2009-03-10 11:21:46 +00:00
|
|
|
rm -f libr.pc
|
2010-01-13 22:42:49 +00:00
|
|
|
|
|
|
|
sloc:
|
|
|
|
${MAKE} -C .. sloc SLOCDIR=libr
|
|
|
|
|
2010-06-15 11:10:46 +00:00
|
|
|
.PHONY: sloc mrproper clean all pkgcfg install deinstall uninstall libr install-symlink
|