2015-06-22 15:34:03 +00:00
|
|
|
include ../global.mk
|
2013-06-04 23:13:05 +00:00
|
|
|
include ../config-user.mk
|
2015-07-12 23:54:21 +00:00
|
|
|
# for EXT_EXE
|
|
|
|
include ../libr/config.mk
|
2015-10-09 15:58:03 +00:00
|
|
|
include ../mk/platform.mk
|
2015-07-13 09:21:21 +00:00
|
|
|
_INCLUDE_MK_GCC_=
|
|
|
|
include ../mk/${COMPILER}.mk
|
2013-06-04 23:13:05 +00:00
|
|
|
|
2016-01-22 19:53:01 +00:00
|
|
|
# Build against last capstone release or next
|
|
|
|
CS_RELEASE=0
|
|
|
|
|
2016-09-20 09:19:01 +00:00
|
|
|
CAPSTONE_CFLAGS?=-g
|
|
|
|
# CAPSTONE_MAKEFLAGS?=CAPSTONE_ARCHS="arm aarch64"
|
|
|
|
|
2016-02-03 12:22:05 +00:00
|
|
|
GIT?=git
|
2014-03-15 00:59:16 +00:00
|
|
|
WGET?=wget
|
2016-01-22 19:53:01 +00:00
|
|
|
|
|
|
|
ifeq ($(CS_RELEASE),1)
|
|
|
|
CS_VER=3.0.4
|
|
|
|
CS_TAR=https://codeload.github.com/aquynh/capstone/tar.gz/$(CS_VER)
|
|
|
|
#CS_TAR=http://capstone-engine.org/download/$(CS_VER)/capstone-$(CS_VER).tgz
|
|
|
|
CS_PATCHES=0
|
|
|
|
else
|
2014-05-14 23:36:04 +00:00
|
|
|
CS_TAR=
|
2015-06-22 15:34:03 +00:00
|
|
|
CS_URL=$(GIT_PREFIX)github.com/aquynh/capstone.git
|
2017-03-18 09:35:41 +00:00
|
|
|
CS_UPD=20170318
|
2014-10-16 08:19:37 +00:00
|
|
|
CS_BRA=next
|
2017-03-18 09:35:41 +00:00
|
|
|
CS_TIP=a28ae7d488dfe20855687f5a3ce842196896814a
|
2015-05-12 00:17:26 +00:00
|
|
|
# REVERT THIS COMMIT BECAUSE ITS WRONG
|
2015-08-13 14:55:58 +00:00
|
|
|
CS_REV=
|
2015-08-13 18:20:06 +00:00
|
|
|
CS_PATCHES=1
|
2016-01-22 19:53:01 +00:00
|
|
|
endif
|
2014-03-07 01:00:27 +00:00
|
|
|
|
2016-03-24 23:41:13 +00:00
|
|
|
.PHONY: capstone-sync capstone-build all clean mrproper libgdbr libwind bochs
|
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-07-14 10:13:08 +00:00
|
|
|
MODS=sdb zip udis86 java tcc
|
2015-02-07 00:41:54 +00:00
|
|
|
ifeq (1,$(WITH_GPL))
|
|
|
|
MODS+=grub
|
|
|
|
endif
|
2015-07-14 10:13:08 +00:00
|
|
|
MODS+=gdb
|
2016-04-17 20:38:04 +00:00
|
|
|
MODS+=qnx
|
2014-04-01 23:32:18 +00:00
|
|
|
SDB_URL=git://github.com/radare/sdb
|
|
|
|
#SDB_URL=/Users/pancake/prg/sdb
|
2016-12-18 08:46:10 +00:00
|
|
|
SPP_URL=git://github.com/radare/spp
|
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
|
|
|
|
2015-10-09 19:24:15 +00:00
|
|
|
CFLAGS_SHARED=${PIC_CFLAGS}
|
2014-07-18 12:12:33 +00:00
|
|
|
|
2015-07-12 23:54:21 +00:00
|
|
|
ifeq (${EXT_SO},)
|
|
|
|
all:
|
|
|
|
echo EXT_SO not defined
|
|
|
|
exit 1
|
|
|
|
endif
|
|
|
|
|
2016-03-24 23:41:13 +00:00
|
|
|
preall: targets libwind capstone-build bochs
|
2015-10-26 21:33:45 +00:00
|
|
|
@for MOD in ${MODS} ; do \
|
|
|
|
echo $(MAKE) -C $$MOD ; \
|
|
|
|
$(MAKE) -C $$MOD HAVE_VALA= ROOT="${PWD}/../" CC="${CC}" ; \
|
2013-05-13 23:53:52 +00:00
|
|
|
done
|
2012-09-02 23:27:52 +00:00
|
|
|
|
2015-08-09 02:32:22 +00:00
|
|
|
SDBFILES=sdb/src/.sdb${EXT_EXE} sdb/sdb${EXT_EXE} sdb/src/.sdb sdb/sdb
|
2016-03-24 23:41:13 +00:00
|
|
|
PREMODS=capstone gdb wind sdb bochs
|
2015-08-09 02:32:22 +00:00
|
|
|
|
2012-08-10 09:35:38 +00:00
|
|
|
clean mrproper:
|
2015-08-09 02:32:22 +00:00
|
|
|
rm -f ${SDBFILES}
|
2015-10-26 21:33:45 +00:00
|
|
|
@for MOD in ${PREMODS} ${MODS} ; do $(MAKE) -C $$MOD clean ; done
|
2013-04-30 23:29:06 +00:00
|
|
|
|
2015-07-13 09:21:21 +00:00
|
|
|
ifeq ($(BUILD_OS),windows)
|
|
|
|
BUILD_EXT_EXE=.exe
|
|
|
|
else
|
|
|
|
BUILD_EXT_EXE=
|
|
|
|
endif
|
|
|
|
|
2015-07-14 10:13:08 +00:00
|
|
|
SDB_TARGETS=$(SDBLIB)
|
|
|
|
ifneq (${EXT_EXE},)
|
|
|
|
SDB_TARGETS+=sdb/sdb${EXT_EXE}
|
|
|
|
else
|
|
|
|
SDB_TARGETS+=sdb/sdb
|
|
|
|
endif
|
2015-07-14 16:38:16 +00:00
|
|
|
|
2015-08-09 02:28:31 +00:00
|
|
|
ifeq ($(filter sdb/sdb${BUILD_EXT_EXE},$(SDB_TARGETS)),)
|
2015-07-14 10:13:08 +00:00
|
|
|
SDB_TARGETS+=sdb/sdb${BUILD_EXT_EXE}
|
|
|
|
endif
|
|
|
|
|
2015-07-14 22:52:23 +00:00
|
|
|
targets:
|
2015-10-26 21:33:45 +00:00
|
|
|
for TARGET in ${SDB_TARGETS} ; do ${MAKE} $$TARGET ; done
|
2015-07-14 10:13:08 +00:00
|
|
|
|
|
|
|
${SDB_TARGETS}:
|
2015-07-13 09:21:21 +00:00
|
|
|
@echo
|
|
|
|
@echo BUILD SUMARY
|
|
|
|
@echo ============
|
|
|
|
@echo COMPILER ${COMPILER}
|
|
|
|
@echo CC ${CC}
|
|
|
|
@echo HOST_CC ${HOST_CC}
|
|
|
|
@echo HOST_OS ${HOST_OS}
|
|
|
|
@echo BUILD_OS ${BUILD_OS}
|
|
|
|
@echo ============
|
|
|
|
@echo
|
2015-07-13 13:22:37 +00:00
|
|
|
@echo ">>>>>>>>>>>>>>>>"
|
|
|
|
@echo "NATIVE BUILD SDB"
|
|
|
|
@echo ">>>>>>>>>>>>>>>>"
|
|
|
|
@echo
|
|
|
|
$(MAKE) -C sdb clean
|
|
|
|
$(MAKE) -C sdb src/sdb_version.h
|
2016-09-16 08:15:17 +00:00
|
|
|
$(MAKE) -C sdb/src CC=${HOST_CC} LDFLAGS='${HOST_LDFLAGS}' CPPFLAGS='' CFLAGS='${HOST_CFLAGS} -fPIC' bin
|
2015-07-13 13:22:37 +00:00
|
|
|
cp -f sdb/src/sdb${BUILD_EXT_EXE} sdb/src/.sdb${BUILD_EXT_EXE}
|
|
|
|
@echo
|
|
|
|
@echo ">>>>>>>>>>>>>>>>"
|
|
|
|
@echo "TARGET BUILD SDB"
|
|
|
|
@echo ">>>>>>>>>>>>>>>>"
|
|
|
|
@echo
|
|
|
|
$(MAKE) -C sdb 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
|
2015-10-14 23:50:30 +00:00
|
|
|
ifneq (${EXT_AR},a)
|
2015-07-13 09:21:21 +00:00
|
|
|
-cp -f sdb/src/libsdb.a sdb/src/libsdb.${EXT_AR}
|
2015-07-13 13:22:37 +00:00
|
|
|
endif
|
2015-07-13 09:21:21 +00:00
|
|
|
rm -f $@
|
2015-07-13 22:08:04 +00:00
|
|
|
cp -f sdb/src/.sdb${BUILD_EXT_EXE} $@
|
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:
|
2016-03-24 23:41:13 +00:00
|
|
|
$(MAKE) -C gdb all
|
2014-02-21 14:20:41 +00:00
|
|
|
|
2014-08-31 16:09:25 +00:00
|
|
|
libwind:
|
2016-03-24 23:41:13 +00:00
|
|
|
$(MAKE) -C wind all
|
|
|
|
|
|
|
|
bochs:
|
|
|
|
$(MAKE) -C bochs all
|
2014-08-31 16:09:25 +00:00
|
|
|
|
2015-07-13 09:21:21 +00:00
|
|
|
sdb-clean clean-sdb:
|
|
|
|
$(MAKE) -C sdb clean
|
|
|
|
rm -f sdb/sdb.exe
|
|
|
|
rm -f sdb/src/libsdb.a
|
|
|
|
|
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
|
2015-07-13 13:22:37 +00:00
|
|
|
rm -f src/sdb_version.h
|
|
|
|
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
|
2016-05-09 07:52:54 +00:00
|
|
|
HFILES+=elf.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 _
|
2016-02-03 12:22:05 +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
|
2015-10-26 21:33:45 +00:00
|
|
|
for FILE in ${CFILES} ${HFILES} ; do cp -f _/$$FILE tcc ; done
|
2013-06-04 23:13:05 +00:00
|
|
|
cp -f _/VERSION _/COPYING _/stab.def tcc
|
2016-02-03 12:22:05 +00:00
|
|
|
$(GIT) add tcc
|
2013-06-04 23:13:05 +00:00
|
|
|
rm -rf _
|
2013-06-05 07:29:27 +00:00
|
|
|
|
|
|
|
install:
|
2015-10-26 21:33:45 +00:00
|
|
|
#mkdir -p ${DESTDIR}${LIBDIR}
|
|
|
|
#cp -f tcc/libr_tcc* ${DESTDIR}${LIBDIR}
|
|
|
|
#cp -f zip/libr_z* ${DESTDIR}${LIBDIR}
|
2013-06-05 07:29:27 +00:00
|
|
|
|
2013-06-05 14:15:39 +00:00
|
|
|
install-symlink symstall:
|
2015-10-26 21:33:45 +00:00
|
|
|
mkdir -p "${DESTDIR}${LIBDIR}"
|
|
|
|
#cd tcc ; for FILE in libr_tcc* ; do \
|
|
|
|
# ln -fs `pwd`/$$FILE ${DESTDIR}${LIBDIR}/$$FILE ; done
|
2013-06-05 07:29:27 +00:00
|
|
|
|
|
|
|
uninstall deinstall:
|
2015-10-26 21:33:45 +00:00
|
|
|
#rm -f ${DESTDIR}${LIBDIR}/libr_tcc*
|
|
|
|
#rm -f ${DESTDIR}${LIBDIR}/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
|
|
|
|
2016-01-22 19:53:01 +00:00
|
|
|
ifeq ($(CS_RELEASE),1)
|
2014-03-07 02:16:10 +00:00
|
|
|
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
|
2016-01-22 19:53:01 +00:00
|
|
|
ifeq ($(CS_PATCHES),1)
|
2016-08-06 04:12:58 +00:00
|
|
|
#cd capstone ; for PATCH in ../capstone-patches/* ; do patch -tp1 < $$PATCH ; done
|
|
|
|
cd capstone ; for PATCH in ../capstone-patches/* ; do patch -p1 < $$PATCH ; done
|
2016-01-22 19:53:01 +00:00
|
|
|
endif
|
|
|
|
mkdir -p capstone/include/capstone
|
|
|
|
cp -rf capstone/include/*.h capstone/include/capstone
|
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)
|
2016-01-22 19:53:01 +00:00
|
|
|
else
|
|
|
|
|
|
|
|
capstone: capstone-sync
|
|
|
|
|
|
|
|
capstone-sync:
|
|
|
|
"$(SHELL)" capstone.sh "${CS_URL}" "${CS_BRA}" "${CS_TIP}" "${CS_REV}"
|
|
|
|
ifeq ($(CS_PATCHES),1)
|
2016-02-03 12:22:05 +00:00
|
|
|
-cd capstone ; $(GIT) reset --hard
|
2016-08-06 10:17:28 +00:00
|
|
|
#cd capstone ; for PATCH in ../capstone-patches/* ; do patch -tp1 < $$PATCH ; done
|
|
|
|
cd capstone ; for PATCH in ../capstone-patches/* ; do patch -p1 < $$PATCH ; done
|
2016-01-22 19:53:01 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: capstone
|
2014-03-07 02:16:10 +00:00
|
|
|
endif
|
2014-05-07 15:05:42 +00:00
|
|
|
|
2015-07-13 00:45:45 +00:00
|
|
|
ifeq (${EXT_AR},)
|
|
|
|
all:
|
|
|
|
echo EXT_AR is not defined
|
|
|
|
exit 1
|
|
|
|
endif
|
|
|
|
|
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)" \
|
2016-09-20 09:19:01 +00:00
|
|
|
$(MAKE) $(CAPSTONE_MAKEFLAGS) CC="$(CC)" AR_EXT=a IS_CYGWIN=0 CAPSTONE_STATIC=yes CAPSTONE_SHARED=no \
|
2015-07-13 00:45:45 +00:00
|
|
|
RANLIB="$(RANLIB)" AR="$(AR)" IS_MINGW=0 libcapstone.a
|
2015-10-14 23:50:30 +00:00
|
|
|
ifneq (${EXT_AR},a)
|
2015-07-13 09:21:21 +00:00
|
|
|
-cp -f capstone/libcapstone.a capstone/libcapstone.${EXT_AR}
|
2014-06-24 10:48:29 +00:00
|
|
|
endif
|
2015-10-14 23:50:30 +00:00
|
|
|
endif
|
2017-03-18 22:19:27 +00:00
|
|
|
../../radare2-webui:
|
|
|
|
cd ../.. ; git clone --depth 1 https://github.com/radare/radare2-webui
|
2016-07-03 23:33:49 +00:00
|
|
|
|
2017-03-18 22:19:27 +00:00
|
|
|
../../radare2-webui/dist/m: ../../radare2-webui
|
|
|
|
cd ../../radare2-webui/www/m ; git pull ; npm install ; $(MAKE) release
|
|
|
|
|
|
|
|
www-sync-m sync-www-m: ../../radare2-webui/dist/m
|
2016-07-03 23:33:49 +00:00
|
|
|
cp -rf ../../radare2-webui/dist/m www/m.tmp
|
|
|
|
rm -rf www/m
|
|
|
|
mv www/m.tmp www/m
|
|
|
|
git add www/m
|
|
|
|
|
2016-10-20 23:28:05 +00:00
|
|
|
www-sync-p sync-www-p:
|
2016-07-03 23:33:49 +00:00
|
|
|
cp -rf ../../radare2-webui/dist/p www/p.tmp
|
|
|
|
rm -rf www/p
|
|
|
|
mv www/p.tmp www/p
|
|
|
|
git add www/p
|
|
|
|
|
2016-10-20 23:28:05 +00:00
|
|
|
www-sync-t sync-www-t:
|
2016-07-03 23:33:49 +00:00
|
|
|
cp -rf ../../radare2-webui/dist/t www/t.tmp
|
|
|
|
rm -rf www/t
|
|
|
|
mv www/t.tmp www/t
|
|
|
|
git add www/p
|
|
|
|
|
2016-10-20 23:28:05 +00:00
|
|
|
sync-www www-sync: www-sync-m www-sync-p www-sync-t
|
2016-07-03 23:33:49 +00:00
|
|
|
@echo webui sync done
|
2016-12-18 08:46:10 +00:00
|
|
|
|
2016-12-19 02:05:42 +00:00
|
|
|
spp-sync sync-spp:
|
|
|
|
-git rm -r spp
|
2016-12-18 08:46:10 +00:00
|
|
|
rm -rf spp
|
|
|
|
git clone --depth 1 ${SPP_URL} spp
|
2016-12-19 02:05:42 +00:00
|
|
|
rm -rf spp/.git*
|
|
|
|
rm -rf spp/t
|
|
|
|
git add spp
|
2016-12-18 08:46:10 +00:00
|
|
|
|
|
|
|
spp: spp-sync
|
2017-02-11 11:50:38 +00:00
|
|
|
CFLAGS=-fPIC $(MAKE) -C spp
|
2016-12-18 08:46:10 +00:00
|
|
|
|
|
|
|
.PHONY: spp
|