2012-08-13 23:48:39 +00:00
|
|
|
ifeq ($(_INCLUDE_RULES_MK_),)
|
2012-08-31 23:06:24 +00:00
|
|
|
_INCLUDE_RULES_MK_=
|
2012-08-14 13:44:17 +00:00
|
|
|
|
2013-08-26 01:17:29 +00:00
|
|
|
-include $(LTOP)/config.mk
|
2013-09-06 22:39:08 +00:00
|
|
|
-include $(LTOP)/../mk/compiler.mk
|
2012-10-03 12:31:35 +00:00
|
|
|
|
2012-10-30 01:49:05 +00:00
|
|
|
ifeq ($(DEBUG),1)
|
|
|
|
export NOSTRIP=1
|
|
|
|
CFLAGS+=-g
|
2014-07-09 00:08:06 +00:00
|
|
|
LINK+=-g -ggdb
|
2012-10-30 01:49:05 +00:00
|
|
|
endif
|
|
|
|
|
2012-10-03 12:31:35 +00:00
|
|
|
ALL?=
|
|
|
|
CFLAGS+=-I$(LIBR)/include
|
2013-06-14 00:51:33 +00:00
|
|
|
CFLAGS+=-DGIT_TAP=\"${GIT_TAP}\"
|
2014-07-09 00:08:06 +00:00
|
|
|
LINK+=$(addprefix -L../,$(subst r_,,$(BINDEPS)))
|
|
|
|
LINK+=$(addprefix -l,$(BINDEPS))
|
2012-10-03 12:31:35 +00:00
|
|
|
SRC=$(subst .o,.c,$(OBJ))
|
|
|
|
MAGICSED=| sed -e 's,-lr_magic,@LIBMAGIC@,g'
|
2011-11-03 10:49:50 +00:00
|
|
|
LIBR:=$(abspath $(dir $(lastword $(MAKEFILE_LIST))))
|
2012-10-03 12:31:35 +00:00
|
|
|
|
|
|
|
BEXE=$(BIN)$(EXT_EXE)
|
2010-02-21 20:34:10 +00:00
|
|
|
|
2012-08-27 15:02:58 +00:00
|
|
|
ifeq ($(USE_RPATH),1)
|
2014-11-19 19:19:59 +00:00
|
|
|
LINK+=-Wl,-rpath "${PREFIX}/lib"
|
2012-08-27 15:02:58 +00:00
|
|
|
endif
|
|
|
|
|
2012-10-03 12:31:35 +00:00
|
|
|
ifeq (${OSTYPE},gnulinux)
|
2014-05-17 07:59:57 +00:00
|
|
|
ifeq (${HAVE_LIBVERSION},1)
|
2012-10-03 12:31:35 +00:00
|
|
|
LIBNAME=${LDFLAGS_SONAME}${LIBSO}.${LIBVERSION}
|
2012-08-10 09:35:38 +00:00
|
|
|
else
|
2014-05-17 02:27:49 +00:00
|
|
|
LIBNAME=${LDFLAGS_SONAME}${LIBSO}
|
|
|
|
endif
|
|
|
|
else
|
2014-03-08 12:06:45 +00:00
|
|
|
ifeq (${OSTYPE},darwin)
|
2014-05-17 02:27:49 +00:00
|
|
|
ifeq (${HAVE_LIBVERSION},1)
|
2014-03-08 12:06:45 +00:00
|
|
|
LIBNAME=${LDFLAGS_SONAME}${LIB}.${LIBVERSION}.${EXT_SO}
|
|
|
|
else
|
2014-05-17 02:27:49 +00:00
|
|
|
LIBNAME=${LDFLAGS_SONAME}${LIB}.${EXT_SO}
|
|
|
|
endif
|
|
|
|
else
|
2012-10-03 12:31:35 +00:00
|
|
|
LIBNAME=${LDFLAGS_SONAME}${LIBSO}
|
2012-08-10 09:35:38 +00:00
|
|
|
endif
|
2014-03-08 12:06:45 +00:00
|
|
|
endif
|
2012-08-14 13:44:17 +00:00
|
|
|
|
2013-06-05 21:58:31 +00:00
|
|
|
ifeq (${OSTYPE},haiku)
|
2014-07-09 00:08:06 +00:00
|
|
|
LINK+=-lnetwork
|
2013-06-05 21:58:31 +00:00
|
|
|
endif
|
|
|
|
|
2012-10-03 23:20:00 +00:00
|
|
|
all: ${LIBSO} ${LIBAR} ${EXTRA_TARGETS}
|
2012-10-03 12:31:35 +00:00
|
|
|
ifneq ($(SILENT),)
|
2013-12-20 03:32:38 +00:00
|
|
|
@-if [ -f p/Makefile ]; then (cd p && ${MAKE}) ; fi
|
2012-08-14 13:44:17 +00:00
|
|
|
else
|
2013-12-20 03:32:38 +00:00
|
|
|
@-if [ -f p/Makefile ] ; then (echo "DIR ${NAME}/p"; cd p && ${MAKE}) ; fi
|
2012-08-14 13:44:17 +00:00
|
|
|
endif
|
2009-02-06 12:17:51 +00:00
|
|
|
|
2010-01-21 20:22:30 +00:00
|
|
|
ifeq ($(WITHPIC),1)
|
2012-10-03 12:31:35 +00:00
|
|
|
${LIBSO}: $(EXTRA_TARGETS) ${WFD} ${OBJS} ${SHARED_OBJ}
|
|
|
|
@for a in ${OBJS} ${SHARED_OBJ} ${SRC}; do \
|
2009-04-15 00:29:01 +00:00
|
|
|
do=0 ; [ ! -e ${LIBSO} ] && do=1 ; \
|
|
|
|
test $$a -nt ${LIBSO} && do=1 ; \
|
|
|
|
if [ $$do = 1 ]; then \
|
2012-08-14 13:44:17 +00:00
|
|
|
[ -n "${SILENT}" ] && \
|
|
|
|
echo "LD $(LIBSO)" || \
|
2014-07-09 00:08:06 +00:00
|
|
|
echo "${CC_LIB} ${LIBNAME} ${OBJS} ${SHARED_OBJ} ${LINK} ${LDFLAGS}" ; \
|
|
|
|
${CC_LIB} ${LIBNAME} ${OBJS} ${SHARED_OBJ} ${LINK} ${LDFLAGS} || exit 1; \
|
2012-08-14 13:44:17 +00:00
|
|
|
[ -f "$(LIBR)/stripsyms.sh" ] && sh $(LIBR)/stripsyms.sh ${LIBSO} ${NAME} ; \
|
2009-04-01 00:28:13 +00:00
|
|
|
break ; \
|
|
|
|
fi ; done
|
2010-01-21 20:22:30 +00:00
|
|
|
else
|
2012-10-03 23:20:00 +00:00
|
|
|
${LIBSO}: ;
|
2010-01-21 20:22:30 +00:00
|
|
|
endif
|
2009-02-05 21:08:46 +00:00
|
|
|
|
2010-10-29 01:10:10 +00:00
|
|
|
ifeq ($(WITHNONPIC),1)
|
2012-10-03 12:31:35 +00:00
|
|
|
$(LIBAR): ${OBJS}
|
2012-08-14 13:44:17 +00:00
|
|
|
ifneq ($(SILENT),)
|
|
|
|
echo "CC_AR $(LIBAR)"
|
|
|
|
endif
|
2012-10-03 12:31:35 +00:00
|
|
|
${CC_AR} ${OBJS} ${SHARED_OBJ}
|
2010-10-29 01:10:10 +00:00
|
|
|
else
|
2012-10-03 23:20:00 +00:00
|
|
|
$(LIBAR): ;
|
2010-10-29 01:10:10 +00:00
|
|
|
endif
|
2009-02-05 21:08:46 +00:00
|
|
|
|
2009-07-16 00:30:20 +00:00
|
|
|
pkgcfg:
|
|
|
|
@echo Generating pkgconfig stub for ${NAME}
|
|
|
|
@echo 'prefix=@PREFIX@' > ../../pkgcfg/${NAME}.pc.acr
|
|
|
|
@echo 'exec_prefix=$${prefix}' >> ../../pkgcfg/${NAME}.pc.acr
|
2011-07-19 11:19:09 +00:00
|
|
|
@echo 'libdir=@LIBDIR@' >> ../../pkgcfg/${NAME}.pc.acr
|
2009-07-16 09:40:00 +00:00
|
|
|
@echo 'includedir=$${prefix}/include' >> ../../pkgcfg/${NAME}.pc.acr
|
2009-07-16 00:30:20 +00:00
|
|
|
@echo >> ../../pkgcfg/${NAME}.pc.acr
|
|
|
|
@echo 'Name: ${NAME}' >> ../../pkgcfg/${NAME}.pc.acr
|
|
|
|
@echo 'Description: radare foundation libraries' >> ../../pkgcfg/${NAME}.pc.acr
|
2011-07-19 11:19:09 +00:00
|
|
|
@echo 'Version: @VERSION@' >> ../../pkgcfg/${NAME}.pc.acr
|
2009-07-16 00:30:20 +00:00
|
|
|
@echo 'Requires:' >> ../../pkgcfg/${NAME}.pc.acr
|
2009-07-16 09:40:00 +00:00
|
|
|
@if [ "${NAME}" = "libr" ]; then NAME=''; else NAME=${NAME}; fi ;\
|
2011-10-18 16:12:17 +00:00
|
|
|
echo 'Libs: -L$${libdir} '`echo $${NAME} ${DEPS}|sed -e s,r_,-lr_,g` ${MAGICSED} >> ../../pkgcfg/${NAME}.pc.acr
|
2009-07-16 00:30:20 +00:00
|
|
|
@echo 'Cflags: -I$${includedir}/libr' >> ../../pkgcfg/${NAME}.pc.acr
|
|
|
|
|
2011-11-29 11:28:02 +00:00
|
|
|
clean:: ${EXTRA_CLEAN}
|
2012-10-11 11:09:33 +00:00
|
|
|
-rm -f *.${EXT_EXE} *.${EXT_SO} *.${EXT_AR} *.d */*.d */*/*.d */*/*/*.d
|
2012-10-03 12:31:35 +00:00
|
|
|
-rm -f ${LIBSO} ${LIBAR} ${OBJS} ${BIN} *.exe a.out
|
2010-06-15 12:10:42 +00:00
|
|
|
-@if [ -e p/Makefile ]; then (cd p && ${MAKE} clean) ; fi
|
|
|
|
@true
|
|
|
|
|
|
|
|
mrproper: clean
|
|
|
|
-@if [ -e p/Makefile ]; then (cd p && ${MAKE} mrproper) ; fi
|
|
|
|
-rm -f *.d
|
2009-02-06 12:17:51 +00:00
|
|
|
@true
|
2009-04-03 11:11:17 +00:00
|
|
|
|
2012-10-03 23:20:00 +00:00
|
|
|
.PHONY: all install pkgcfg clean deinstall uninstall echodir
|
|
|
|
|
|
|
|
# autodetect dependencies object
|
|
|
|
-include $(OBJS:.o=.d)
|
2009-03-10 21:58:00 +00:00
|
|
|
|
2012-08-13 23:48:39 +00:00
|
|
|
endif
|