2013-06-04 23:13:05 +00:00
|
|
|
include ../config-user.mk
|
2013-08-27 00:00:21 +00:00
|
|
|
include ../mk/${COMPILER}.mk
|
2013-06-04 23:13:05 +00:00
|
|
|
|
2014-03-15 00:59:16 +00:00
|
|
|
WGET?=wget
|
2014-12-16 23:24:07 +00:00
|
|
|
CS_VER=3.0
|
|
|
|
CS_TAR=http://capstone-engine.org/download/$(CS_VER)/capstone-$(CS_VER).tgz
|
2014-05-14 23:36:04 +00:00
|
|
|
CS_TAR=
|
2015-02-10 02:51:36 +00:00
|
|
|
CS_URL=https://www.github.com/aquynh/capstone.git
|
2015-05-12 00:17:26 +00:00
|
|
|
CS_UPD=20150512
|
2014-10-16 08:19:37 +00:00
|
|
|
CS_BRA=next
|
2015-05-12 00:17:26 +00:00
|
|
|
CS_TIP=c42effd51cac83a4010f5a1517233a23aa1bedef
|
|
|
|
# REVERT THIS COMMIT BECAUSE ITS WRONG
|
|
|
|
CS_REV=21b9b25e9dae4af0ef309d4089a54e53b8f5b479
|
2014-03-07 01:00:27 +00:00
|
|
|
|
2014-08-31 16:09:25 +00:00
|
|
|
.PHONY: capstone-sync capstone-build all clean mrproper libgdbr libwind
|
2014-03-07 01:00:27 +00:00
|
|
|
|
2013-08-26 22:52:04 +00:00
|
|
|
HOST_CC?=gcc
|
2013-12-22 03:37:05 +00:00
|
|
|
SHLR?=$(shell pwd)
|
|
|
|
AR?=ar
|
|
|
|
RANLIB?=ranlib
|
2015-02-07 00:41:54 +00:00
|
|
|
MODS=sdb udis86 java tcc zip
|
|
|
|
ifeq (1,$(WITH_GPL))
|
|
|
|
MODS+=grub
|
|
|
|
endif
|
2014-04-01 23:32:18 +00:00
|
|
|
SDB_URL=git://github.com/radare/sdb
|
|
|
|
#SDB_URL=/Users/pancake/prg/sdb
|
2013-05-13 23:53:52 +00:00
|
|
|
PWD=$(shell pwd)
|
|
|
|
SDB_CONFIG=${PWD}/sdb-config.mk
|
2013-04-30 23:29:06 +00:00
|
|
|
|
2014-07-18 14:31:03 +00:00
|
|
|
ifneq (,$(findstring cygwin,${OSTYPE})$(findstring mingw32,${OSTYPE}))
|
2014-07-18 12:12:33 +00:00
|
|
|
CFLAGS_SHARED=
|
|
|
|
else
|
2014-07-18 13:18:09 +00:00
|
|
|
CFLAGS_SHARED=-fPIC
|
2014-07-18 12:12:33 +00:00
|
|
|
endif
|
|
|
|
|
2014-08-31 16:09:25 +00:00
|
|
|
preall: sdb/sdb libgdbr libwind capstone-build
|
2013-05-13 23:53:52 +00:00
|
|
|
@for a in ${MODS} ; do \
|
2014-05-08 23:09:09 +00:00
|
|
|
echo $(MAKE) -C $$a ; \
|
|
|
|
$(MAKE) -C $$a RANLIB="$(RANLIB)" CC_AR="$(CC_AR)" HAVE_VALA= ROOT="${PWD}/../" CC="${CC}" ; \
|
2013-05-13 23:53:52 +00:00
|
|
|
done
|
2012-09-02 23:27:52 +00:00
|
|
|
|
2012-08-10 09:35:38 +00:00
|
|
|
clean mrproper:
|
2014-03-09 23:33:29 +00:00
|
|
|
-cd capstone && $(MAKE) clean
|
|
|
|
cd gdb && $(MAKE) clean
|
2014-08-31 16:09:25 +00:00
|
|
|
cd wind && $(MAKE) clean
|
2013-09-13 22:45:49 +00:00
|
|
|
rm -f sdb/src/.sdb sdb/sdb
|
2014-05-08 23:09:09 +00:00
|
|
|
cd sdb && $(MAKE) clean
|
2015-01-29 01:05:49 +00:00
|
|
|
rm -f sdb/sdb
|
2014-05-08 23:09:09 +00:00
|
|
|
@for a in ${MODS} ; do $(MAKE) -C $$a clean ; done
|
2013-04-30 23:29:06 +00:00
|
|
|
|
2013-08-26 23:32:51 +00:00
|
|
|
$(SDBLIB) sdb/sdb:
|
2014-05-08 23:09:09 +00:00
|
|
|
cd sdb ; $(MAKE) src/sdb-version.h
|
|
|
|
cd sdb ; $(MAKE) clean
|
2013-08-26 22:52:04 +00:00
|
|
|
cd sdb ; \
|
2014-05-08 23:09:09 +00:00
|
|
|
$(MAKE) clean && \
|
2015-04-30 21:19:31 +00:00
|
|
|
$(MAKE) CC=${HOST_CC} CFLAGS='${HOST_CFLAGS} -fPIC' && \
|
2013-09-06 22:39:08 +00:00
|
|
|
cp -f src/sdb src/.sdb
|
2014-05-08 23:09:09 +00:00
|
|
|
cd sdb ; $(MAKE) clean
|
|
|
|
cd sdb ; $(MAKE) src/sdb-version.h
|
2014-07-18 12:12:33 +00:00
|
|
|
cd sdb/src ; $(MAKE) ARCH=xxx RANLIB="${RANLIB}" CFLAGS_SHARED="${CFLAGS_SHARED}" \
|
2015-01-29 11:30:07 +00:00
|
|
|
CC="${CC}" AR="${AR}" CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" libsdb.a
|
2013-08-26 22:52:04 +00:00
|
|
|
${RANLIB} sdb/src/libsdb.a
|
2013-09-06 22:39:08 +00:00
|
|
|
cp -f sdb/src/.sdb sdb/sdb
|
2013-08-26 22:52:04 +00:00
|
|
|
|
2013-04-30 23:29:06 +00:00
|
|
|
.PHONY: sdb-sync sync-sdb sdbclean
|
2013-12-31 04:30:39 +00:00
|
|
|
F=README.md config.mk src Makefile Jamroot
|
2013-04-30 23:29:06 +00:00
|
|
|
SYNCFILES=$(addprefix sdb.vc/,${F})
|
|
|
|
I=../libr/include
|
|
|
|
|
2014-02-21 14:20:41 +00:00
|
|
|
libgdbr:
|
2014-03-07 01:00:27 +00:00
|
|
|
cd gdb ; $(MAKE) all
|
2014-02-21 14:20:41 +00:00
|
|
|
|
2014-08-31 16:09:25 +00:00
|
|
|
libwind:
|
|
|
|
cd wind; $(MAKE) all
|
|
|
|
|
2013-04-30 23:29:06 +00:00
|
|
|
sdb-sync sync-sdb:
|
|
|
|
rm -rf sdb sdb.vc
|
2014-12-30 04:19:50 +00:00
|
|
|
git clone --depth 1 ${SDB_URL} sdb.vc
|
2013-04-30 23:29:06 +00:00
|
|
|
mkdir -p sdb
|
|
|
|
cp -rf ${SYNCFILES} sdb
|
|
|
|
rm -rf sdb.vc $I/sdb
|
|
|
|
mkdir -p $I/sdb
|
2013-07-16 15:48:26 +00:00
|
|
|
rm -f src/sdb-version.h
|
2014-05-08 23:09:09 +00:00
|
|
|
cd sdb ; $(MAKE) src/sdb-version.h
|
2013-04-30 23:29:06 +00:00
|
|
|
cp -f sdb/src/*.h $I/sdb
|
|
|
|
echo '#include <sdb/sdb.h>' > $I/sdb.h
|
2013-04-30 23:43:35 +00:00
|
|
|
mkdir -p sdb/test sdb/memcache
|
2013-07-19 01:35:45 +00:00
|
|
|
sed -e 's,HAVE_VALA=,HAVE_VALA=#,' sdb/config.mk > .t
|
|
|
|
mv .t sdb/config.mk
|
2013-06-04 23:13:05 +00:00
|
|
|
echo all clean mrproper: | tee sdb/test/Makefile > sdb/memcache/Makefile
|
2013-04-30 23:29:06 +00:00
|
|
|
git add $I/sdb*
|
|
|
|
git add sdb
|
2013-06-04 23:13:05 +00:00
|
|
|
|
|
|
|
$(TCCLIB) libr_tcc/libr_tcc.a:
|
2014-05-08 23:09:09 +00:00
|
|
|
cd libr_tcc ; $(MAKE)
|
2013-06-04 23:13:05 +00:00
|
|
|
|
2013-06-09 22:28:55 +00:00
|
|
|
udis-sync udis86-sync sync-udis sync-udis86:
|
2014-05-08 23:09:09 +00:00
|
|
|
cd udis86 ; $(MAKE) sync
|
2013-06-09 22:28:55 +00:00
|
|
|
|
2013-06-04 23:13:05 +00:00
|
|
|
tcc-clean tccclean:
|
2014-05-08 23:09:09 +00:00
|
|
|
cd libr_tcc ; $(MAKE) clean
|
2013-06-04 23:13:05 +00:00
|
|
|
|
|
|
|
CFILES=i386-asm.c i386-gen.c libtcc.c tccasm.c tccelf.c tccgen.c tccpp.c
|
|
|
|
HFILES=tcc.h i386-asm.h tcclib.h tcctok.h stab.h
|
2013-06-05 07:29:27 +00:00
|
|
|
HFILES+=elf.h libtcc.h config.h i386-tok.h
|
2013-06-04 23:13:05 +00:00
|
|
|
|
|
|
|
# TODO: use mob branch?
|
|
|
|
|
|
|
|
.PHONY: sdb-sync sync-sdb sdbclean
|
|
|
|
tcc-sync sync-tcc:
|
|
|
|
rm -rf _
|
2014-12-30 04:19:50 +00:00
|
|
|
git clone --depth 1 git://repo.or.cz/tinycc.git _
|
2013-06-04 23:13:05 +00:00
|
|
|
cd _ ; ./configure --prefix=${PREFIX}
|
|
|
|
mkdir -p tcc
|
|
|
|
for a in ${CFILES} ${HFILES} ; do cp -f _/$$a tcc ; done
|
|
|
|
cp -f _/VERSION _/COPYING _/stab.def tcc
|
|
|
|
git add tcc
|
|
|
|
rm -rf _
|
2013-06-05 07:29:27 +00:00
|
|
|
|
2014-09-01 15:18:23 +00:00
|
|
|
D=$(call rmdblslash,${DESTDIR}/${PREFIX})
|
2013-06-05 07:29:27 +00:00
|
|
|
install:
|
2013-12-29 02:20:53 +00:00
|
|
|
#mkdir -p ${D}/lib
|
|
|
|
#cp -f tcc/libr_tcc* ${D}/lib
|
2013-11-14 12:57:01 +00:00
|
|
|
#cp -f zip/libr_z* ${D}/lib
|
2013-06-05 07:29:27 +00:00
|
|
|
|
2013-06-05 14:15:39 +00:00
|
|
|
install-symlink symstall:
|
2013-06-05 07:29:27 +00:00
|
|
|
mkdir -p ${D}/lib
|
2013-12-29 02:20:53 +00:00
|
|
|
#cd tcc ; for a in libr_tcc* ; do \
|
|
|
|
# ln -fs `pwd`/$$a ${D}/lib/$$a ; done
|
2013-06-05 07:29:27 +00:00
|
|
|
|
|
|
|
uninstall deinstall:
|
2013-12-29 02:20:53 +00:00
|
|
|
#rm -f ${D}/lib/libr_tcc*
|
2013-11-14 12:57:01 +00:00
|
|
|
#rm -f ${D}/lib/libr_z*
|
2014-03-07 01:00:27 +00:00
|
|
|
|
2014-06-24 10:48:29 +00:00
|
|
|
ifeq ($(USE_CAPSTONE),1)
|
|
|
|
# Do nothing here
|
|
|
|
capstone:
|
|
|
|
|
|
|
|
capstone-sync:
|
|
|
|
|
|
|
|
capstone-build:
|
|
|
|
|
|
|
|
else
|
2014-03-07 02:16:10 +00:00
|
|
|
|
|
|
|
ifeq ($(CS_TAR),)
|
2014-05-07 15:05:42 +00:00
|
|
|
capstone: capstone-sync
|
2014-03-07 01:00:27 +00:00
|
|
|
|
|
|
|
capstone-sync:
|
2014-05-15 18:13:47 +00:00
|
|
|
if [ ! -d capstone ]; then \
|
2014-03-07 01:00:27 +00:00
|
|
|
git clone $(CS_URL) ; \
|
|
|
|
fi
|
|
|
|
cd capstone ; \
|
2015-05-12 00:17:26 +00:00
|
|
|
git reset --hard @^^^ ; \
|
2014-05-07 15:05:42 +00:00
|
|
|
git checkout $(CS_BRA) ; \
|
2014-05-22 10:37:21 +00:00
|
|
|
git reset --hard $(CS_TIP) || \
|
2014-05-26 10:16:36 +00:00
|
|
|
( if [ -d .git ]; then \
|
|
|
|
git pull ; git reset --hard $(CS_TIP) ; \
|
|
|
|
else true ; fi)
|
2015-05-12 00:17:26 +00:00
|
|
|
if [ -n "${CS_REV}" ]; then \
|
|
|
|
cd capstone ; \
|
2015-05-12 07:36:17 +00:00
|
|
|
git config --global user.name "radare-travis" ; \
|
|
|
|
git config --global user.email radare-travis@foo.com ; \
|
2015-05-12 00:17:26 +00:00
|
|
|
EDITOR=cat git revert ${CS_REV} ; \
|
|
|
|
fi
|
2014-05-07 15:05:42 +00:00
|
|
|
|
|
|
|
.PHONY: capstone
|
2014-03-07 02:16:10 +00:00
|
|
|
else
|
|
|
|
|
|
|
|
capstone-sync: capstone
|
|
|
|
|
2014-04-18 15:18:48 +00:00
|
|
|
capstone-clean:
|
|
|
|
cd capstone ; $(MAKE) clean
|
|
|
|
|
2014-03-07 02:16:10 +00:00
|
|
|
capstone: capstone-$(CS_VER).tar.gz
|
|
|
|
tar xzvf capstone-$(CS_VER).tar.gz
|
|
|
|
rm -rf capstone
|
|
|
|
mv capstone-$(CS_VER) capstone
|
2014-03-15 00:59:16 +00:00
|
|
|
#cd capstone ; for a in ../capstone-patches/* ; do patch -p1 < $$a ; done
|
2014-03-07 02:16:10 +00:00
|
|
|
|
|
|
|
capstone-$(CS_VER).tar.gz:
|
2014-03-15 00:59:16 +00:00
|
|
|
$(WGET) --no-check-certificate -O capstone-$(CS_VER).tar.gz -c $(CS_TAR)
|
2014-03-07 02:16:10 +00:00
|
|
|
endif
|
2014-05-07 15:05:42 +00:00
|
|
|
|
2014-07-02 00:57:18 +00:00
|
|
|
CAPSTONE_CFLAGS=-g
|
|
|
|
|
2014-05-07 15:05:42 +00:00
|
|
|
capstone-build: capstone
|
2014-07-02 00:57:18 +00:00
|
|
|
cd capstone && CFLAGS="-Dmips=mips ${CAPSTONE_CFLAGS} $(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
|
2014-07-18 07:01:36 +00:00
|
|
|
$(MAKE) CC="$(CC)" AR_EXT=a IS_CYGWIN=0 CAPSTONE_STATIC=yes CAPSTONE_SHARED=no \
|
|
|
|
RANLIB="$(RANLIB)" AR="$(AR)" IS_MINGW=0 \
|
|
|
|
./libcapstone.a
|
2014-06-24 10:48:29 +00:00
|
|
|
endif
|