2012-10-03 12:31:35 +00:00
|
|
|
BINR_PROGRAM=1
|
|
|
|
include ../../libr/config.mk
|
2015-02-22 21:01:46 +00:00
|
|
|
include ../../shlr/zip/deps.mk
|
2012-10-03 12:31:35 +00:00
|
|
|
|
2015-10-10 23:55:47 +00:00
|
|
|
ifeq (,$(findstring tcc,${CC}))
|
2015-09-25 13:53:29 +00:00
|
|
|
CFLAGS+=-pie
|
2015-10-08 10:03:33 +00:00
|
|
|
endif
|
2015-09-24 01:36:06 +00:00
|
|
|
CFLAGS+=-I$(LTOP)/include
|
2013-04-04 00:32:13 +00:00
|
|
|
|
2013-09-06 22:39:08 +00:00
|
|
|
ifeq (${COMPILER},emscripten)
|
|
|
|
EXT_EXE=.js
|
|
|
|
endif
|
2012-10-03 12:31:35 +00:00
|
|
|
|
2012-10-29 12:15:18 +00:00
|
|
|
ifeq ($(USE_RPATH),1)
|
2015-10-26 21:33:45 +00:00
|
|
|
LDFLAGS+=-Wl,-rpath "${LIBDIR}"
|
2012-10-29 12:15:18 +00:00
|
|
|
endif
|
|
|
|
|
2012-10-03 12:31:35 +00:00
|
|
|
OBJ+=${BIN}.o
|
|
|
|
BEXE=${BIN}${EXT_EXE}
|
|
|
|
|
2018-05-28 15:14:49 +00:00
|
|
|
# ifeq ($(WITHNONPIC),1)
|
|
|
|
# ## LDFLAGS+=$(addsuffix /lib${BINDEPS}.a,$(addprefix ../../libr/,$(subst r_,,$(BINDEPS))))
|
|
|
|
# LDFLAGS+=$(shell for a in ${BINDEPS} ; do b=`echo $$a |sed -e s,r_,,g`; echo ../../libr/$$b/lib$$a.${EXT_AR} ; done )
|
|
|
|
# LDFLAGS+=../../shlr/sdb/src/libsdb.a
|
|
|
|
# ifeq (1,$(WITH_GPL))
|
|
|
|
# LDFLAGS+=../../shlr/grub/libgrubfs.a
|
|
|
|
# endif
|
|
|
|
# LDFLAGS+=../../shlr/gdb/lib/libgdbr.a
|
|
|
|
# LDFLAGS+=../../shlr/windbg/libr_windbg.a
|
|
|
|
# LDFLAGS+=../../shlr/capstone/libcapstone.a
|
|
|
|
# LDFLAGS+=../../shlr/java/libr_java.a
|
|
|
|
# LDFLAGS+=../../libr/socket/libr_socket.a
|
|
|
|
# LDFLAGS+=../../libr/util/libr_util.a
|
|
|
|
# ifneq (${OSTYPE},haiku)
|
|
|
|
# ifneq ($(CC),cccl)
|
|
|
|
# LDFLAGS+=-lm
|
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
|
2013-02-06 10:47:31 +00:00
|
|
|
LDFLAGS+=${DL_LIBS}
|
2013-11-15 00:30:11 +00:00
|
|
|
LDFLAGS+=${LINK}
|
2017-08-25 10:16:26 +00:00
|
|
|
ifneq (${ANDROID},1)
|
2017-08-26 00:24:22 +00:00
|
|
|
ifneq (${OSTYPE},windows)
|
2017-08-25 10:16:26 +00:00
|
|
|
ifneq (${OSTYPE},linux)
|
|
|
|
ifneq ($(CC),cccl)
|
|
|
|
LDFLAGS+=-lpthread
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
2017-08-26 00:24:22 +00:00
|
|
|
endif
|
2014-04-18 23:23:04 +00:00
|
|
|
|
|
|
|
REAL_LDFLAGS=$(subst -shared,,$(LDFLAGS))
|
|
|
|
|
2014-03-01 23:47:05 +00:00
|
|
|
ifeq ($(ISLIB),1)
|
|
|
|
BEXE=$(BIN).$(EXT_SO)
|
2014-04-18 23:23:04 +00:00
|
|
|
REAL_LDFLAGS+=-shared
|
2014-03-01 23:47:05 +00:00
|
|
|
endif
|
2012-10-03 12:31:35 +00:00
|
|
|
#--------------------#
|
|
|
|
# Rules for programs #
|
|
|
|
#--------------------#
|
|
|
|
|
2014-04-18 23:23:04 +00:00
|
|
|
# For some reason w32 builds contain -shared in LDFLAGS. boo!
|
|
|
|
|
2012-10-03 12:31:35 +00:00
|
|
|
ifneq ($(BIN)$(BINS),)
|
|
|
|
|
|
|
|
all: ${BEXE} ${BINS}
|
|
|
|
|
|
|
|
${BINS}: ${OBJS}
|
|
|
|
ifneq ($(SILENT),)
|
|
|
|
@echo CC $@
|
|
|
|
endif
|
2014-06-04 23:50:56 +00:00
|
|
|
${CC} ${CFLAGS} $@.c ${OBJS} ${REAL_LDFLAGS} -o $@
|
2012-10-03 12:31:35 +00:00
|
|
|
|
2015-11-01 10:43:05 +00:00
|
|
|
# -static fails because -ldl -lpthread static-gcc ...
|
2012-10-03 12:31:35 +00:00
|
|
|
${BEXE}: ${OBJ} ${SHARED_OBJ}
|
|
|
|
ifneq ($(SILENT),)
|
|
|
|
@echo LD $@
|
|
|
|
endif
|
2015-09-14 17:21:57 +00:00
|
|
|
${CC} ${CFLAGS} $+ -L.. -o $@ $(REAL_LDFLAGS)
|
2012-10-03 12:31:35 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
# Dummy myclean rule that can be overriden by the t/ Makefile
|
|
|
|
# TODO: move to config.mk ? it must be a precondition
|
|
|
|
myclean:
|
|
|
|
|
|
|
|
clean:: myclean
|
2013-09-06 23:35:11 +00:00
|
|
|
-rm -f ${OBJS} ${OBJ} ${BEXE}
|
2012-10-03 12:31:35 +00:00
|
|
|
|
|
|
|
mrproper: clean
|
|
|
|
-rm -f *.d
|
|
|
|
|
|
|
|
install:
|
|
|
|
cd ../.. && ${MAKE} install
|
|
|
|
|
|
|
|
.PHONY: all clean myclean mrproper install
|