radare2/libr/config.mk.tail

218 lines
3.8 KiB
Plaintext
Raw Normal View History

# config.mk.tail
2010-01-15 12:02:54 +00:00
LIBR:=$(abspath $(dir $(lastword $(MAKEFILE_LIST))))
2013-12-20 03:32:38 +00:00
SHLR:=$(LIBR)/../shlr
2010-01-15 12:02:54 +00:00
#include $(LIBR)/../config-user.mk
include $(LIBR)/../global.mk
include $(LIBR)/../mk/${COMPILER}.mk
CFLAGS+=${CFLAGS_APPEND}
CFLAGS+=${CPPFLAGS}
ifeq ($(WITHPIC),1)
LDFLAGS+=$(subst r_,-L$(LIBR)/,$(DEPS))
LDFLAGS+=$(subst r_,-lr_,$(DEPS))
LDFLAGS+=$(subst r_,-L$(LIBR)/,$(BINDEPS))
LDFLAGS+=$(subst r_,-lr_,$(BINDEPS))
CFLAGS+=${PIC_CFLAGS}
LDFLAGS+=${PIC_CFLAGS}
else
ifneq ($(DEPS),)
LDFLAGS+=$(shell echo ${DEPS} | sed -e 's:r_\([^ ]\+\):$(LIBR)/\1/libr_\1.${EXT_AR}:g')
endif
ifneq ($(BINDEPS),)
LDLIBS+=$(shell echo "${BINDEPS} " | sed -e 's:r_\([^ ]*\):$(LIBR)/\1/libr_\1.${EXT_AR}:g')
endif
#link dependencies of individual r_ libs
#TODO: move them inside libr/*/subdeps.mk
ifneq (,$(findstring r_db,$(BINDEPS)))
LDLIBS+=$(LIBR)/db/sdb/src/libsdb.a
endif
ifneq (,$(findstring r_fs,$(BINDEPS)))
LDLIBS+=$(LIBR)/fs/p/grub/libgrubfs.a
endif
ifneq (,$(findstring r_hash,$(BINDEPS)))
2013-06-05 21:58:31 +00:00
ifneq (${OSTYPE},haiku)
LDLIBS+=-lm
endif
2013-06-05 21:58:31 +00:00
endif
ifneq (,$(findstring r_lib,$(BINDEPS)))
LDLIBS+=${DL_LIBS}
endif
ifneq (,$(findstring r_socket,$(BINDEPS)))
ifeq (${HAVE_LIB_SSL},1)
LDLIBS+=${SSL_LDFLAGS}
endif
endif
ifneq (,$(findstring r_th,$(BINDEPS)))
LDLIBS+=${TH_LIBS}
endif
ifneq (,$(findstring r_util,$(BINDEPS)))
ifeq (${HAVE_LIB_GMP},1)
LDLIBS+=-lgmp
endif
endif
ifneq (,$(findstring r_magic,$(BINDEPS)))
ifeq (${USE_LIB_MAGIC},1)
LDLIBS+=-lmagic
endif
endif
endif
# Compiler: see mk/gcc.mk
# CC CFLAGS CC_LIB CC_AR LINK
# Debug
CFLAGS+=-g -Wall
# libgmp
ifeq (${HAVE_LIB_GMP},1)
CFLAGS+=-DHAVE_LIB_GMP=1
BN_LIBS=-lgmp
endif
#both of these need ssl includes
ifneq (,$(filter r_socket r_util,$(BINDEPS)))
ifeq (${HAVE_LIB_SSL},1)
CFLAGS+=${SSL_CFLAGS}
endif
endif
# XXX do it in configure stage
OSTYPE?=gnulinux
2013-02-06 10:47:31 +00:00
ifeq (${OSTYPE},auto)
_UNAME=$(shell uname)
ifeq ($(_UNAME),Darwin)
OSTYPE=darwin
else
2013-02-06 10:47:31 +00:00
OSTYPE=gnulinux
endif
endif
ifeq (${OSTYPE},openbsd)
OSTYPE=bsd
endif
ifeq (${OSTYPE},netbsd)
OSTYPE=bsd
endif
ifeq (${OSTYPE},freebsd)
OSTYPE=bsd
endif
# Output
ifeq (${OSTYPE},windows)
CFLAGS+=-D__WINDOWS__=1
EXT_AR=lib
EXT_SO=dll
EXT_EXE=.exe
TH_LIBS=
endif
2014-06-25 10:22:27 +00:00
ifeq (${OSTYPE},cygwin_nt-6.1)
OSTYPE=cygwin
endif
ifeq (${OSTYPE},cygwin_nt-6.1-wow64)
OSTYPE=cygwin
endif
ifeq (${OSTYPE},cygwin)
CFLAGS+=-D__CYGWIN__=1
EXT_AR=lib
EXT_SO=dll
EXT_EXE=.exe
TH_LIBS=
endif
ifeq (${OSTYPE},bsd)
CFLAGS+=-D__UNIX__=1
EXT_AR=a
EXT_SO=so
EXT_EXE=
TH_LIBS=-lpthread
endif
ifeq (${OSTYPE},qnx)
CFLAGS+=-D__UNIX__=1
EXT_AR=a
EXT_SO=so
EXT_EXE=
TH_LIBS=
endif
ifeq (${OSTYPE},gnulinux)
CFLAGS+=-D__UNIX__=1
EXT_AR=a
EXT_SO=so
EXT_EXE=
TH_LIBS=-lpthread
endif
2013-06-05 21:58:31 +00:00
ifeq (${OSTYPE},haiku)
CFLAGS+=-D__UNIX__=1
EXT_AR=a
EXT_SO=so
EXT_EXE=
TH_LIBS=
endif
ifeq (${OSTYPE},darwin)
CFLAGS+=-D__UNIX__=1
EXT_AR=a
EXT_SO=dylib
EXT_EXE=
2011-11-27 13:02:39 +00:00
ifeq ($(shell uname -p),arm)
# iOS
TH_LIBS=
else
# OSX
TH_LIBS=-lpthread
endif
2011-11-27 13:02:39 +00:00
endif
ifeq (${OSTYPE},android)
CFLAGS+=-D__UNIX__=1
EXT_AR=a
EXT_SO=so
EXT_EXE=
TH_LIBS=
endif
ifeq (${EXT_SO},)
main:
@echo
@echo "OSTYPE: ${OSTYPE}"
@echo ERROR: Unknown platform
@echo
@exit 1
endif
LIB=lib${NAME}
LIBAR=${LIB}.${EXT_AR}
LIBSO=${LIB}.${EXT_SO}
2011-09-26 00:10:25 +00:00
ifeq (${OSTYPE},android)
libname=-shared -o $1.${EXT_SO}
2011-09-26 00:10:25 +00:00
else
ifeq (${OSTYPE},windows)
libname=-shared -o $1.${EXT_SO}
else
ifeq (${OSTYPE},darwin)
2014-05-17 02:27:49 +00:00
ifeq (${HAVE_LIBVERSION},1)
libname=-shared -o $1.${EXT_SO} ${LDFLAGS_SONAME}$1.${LIBVERSION}.${EXT_SO}
else
2014-05-17 02:27:49 +00:00
libname=-shared -o $1.${EXT_SO}
endif
else
ifeq (${HAVE_LIBVERSION},1)
libname=-shared -o $1.${EXT_SO} ${LDFLAGS_SONAME}$1.${EXT_SO}.${LIBVERSION}
2014-05-17 02:27:49 +00:00
else
libname=-shared -o $1.${EXT_SO}
endif
2011-09-26 00:10:25 +00:00
endif
endif
endif
ifeq ($(OSTYPE),darwin)
libname-version = $(subst ${EXT_SO},$(2).${EXT_SO},$(1))
else
libname-version = $(1).$(2)
endif
libpath-to-name = $(word 2,$(subst /, ,$(1)))
libpath-to-name-version = $(call libname-version,$(call libpath-to-name,$(1)),$(2))
# -- singleton
endif