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
|
2015-10-09 15:58:03 +00:00
|
|
|
include ../mk/platform.mk
|
2013-09-06 22:39:08 +00:00
|
|
|
include ../mk/${COMPILER}.mk
|
2009-04-01 00:28:13 +00:00
|
|
|
|
2015-10-26 21:33:45 +00:00
|
|
|
DESTDIR:=$(DESTDIR)
|
2009-04-01 00:28:13 +00:00
|
|
|
PREFIX?=${PWD}/../prefix
|
2017-10-18 23:07:47 +00:00
|
|
|
|
|
|
|
S=$
|
|
|
|
B=`
|
2015-10-26 21:33:45 +00:00
|
|
|
PWD=$(shell pwd)
|
2009-02-05 21:08:46 +00:00
|
|
|
|
2013-03-03 23:44:46 +00:00
|
|
|
LIBS0=util hash
|
2016-06-17 10:14:39 +00:00
|
|
|
LIBS1=socket reg cons magic bp search config
|
2016-10-26 23:02:26 +00:00
|
|
|
LIBS2=syscall lang io crypto flag
|
2017-05-28 20:38:10 +00:00
|
|
|
LIBS3=fs anal bin parse
|
|
|
|
LIBS4=asm
|
|
|
|
LIBS5=egg
|
|
|
|
LIBS6=debug
|
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:
|
2017-10-18 23:07:47 +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)
|
2017-10-18 23:07:47 +00:00
|
|
|
$(MAKE) libr.${EXT_AR}
|
2017-10-09 08:53:41 +00:00
|
|
|
endif
|
|
|
|
|
2017-07-04 00:10:43 +00:00
|
|
|
libr.${EXT_SO}:
|
2017-10-18 23:07:47 +00:00
|
|
|
rm -rf .libr/tcc # WHY
|
|
|
|
$(CC) $(LDFLAGS) -shared -dynamic -arch arm64 -o libr.${EXT_SO} .libr/*/*.o ../shlr/gdb/lib/libgdbr.a
|
|
|
|
|
Simplify and unbreak libr.a generation.
libr.a is a static library that combines every library r2 builds
and/or depends on, which means that they should be repackaged.
Before this commit, the situation was quite sorry:
* Makefile-ar.mk was parameterized by ARTYPE;
* there were three ARTYPEs, default, gnu and ios;
* the ios ARTYPE was not used and instead its logic was folded
into default;
* the gnu ARTYPE was obviously broken (typo in "rm -f libr.",
typo in "$(C_AR)") preventing it from ever running correctly;
* the default ARTYPE created libraries that did not link
on e.g. a Linux desktop, since the libr.a it created consisted
only of another .a files, and this just results in an error
trying to link:
libr.a: error adding symbols: Archive has no index; run ranlib to add one
* the default ARTYPE, when targeting iOS, performed a bunch of
useless work combining the archives as above, and then just
delegated to libtool, which overwrites the result.
After this commit:
* there is no ARTYPE (nothing in the r2 tree sets it anyway);
* there are no platform-specific assumptions about ar, such
as support for the -M option;
* there is only one code path;
* every archive is partially linked into a single object file
and then added to libr.a.
2018-01-08 09:22:18 +00:00
|
|
|
libr.${EXT_AR}: $(wildcard */libr_*.${EXT_AR}) $(shell find ../shlr -name '*.${EXT_AR}')
|
|
|
|
rm -rf .libr
|
|
|
|
mkdir .libr
|
|
|
|
for LIB in $^ ; do \
|
|
|
|
${PARTIALLD} -o .libr/$$(basename $${LIB} .a).o $${LIB} ; \
|
|
|
|
done
|
|
|
|
${AR} crs $@ .libr/*.o
|
2012-10-03 23:20:00 +00:00
|
|
|
|
|
|
|
$(LIBS):
|
|
|
|
@echo "DIR $@"
|
2017-10-18 23:07:47 +00:00
|
|
|
@$(MAKE) -C $@
|
2009-02-05 21:08:46 +00:00
|
|
|
|
2009-07-16 00:30:20 +00:00
|
|
|
pkgcfg:
|
2017-10-18 23:07:47 +00:00
|
|
|
@for lib in ${LIBS}; do $(MAKE) -C $${lib} pkgcfg; done
|
2017-10-18 15:53:00 +00:00
|
|
|
$(MAKE) -C asm pkgcfg NAME=libr DEPS="r_`echo ${LIBS}|sed -e 's, , r_,g'`"
|
2012-10-03 12:31:35 +00:00
|
|
|
# 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:
|
2015-10-26 21:33:45 +00:00
|
|
|
${INSTALL_DIR} "${DESTDIR}${LIBDIR}/pkgconfig"
|
|
|
|
for FILE in ../pkgcfg/*.pc ; do \
|
|
|
|
rm -f "${DESTDIR}${LIBDIR}/pkgconfig/$$FILE" ; \
|
|
|
|
${INSTALL_DATA} $$FILE "${DESTDIR}${LIBDIR}/pkgconfig" ; done
|
2010-01-25 10:54:25 +00:00
|
|
|
|
2010-01-27 00:50:26 +00:00
|
|
|
install-includes:
|
2015-10-26 21:33:45 +00:00
|
|
|
@-rm -f "${DESTDIR}${INCLUDEDIR}/libr/sflib"
|
|
|
|
@-rm -f "${DESTDIR}${INCLUDEDIR}/libr"
|
|
|
|
${INSTALL_DIR} "${DESTDIR}${INCLUDEDIR}/libr"
|
|
|
|
(cd include && for FILE in *.h ; do ${INSTALL_DATA} $$FILE "${DESTDIR}${INCLUDEDIR}/libr" ; done)
|
|
|
|
${INSTALL_DIR} "${DESTDIR}${INCLUDEDIR}/libr/sflib"
|
|
|
|
(cd include/sflib && for DIR in * ; do \
|
|
|
|
${INSTALL_DIR} "${DESTDIR}${INCLUDEDIR}/libr/sflib/$$DIR" ; \
|
|
|
|
for FILE in $$DIR/*.h ; do \
|
|
|
|
${INSTALL_DATA} $$FILE "${DESTDIR}${INCLUDEDIR}/libr/sflib/$$FILE" ; \
|
2011-12-01 19:17:40 +00:00
|
|
|
done ; \
|
|
|
|
done)
|
2015-10-26 21:33:45 +00:00
|
|
|
${INSTALL_DIR} "${DESTDIR}${INCLUDEDIR}/libr/sdb"
|
|
|
|
(cd include/sdb && for FILE in * ; do \
|
|
|
|
${INSTALL_DATA} $$FILE "${DESTDIR}${INCLUDEDIR}/libr/sdb/$$FILE" ; \
|
2012-10-11 08:44:22 +00:00
|
|
|
done)
|
2016-07-09 21:04:38 +00:00
|
|
|
${INSTALL_DIR} "${DESTDIR}${INCLUDEDIR}/libr/r_util"
|
|
|
|
(cd include/r_util && for FILE in * ; do \
|
|
|
|
${INSTALL_DATA} $$FILE "${DESTDIR}${INCLUDEDIR}/libr/r_util/$$FILE" ; \
|
|
|
|
done)
|
2010-01-27 00:50:26 +00:00
|
|
|
|
2012-10-03 12:31:35 +00:00
|
|
|
symstall install-symlink:
|
2017-10-18 23:07:47 +00:00
|
|
|
@cd .. && \
|
2015-10-26 21:33:45 +00:00
|
|
|
mkdir -p "${DESTDIR}${BINDIR}" \
|
|
|
|
"${DESTDIR}${INCLUDEDIR}" \
|
|
|
|
"${DESTDIR}${LIBDIR}/pkgconfig" \
|
2017-10-18 23:07:47 +00:00
|
|
|
"${DESTDIR}${LIBDIR}/radare2/${VERSION}" ; \
|
|
|
|
rm -rf "${DESTDIR}${INCLUDEDIR}/libr" && ln -fs "${PWD}/include" "${DESTDIR}${INCLUDEDIR}/libr" ; \
|
|
|
|
$(MAKE) install-pkgconfig-symlink ; \
|
2017-10-19 20:01:32 +00:00
|
|
|
$(foreach lib,${LIBS}, \
|
2014-07-09 23:13:04 +00:00
|
|
|
ln -fs "${PWD}/$(lib)/libr_$(lib).${EXT_SO}" \
|
2015-10-26 21:33:45 +00:00
|
|
|
"${DESTDIR}${LIBDIR}/libr_$(lib).${EXT_SO}" ; \
|
2014-07-09 23:13:04 +00:00
|
|
|
ln -fs "${PWD}/$(lib)/libr_$(lib).${EXT_SO}" \
|
2015-10-26 21:33:45 +00:00
|
|
|
"${DESTDIR}${LIBDIR}/$(call libname-version,libr_$(lib).${EXT_SO},${LIBVERSION})" ; \
|
|
|
|
ln -fs "${PWD}/$(lib)/libr_$(lib).${EXT_AR}" "${DESTDIR}${LIBDIR}/libr_$(lib).${EXT_AR}" ; \
|
2014-03-09 09:51:26 +00:00
|
|
|
$(foreach module,$(wildcard $(lib)/p/*.${EXT_SO}), \
|
2015-10-26 21:33:45 +00:00
|
|
|
ln -fs "${PWD}/$(module)" "${DESTDIR}${LIBDIR}/radare2/${VERSION}/" ; \
|
2014-03-09 09:51:26 +00:00
|
|
|
) \
|
2017-10-18 23:07:47 +00:00
|
|
|
) \
|
2015-10-26 21:33:45 +00:00
|
|
|
cd "${DESTDIR}${LIBDIR}/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
|
2015-10-26 21:33:45 +00:00
|
|
|
@${INSTALL_DIR} "${DESTDIR}${LIBDIR}"
|
2017-01-17 23:47:46 +00:00
|
|
|
@$(foreach lib,$(shell find * -type f -iname "*.${EXT_SO}" | grep -v '(lib|parse)/t/' | grep lib | grep -v /bin/ | grep -v /p/), \
|
2015-10-26 21:33:45 +00:00
|
|
|
echo " ${DESTDIR}${LIBDIR}/$(call libpath-to-name-version,$(lib),${LIBVERSION})"; \
|
|
|
|
rm -f "${DESTDIR}${LIBDIR}/$(call libpath-to-name-version,$(lib),${LIBVERSION})"; \
|
|
|
|
${INSTALL_LIB} "$(lib)" "${DESTDIR}${LIBDIR}/$(call libpath-to-name-version,$(lib),${LIBVERSION})"; \
|
|
|
|
( cd "${DESTDIR}${LIBDIR}" ; 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
|
2017-05-09 12:25:57 +00:00
|
|
|
@for FILE in `find * -type f -iname "*.${EXT_AR}" | grep -v fs/p` ; do \
|
2017-01-17 23:47:46 +00:00
|
|
|
echo " ${DESTDIR}${LIBDIR}/$$FILE"; ${INSTALL_DATA} $$FILE "${DESTDIR}${LIBDIR}" ; done || true
|
2009-02-06 17:22:27 +00:00
|
|
|
# plugins
|
2015-10-26 21:33:45 +00:00
|
|
|
@${INSTALL_DIR} "${DESTDIR}${LIBDIR}/radare2/${VERSION}"
|
|
|
|
@for FILE in `find */p -perm -u+x -type f | grep -v exe | grep -v dll | grep ${EXT_SO}`; \
|
|
|
|
do echo " ${DESTDIR}${LIBDIR}/radare2/${VERSION}/$$FILE"; \
|
|
|
|
${INSTALL_LIB} "$$FILE" "${DESTDIR}${LIBDIR}/radare2/${VERSION}" ; done
|
|
|
|
cd "${DESTDIR}${LIBDIR}/radare2" ; ln -fs "${VERSION}" last
|
2009-02-05 21:08:46 +00:00
|
|
|
|
2015-10-26 21:33:45 +00:00
|
|
|
#@echo "lang/p/radare.* ${DESTDIR}${DESTDIR}${PREFIX}/${LIBDIR}/radare2/${VERSION}"
|
|
|
|
#${INSTALL_DATA} lang/p/radare.* ${DESTDIR}${LIBDIR}/radare2/${VERSION}
|
2013-12-14 01:23:20 +00:00
|
|
|
|
2009-04-03 11:11:17 +00:00
|
|
|
deinstall uninstall:
|
2009-03-06 00:38:23 +00:00
|
|
|
# libraries
|
2015-10-26 21:33:45 +00:00
|
|
|
-@for FILE in `find * | grep -e '\.${EXT_SO}$$' | grep -v 'lib/t' | grep lib` ; do \
|
|
|
|
FILE=`echo $$FILE | awk -F / '{ print $$NF; }'`; \
|
|
|
|
echo "${DESTDIR}${LIBDIR}/$$FILE" ; rm -f "${DESTDIR}${LIBDIR}/$$FILE" ; done
|
2010-05-29 11:24:47 +00:00
|
|
|
# object archives
|
2017-05-09 12:25:57 +00:00
|
|
|
-@for FILE in `find * | grep -e '\.${EXT_AR}$$'` ; do \
|
2015-10-26 21:33:45 +00:00
|
|
|
FILE=`echo $$FILE | awk -F / '{ print $$NF; }'`; \
|
|
|
|
echo "${DESTDIR}${LIBDIR}/$$FILE" ; rm -f "${DESTDIR}${LIBDIR}/$$FILE" ; done
|
2010-05-29 11:24:47 +00:00
|
|
|
# includes
|
2015-10-26 21:33:45 +00:00
|
|
|
-if [ -h "${DESTDIR}${INCLUDEDIR}/libr" ]; then \
|
|
|
|
rm -f "${DESTDIR}${INCLUDEDIR}/libr" ; \
|
2011-07-20 17:26:07 +00:00
|
|
|
else \
|
2015-10-26 21:33:45 +00:00
|
|
|
(cd include && for FILE in * ; do rm -f "${DESTDIR}${INCLUDEDIR}/libr/$$FILE" ; done) ; \
|
2011-07-20 17:26:07 +00:00
|
|
|
fi
|
2010-05-29 11:24:47 +00:00
|
|
|
# programs
|
2015-10-26 21:33:45 +00:00
|
|
|
-@for FILE in `find */t -perm -u+x -type f | grep 2`; do \
|
|
|
|
FILE=`echo $$FILE|awk -F / '{ print $$NF; }'`; \
|
|
|
|
echo "${DESTDIR}${BINDIR}/$$FILE" ; rm -f "${DESTDIR}${BINDIR}/$$FILE" ; done
|
2009-03-06 00:38:23 +00:00
|
|
|
# plugins
|
2015-10-26 21:33:45 +00:00
|
|
|
-@for FILE in `find */p -perm -u+x -type f`; do \
|
|
|
|
FILE="${DESTDIR}${LIBDIR}/radare2/${VERSION}/`echo $$FILE|awk -F / '{ print $$NF; }'`"; \
|
|
|
|
echo $$FILE ; rm -f $$FILE ; done
|
|
|
|
rm -rf "${DESTDIR}${LIBDIR}/radare2/${VERSION}"
|
|
|
|
rm -f "${DESTDIR}${LIBDIR}/pkgconfig/libr.pc"
|
|
|
|
rm -f "${DESTDIR}${LIBDIR}/pkgconfig/r_"*.pc
|
2009-03-06 00:38:23 +00:00
|
|
|
# test programs
|
2015-10-26 21:33:45 +00:00
|
|
|
rm -rf "${DESTDIR}${BINDIR}/libr-test"
|
|
|
|
# TODO: use for FILE in LIBS (like in binr/Makefile)
|
|
|
|
rm -rf "${DESTDIR}${INCLUDEDIR}/libr"
|
|
|
|
rm -rf "${DESTDIR}${LIBDIR}/libr_*.so.${LIBVERSION}"
|
|
|
|
rm -rf "${DESTDIR}${LIBDIR}/libr_*.so.0"
|
|
|
|
rm -rf "${DESTDIR}${LIBDIR}/libr_*.so"
|
2017-05-09 12:25:57 +00:00
|
|
|
rm -rf "${DESTDIR}${LIBDIR}/libr_*.${EXT_AR}"
|
2015-10-26 21:33:45 +00:00
|
|
|
rm -rf "${DESTDIR}${LIBDIR}/libr2.so"*
|
2017-05-09 12:25:57 +00:00
|
|
|
rm -rf "${DESTDIR}${LIBDIR}/libr2.${EXT_AR}"
|
2015-10-26 21:33:45 +00:00
|
|
|
rm -rf "${DESTDIR}${LIBDIR}/libr.so"*
|
2017-05-09 12:25:57 +00:00
|
|
|
rm -rf "${DESTDIR}${LIBDIR}/libr.${EXT_AR}"
|
2015-10-26 21:33:45 +00:00
|
|
|
rm -rf "${DESTDIR}${DATADIR}/doc/radare2"
|
|
|
|
@echo libr aka radare2 has been uninstalled from PREFIX=${DESTDIR}${PREFIX}
|
2009-03-06 00:38:23 +00:00
|
|
|
|
2009-02-05 21:08:46 +00:00
|
|
|
clean:
|
2017-10-18 23:07:47 +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:
|
2017-07-04 00:10:43 +00:00
|
|
|
rm -rf .libr libr.${LIB_SO} libr.${LIB_AR}
|
2017-10-18 23:07:47 +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
|