2010-01-18 21:14:19 +00:00
i n c l u d e . . / g l o b a l . m k
i n c l u d e c o n f i g . m k
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-03-03 01:45:55 +00:00
LIBLIST = util lib io meta lang flags bin macro hash line cons print config syscall socket cmd asm anal parse search diff bp reg debug core var sign trace vm th db
2009-02-05 21:08:46 +00:00
# Under development
#LIBLIST+=print
#LIBLIST+=util
#LIBLIST+=search
# 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-01-21 20:22:30 +00:00
libr : .objs libr 2.${EXT_SO } libr 2.${EXT_AR }
2010-01-14 11:13:48 +00:00
2010-01-21 20:22:30 +00:00
i f e q ( $( WITHPIC ) , 1 )
libr2.${EXT_SO} :
2010-02-21 20:34:10 +00:00
i f e q ( $( OSTYPE ) , d a r w i n )
@echo Linkage of libr2.dylib is broken on OSX because of dupped .o in .objs extraction
e l s e
2010-02-21 19:21:36 +00:00
${ CC } ${ LDFLAGS_LIB } ${ PIC_CFLAGS } .objs/*.o -o libr2.${ EXT_SO }
2010-02-21 20:34:10 +00:00
e n d i f
2010-01-26 00:28:33 +00:00
libr2.${EXT_AR} :
@echo No archive libr.a. Try --without-pic in configure
2010-01-21 20:22:30 +00:00
e l s e
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
e n d i f
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-24 22:47:18 +00:00
install-vapi :
@${ INSTALL_DIR } ${ PFX } /share/vala/vapi
${ INSTALL_DATA } vapi/*.vapi vapi/*.deps ${ PFX } /share/vala/vapi
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-01-31 13:22:27 +00:00
install-bins :
# programs
@${ INSTALL_DIR } ${ PFX } /bin
2010-02-21 19:21:36 +00:00
@for a in ` find */t -perm -u+x -type f | grep 2` ; \
2010-01-31 13:22:27 +00:00
do echo " $$ a ${ PFX } /bin " ; ${ INSTALL_PROGRAM } $$ a ${ PFX } /bin ; done
# shortcut
2010-02-21 19:21:36 +00:00
-cp -f ${ PFX } /bin/radare2 ${ PFX } /bin/r2
2010-01-31 13:22:27 +00:00
install-test-bins :
# test programs
@${ INSTALL_DIR } ${ PFX } /bin/libr-test
2010-02-21 19:21:36 +00:00
@for a in ` find */t -perm -u+x -type f | grep -v 2` ; \
2010-01-31 13:22:27 +00:00
do echo " $$ a ${ PFX } /bin/libr-test " ; \
${ INSTALL_PROGRAM } $$ a ${ PFX } /bin/libr-test ; done
install : install -includes install -vapi install -pkgconfig install -bins install -test -bins
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-02-21 19:21:36 +00:00
@for a in ` find * | grep -e '\.${EXT_SO}$$' | grep lib` ; do \
2010-01-18 21:14:19 +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-07-16 00:30:20 +00:00
#${INSTALL_DATA} libr.pc ${PFX}/lib/pkgconfig
2009-04-20 11:02:04 +00:00
@${ INSTALL_DIR } ${ PFX } /lib/radare2
2010-02-21 19:21:36 +00:00
@for a in ` find */p -perm -u+x -type f` ; \
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-02-21 19:21:36 +00:00
-@for a in ` find * | grep -e '\.${EXT_SO}$$' | grep lib` ; do \
2010-01-31 13:22:27 +00:00
a = ` echo $$ a | awk -F / '{ print $$NF; }' ` ; \
2009-03-06 00:38:23 +00:00
echo ${ PREFIX } /lib/$$ a ; rm -f ${ PREFIX } /lib/$$ a ; done
### object archives
-@for a in ` find * | grep -e '\.a$$' ` ; do \
2010-01-31 13:22:27 +00:00
a = ` echo $$ a | awk -F / '{ print $$NF; }' ` ; \
2009-03-06 00:38:23 +00:00
echo ${ PREFIX } /lib/$$ a ; rm -f ${ PREFIX } /lib/$$ a ; done
### includes
2009-03-07 17:47:59 +00:00
-( cd include && for a in * ; do rm -f ${ PREFIX } /libr/$$ a ; done )
2009-03-10 11:21:46 +00:00
cd vapi/ ; for a in *.vapi *.deps ; do rm -f ${ PREFIX } /share/vala/vapi/$$ a ; done
2009-03-06 00:38:23 +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; }' ` ; \
echo ${ PREFIX } /bin/$$ a ; rm -f ${ PREFIX } /bin/$$ a ; done
# plugins
2010-02-21 19:21:36 +00:00
-@for a in ` find */p -perm -u+x -type f` ; do \
2009-03-06 00:38:23 +00:00
a = " ${ PREFIX } /lib/radare2/`echo $$ a|awk -F / '{ print $$ NF; }'` " ; \
echo $$ a ; rm -f $$ a ; done
rm -rf ${ PREFIX } /lib/radare2
2009-03-09 13:08:53 +00:00
rm -f ${ PREFIX } /lib/pkgconfig/libr.pc
2009-07-16 00:30:20 +00:00
rm -f ${ PREFIX } /lib/pkgconfig/r_*.pc
2009-03-06 00:38:23 +00:00
# test programs
2010-02-21 19:21:36 +00:00
-@for a in ` find */t -perm -u+x -type f | grep -v 2` ; do \
2009-09-25 02:04:51 +00:00
a = " ${ PREFIX } /bin/libr-test/`echo $$ a|awk -F / '{ print $$ NF; }'` " ; \
2009-03-06 00:38:23 +00:00
echo $$ a ; rm -f $$ a ; done
2009-09-25 02:04:51 +00:00
rm -rf ${ PREFIX } /bin/libr-test
2009-03-06 00:38:23 +00:00
@echo libr aka radare2 has been uninstalled from PREFIX = ${ PREFIX }
2009-02-05 21:08:46 +00:00
todo :
2009-07-16 09:24:17 +00:00
grep -re TODO -e XXX *
2009-02-05 21:08:46 +00:00
clean :
for lib in ${ LIBLIST } ; do ( cd $$ { lib} && ${ MAKE } clean ) ; done
2009-02-16 23:09:40 +00:00
cd vapi/t && ${ MAKE } clean
2010-01-14 11:13:48 +00:00
rm -rf .objs
2009-06-15 02:44:05 +00:00
mrproper : clean
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-01-21 20:22:30 +00:00
.PHONY : sloc mrproper clean todo all pkgcfg install deinstall uninstall libr