2010-01-21 20:22:30 +00:00
|
|
|
# config.mk.tail
|
2010-01-15 12:02:54 +00:00
|
|
|
|
2011-11-03 10:49:50 +00:00
|
|
|
LIBR:=$(abspath $(dir $(lastword $(MAKEFILE_LIST))))
|
2018-05-18 22:07:01 +00:00
|
|
|
# neat???!? trick to support path with spaces
|
|
|
|
null:=
|
|
|
|
SPACE:=$(null) $(null)
|
|
|
|
|
2016-04-26 21:56:26 +00:00
|
|
|
ifeq ($(LIBR),)
|
2016-04-26 22:05:57 +00:00
|
|
|
ifeq ($(R2DIR),)
|
|
|
|
$(error ERROR: Cannot find R2DIR. Please define this variable)
|
|
|
|
else
|
|
|
|
LIBR=$(R2DIR)/libr
|
2017-05-09 12:25:57 +00:00
|
|
|
MSVC=$(R2DIR)/msvc
|
2016-04-26 22:05:57 +00:00
|
|
|
endif
|
2016-04-26 21:56:26 +00:00
|
|
|
endif
|
2018-05-18 22:07:01 +00:00
|
|
|
|
2013-12-20 03:32:38 +00:00
|
|
|
SHLR:=$(LIBR)/../shlr
|
2010-01-15 12:02:54 +00:00
|
|
|
|
2013-03-01 01:00:22 +00:00
|
|
|
#include $(LIBR)/../config-user.mk
|
2011-11-03 10:49:50 +00:00
|
|
|
include $(LIBR)/../global.mk
|
|
|
|
include $(LIBR)/../mk/${COMPILER}.mk
|
2011-07-13 16:55:16 +00:00
|
|
|
|
2010-01-15 00:32:28 +00:00
|
|
|
CFLAGS+=${CFLAGS_APPEND}
|
2012-06-12 23:42:47 +00:00
|
|
|
CFLAGS+=${CPPFLAGS}
|
2010-01-21 20:22:30 +00:00
|
|
|
|
2018-05-15 22:11:04 +00:00
|
|
|
ifeq (1,1)
|
|
|
|
#$(WITHPIC),1)
|
2014-07-09 00:08:06 +00:00
|
|
|
LINK+=$(subst r_,-L$(LIBR)/,$(DEPS))
|
|
|
|
LINK+=$(subst r_,-lr_,$(DEPS))
|
|
|
|
LINK+=$(subst r_,-L$(LIBR)/,$(BINDEPS))
|
|
|
|
LINK+=$(subst r_,-lr_,$(BINDEPS))
|
2010-01-21 20:22:30 +00:00
|
|
|
CFLAGS+=${PIC_CFLAGS}
|
2014-07-09 00:08:06 +00:00
|
|
|
LINK+=${PIC_CFLAGS}
|
2010-01-21 20:22:30 +00:00
|
|
|
else
|
2010-11-10 09:45:47 +00:00
|
|
|
ifneq ($(DEPS),)
|
2014-07-09 00:08:06 +00:00
|
|
|
LINK+=$(shell echo ${DEPS} | sed -e 's:r_\([^ ]\+\):$(LIBR)/\1/libr_\1.${EXT_AR}:g')
|
2010-01-21 20:22:30 +00:00
|
|
|
endif
|
2011-11-03 10:49:50 +00:00
|
|
|
endif
|
|
|
|
|
2010-01-15 00:32:28 +00:00
|
|
|
# Compiler: see mk/gcc.mk
|
|
|
|
# CC CFLAGS CC_LIB CC_AR LINK
|
|
|
|
|
|
|
|
# Debug
|
2017-12-02 15:42:47 +00:00
|
|
|
ifneq ($(OSTYPE),mingw32)
|
|
|
|
CFLAGS+=-g
|
|
|
|
endif
|
|
|
|
CFLAGS+=-Wall
|
2010-01-15 00:32:28 +00:00
|
|
|
|
2010-05-28 00:44:51 +00:00
|
|
|
# libgmp
|
|
|
|
ifeq (${HAVE_LIB_GMP},1)
|
|
|
|
CFLAGS+=-DHAVE_LIB_GMP=1
|
|
|
|
BN_LIBS=-lgmp
|
|
|
|
endif
|
|
|
|
|
2011-11-03 10:49:50 +00:00
|
|
|
#both of these need ssl includes
|
|
|
|
ifneq (,$(filter r_socket r_util,$(BINDEPS)))
|
|
|
|
ifeq (${HAVE_LIB_SSL},1)
|
|
|
|
CFLAGS+=${SSL_CFLAGS}
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2010-01-15 00:32:28 +00:00
|
|
|
# XXX do it in configure stage
|
|
|
|
OSTYPE?=gnulinux
|
2013-02-06 10:47:31 +00:00
|
|
|
ifeq (${OSTYPE},auto)
|
2013-03-01 01:00:22 +00:00
|
|
|
_UNAME=$(shell uname)
|
|
|
|
ifeq ($(_UNAME),Darwin)
|
|
|
|
OSTYPE=darwin
|
|
|
|
else
|
2013-02-06 10:47:31 +00:00
|
|
|
OSTYPE=gnulinux
|
|
|
|
endif
|
2013-03-01 01:00:22 +00:00
|
|
|
endif
|
2013-11-12 01:21:31 +00:00
|
|
|
ifeq (${OSTYPE},openbsd)
|
|
|
|
OSTYPE=bsd
|
|
|
|
endif
|
|
|
|
ifeq (${OSTYPE},netbsd)
|
|
|
|
OSTYPE=bsd
|
|
|
|
endif
|
|
|
|
ifeq (${OSTYPE},freebsd)
|
|
|
|
OSTYPE=bsd
|
|
|
|
endif
|
2015-08-30 12:05:23 +00:00
|
|
|
ifeq (${OSTYPE},dragonfly)
|
|
|
|
OSTYPE=bsd
|
|
|
|
endif
|
|
|
|
ifeq (${OSTYPE},bitrig)
|
|
|
|
OSTYPE=bsd
|
|
|
|
endif
|
2010-01-15 00:32:28 +00:00
|
|
|
# Output
|
|
|
|
ifeq (${OSTYPE},windows)
|
2010-01-15 16:02:04 +00:00
|
|
|
CFLAGS+=-D__WINDOWS__=1
|
2010-01-15 00:32:28 +00:00
|
|
|
EXT_AR=lib
|
|
|
|
EXT_SO=dll
|
|
|
|
EXT_EXE=.exe
|
2010-01-21 20:22:30 +00:00
|
|
|
TH_LIBS=
|
2010-01-15 00:32:28 +00:00
|
|
|
endif
|
2014-06-26 18:09:59 +00:00
|
|
|
ifneq (,$(findstring cygwin,${OSTYPE}))
|
2014-06-25 10:22:27 +00:00
|
|
|
CFLAGS+=-D__CYGWIN__=1
|
|
|
|
EXT_AR=lib
|
|
|
|
EXT_SO=dll
|
|
|
|
EXT_EXE=.exe
|
|
|
|
TH_LIBS=
|
|
|
|
endif
|
2015-07-10 23:19:20 +00:00
|
|
|
ifneq (,$(findstring mingw32,${OSTYPE})$(findstring mingw64,${OSTYPE})$(findstring msys,${OSTYPE}))
|
2014-06-26 18:09:59 +00:00
|
|
|
CFLAGS+=-DMINGW32=1
|
|
|
|
EXT_AR=lib
|
|
|
|
EXT_SO=dll
|
|
|
|
EXT_EXE=.exe
|
|
|
|
TH_LIBS=
|
|
|
|
endif
|
2013-11-12 01:21:31 +00:00
|
|
|
ifeq (${OSTYPE},bsd)
|
|
|
|
CFLAGS+=-D__UNIX__=1
|
|
|
|
EXT_AR=a
|
|
|
|
EXT_SO=so
|
|
|
|
EXT_EXE=
|
|
|
|
TH_LIBS=-lpthread
|
|
|
|
endif
|
2012-06-01 12:50:24 +00:00
|
|
|
ifeq (${OSTYPE},qnx)
|
|
|
|
CFLAGS+=-D__UNIX__=1
|
|
|
|
EXT_AR=a
|
|
|
|
EXT_SO=so
|
|
|
|
EXT_EXE=
|
|
|
|
TH_LIBS=
|
|
|
|
endif
|
2010-01-15 00:32:28 +00:00
|
|
|
ifeq (${OSTYPE},gnulinux)
|
2010-01-15 16:02:04 +00:00
|
|
|
CFLAGS+=-D__UNIX__=1
|
2010-01-15 00:32:28 +00:00
|
|
|
EXT_AR=a
|
|
|
|
EXT_SO=so
|
|
|
|
EXT_EXE=
|
2010-01-21 20:22:30 +00:00
|
|
|
TH_LIBS=-lpthread
|
2010-01-15 00:32:28 +00:00
|
|
|
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
|
2010-02-21 19:49:39 +00:00
|
|
|
ifeq (${OSTYPE},darwin)
|
2010-01-15 16:02:04 +00:00
|
|
|
CFLAGS+=-D__UNIX__=1
|
2010-01-15 00:32:28 +00:00
|
|
|
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
|
2010-01-21 20:22:30 +00:00
|
|
|
TH_LIBS=-lpthread
|
2010-01-15 00:32:28 +00:00
|
|
|
endif
|
2011-11-27 13:02:39 +00:00
|
|
|
endif
|
2011-09-25 04:57:13 +00:00
|
|
|
ifeq (${OSTYPE},android)
|
|
|
|
CFLAGS+=-D__UNIX__=1
|
|
|
|
EXT_AR=a
|
|
|
|
EXT_SO=so
|
|
|
|
EXT_EXE=
|
|
|
|
TH_LIBS=
|
|
|
|
endif
|
2017-01-17 23:47:46 +00:00
|
|
|
ifeq (${OSTYPE},solaris)
|
|
|
|
CFLAGS+=-D__UNIX__=1
|
|
|
|
EXT_AR=a
|
|
|
|
EXT_SO=so
|
|
|
|
EXT_EXE=
|
|
|
|
TH_LIBS=
|
|
|
|
endif
|
2010-01-15 00:32:28 +00:00
|
|
|
|
2010-07-03 01:35:26 +00:00
|
|
|
ifeq (${EXT_SO},)
|
2013-03-01 01:00:22 +00:00
|
|
|
main:
|
|
|
|
@echo
|
|
|
|
@echo "OSTYPE: ${OSTYPE}"
|
|
|
|
@echo ERROR: Unknown platform
|
|
|
|
@echo
|
|
|
|
@exit 1
|
2010-07-03 01:35:26 +00:00
|
|
|
endif
|
|
|
|
|
2010-01-15 00:32:28 +00:00
|
|
|
LIB=lib${NAME}
|
|
|
|
LIBAR=${LIB}.${EXT_AR}
|
|
|
|
LIBSO=${LIB}.${EXT_SO}
|
2011-09-26 00:10:25 +00:00
|
|
|
ifeq (${OSTYPE},android)
|
2011-10-19 23:58:26 +00:00
|
|
|
libname=-shared -o $1.${EXT_SO}
|
2011-09-26 00:10:25 +00:00
|
|
|
else
|
2011-10-12 01:24:19 +00:00
|
|
|
ifeq (${OSTYPE},windows)
|
|
|
|
libname=-shared -o $1.${EXT_SO}
|
|
|
|
else
|
2014-03-08 12:06:45 +00:00
|
|
|
ifeq (${OSTYPE},darwin)
|
2014-05-17 02:27:49 +00:00
|
|
|
ifeq (${HAVE_LIBVERSION},1)
|
2016-04-26 23:52:35 +00:00
|
|
|
libname=-dynamiclib -o $1.${EXT_SO} ${LDFLAGS_SONAME}$1.${LIBVERSION}.${EXT_SO}
|
2014-03-08 12:06:45 +00:00
|
|
|
else
|
2016-04-26 23:52:35 +00:00
|
|
|
libname=-dynamiclib -o $1.${EXT_SO}
|
2014-05-17 02:27:49 +00:00
|
|
|
endif
|
|
|
|
else
|
|
|
|
ifeq (${HAVE_LIBVERSION},1)
|
2011-10-08 21:39:06 +00:00
|
|
|
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
|
2011-10-12 01:24:19 +00:00
|
|
|
endif
|
2014-03-08 12:06:45 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(OSTYPE),darwin)
|
2014-03-09 09:51:26 +00:00
|
|
|
libname-version = $(subst ${EXT_SO},$(2).${EXT_SO},$(1))
|
2014-03-08 12:06:45 +00:00
|
|
|
else
|
2014-03-09 09:51:26 +00:00
|
|
|
libname-version = $(1).$(2)
|
2014-03-08 12:06:45 +00:00
|
|
|
endif
|
2012-08-13 23:48:39 +00:00
|
|
|
|
2014-03-09 09:51:26 +00:00
|
|
|
libpath-to-name = $(word 2,$(subst /, ,$(1)))
|
|
|
|
libpath-to-name-version = $(call libname-version,$(call libpath-to-name,$(1)),$(2))
|
|
|
|
|
2012-08-13 23:48:39 +00:00
|
|
|
# -- singleton
|
|
|
|
endif
|