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
|
2016-11-29 10:52:24 +00:00
|
|
|
LINK+=-g
|
2012-10-30 01:49:05 +00:00
|
|
|
endif
|
|
|
|
|
2016-04-26 23:08:12 +00:00
|
|
|
LIBR:=$(abspath $(dir $(lastword $(MAKEFILE_LIST))))
|
|
|
|
ifeq (${LIBR},)
|
|
|
|
ifeq ($(R2DIR),)
|
|
|
|
$(error R2DIRis not defined)
|
|
|
|
else
|
|
|
|
LIBR:=$(R2DIR)/libr
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2012-10-03 12:31:35 +00:00
|
|
|
ALL?=
|
2017-05-26 01:07:22 +00:00
|
|
|
CFLAGS+=-I$(LIBR)
|
2012-10-03 12:31:35 +00:00
|
|
|
CFLAGS+=-I$(LIBR)/include
|
2018-05-09 21:31:52 +00:00
|
|
|
|
|
|
|
CFLAGS+=-fvisibility=hidden
|
|
|
|
LDFLAGS+=-fvisibility=hidden
|
|
|
|
LINK+=-fvisibility=hidden
|
|
|
|
|
2018-05-15 22:11:04 +00:00
|
|
|
# for executables (DUP)
|
2014-07-09 00:08:06 +00:00
|
|
|
LINK+=$(addprefix -L../,$(subst r_,,$(BINDEPS)))
|
|
|
|
LINK+=$(addprefix -l,$(BINDEPS))
|
2018-05-15 22:11:04 +00:00
|
|
|
|
|
|
|
# for libraries (DUP)
|
|
|
|
# implemented in libr/config.mk.tail
|
|
|
|
#LDFLAGS+=$(addprefix -L../,$(subst r_,,$(DEPS)))
|
|
|
|
#LDFLAGS+=$(addprefix -l,$(DEPS))
|
|
|
|
|
2012-10-03 12:31:35 +00:00
|
|
|
SRC=$(subst .o,.c,$(OBJ))
|
|
|
|
|
|
|
|
BEXE=$(BIN)$(EXT_EXE)
|
2010-02-21 20:34:10 +00:00
|
|
|
|
2012-08-27 15:02:58 +00:00
|
|
|
ifeq ($(USE_RPATH),1)
|
2015-10-26 21:33:45 +00:00
|
|
|
LINK+=-Wl,-rpath "${LIBDIR}"
|
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
|
|
|
|
|
2016-06-25 16:26:34 +00:00
|
|
|
ifneq ($(EXTRA_PRE),)
|
|
|
|
all: $(EXTRA_PRE)
|
|
|
|
$(MAKE) all2
|
|
|
|
|
|
|
|
all2: ${LIBSO} ${LIBAR} ${EXTRA_TARGETS}
|
|
|
|
else
|
2012-10-03 23:20:00 +00:00
|
|
|
all: ${LIBSO} ${LIBAR} ${EXTRA_TARGETS}
|
2016-06-25 16:26:34 +00:00
|
|
|
endif
|
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
|
|
|
|
2018-05-11 02:39:08 +00:00
|
|
|
ifeq (1,1)
|
|
|
|
#$(WITHPIC),1)
|
2016-06-25 16:26:34 +00:00
|
|
|
$(LIBSO): $(EXTRA_TARGETS) ${WFD} ${OBJS} ${SHARED_OBJ}
|
2012-10-03 12:31:35 +00:00
|
|
|
@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)" || \
|
2017-05-18 14:50:52 +00:00
|
|
|
echo "\"${CC_LIB} ${LIBNAME} ${OBJS} ${SHARED_OBJ} ${LINK} ${LDFLAGS}\"" ; \
|
2015-09-14 17:21:57 +00:00
|
|
|
${CC_LIB} ${LIBNAME} ${CFLAGS} ${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
|
|
|
|
2018-05-09 21:31:52 +00:00
|
|
|
ifeq (1,1) #$(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
|
2015-12-28 17:30:54 +00:00
|
|
|
rm -f $(LIBAR)
|
2012-10-03 12:31:35 +00:00
|
|
|
${CC_AR} ${OBJS} ${SHARED_OBJ}
|
2015-12-28 01:00:54 +00:00
|
|
|
${RANLIB} $(LIBAR)
|
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
|
2018-01-10 14:08:35 +00:00
|
|
|
@echo 'Requires: $(filter r_%,${DEPS})' >> ../../pkgcfg/${NAME}.pc.acr
|
2009-07-16 09:40:00 +00:00
|
|
|
@if [ "${NAME}" = "libr" ]; then NAME=''; else NAME=${NAME}; fi ;\
|
2018-01-10 14:08:35 +00:00
|
|
|
echo 'Libs: -L$${libdir} -l${NAME} $(filter-out r_%,${DEPS}) ${PCLIBS}' >> ../../pkgcfg/${NAME}.pc.acr
|
|
|
|
@echo 'Cflags: -I$${includedir}/libr ${PCCFLAGS}' >> ../../pkgcfg/${NAME}.pc.acr
|
2009-07-16 00:30:20 +00:00
|
|
|
|
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
|