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
|
|
|
|
2012-10-03 12:31:35 +00:00
|
|
|
include $(LTOP)/config.mk
|
|
|
|
|
|
|
|
ALL?=
|
|
|
|
CFLAGS+=-I$(LIBR)/include
|
2012-10-03 23:20:00 +00:00
|
|
|
LDFLAGS+=$(addprefix -L../,$(subst r_,,$(BINDEPS)))
|
2012-10-03 12:31:35 +00:00
|
|
|
LDFLAGS+=$(addprefix -l,$(BINDEPS))
|
|
|
|
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)
|
|
|
|
LDFLAGS+=-Wl,-R${PREFIX}/lib
|
|
|
|
endif
|
|
|
|
|
2012-10-03 12:31:35 +00:00
|
|
|
ifeq (${OSTYPE},gnulinux)
|
|
|
|
LIBNAME=${LDFLAGS_SONAME}${LIBSO}.${LIBVERSION}
|
2012-08-10 09:35:38 +00:00
|
|
|
else
|
2012-10-03 12:31:35 +00:00
|
|
|
LIBNAME=${LDFLAGS_SONAME}${LIBSO}
|
2012-08-10 09:35:38 +00:00
|
|
|
endif
|
2012-08-14 13:44:17 +00:00
|
|
|
|
2012-10-03 23:20:00 +00:00
|
|
|
all: ${LIBSO} ${LIBAR} ${EXTRA_TARGETS}
|
2012-10-03 12:31:35 +00:00
|
|
|
ifneq ($(SILENT),)
|
2012-10-03 23:20:00 +00:00
|
|
|
@-if [ -f p/Makefile ]; then (cd p && ${MAKE} all) ; fi
|
2012-08-14 13:44:17 +00:00
|
|
|
else
|
2012-10-03 23:20:00 +00:00
|
|
|
@-if [ -f p/Makefile ] ; then (echo "DIR ${NAME}/p"; cd p && ${MAKE} all) ; 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)" || \
|
2012-10-03 12:31:35 +00:00
|
|
|
echo "${CC_LIB} ${LIBNAME} ${OBJS} ${SHARED_OBJ} ${LDFLAGS} ${LINK}" ; \
|
|
|
|
${CC_LIB} ${LIBNAME} ${OBJS} ${SHARED_OBJ} ${LDFLAGS} ${LINK} || 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}
|
2011-11-13 03:08:08 +00:00
|
|
|
-rm -f *.${EXT_EXE} *.${EXT_SO} *.${EXT_AR} *.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
|