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))))
|
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
|
|
|
|
|
|
|
ifeq ($(WITHPIC),1)
|
2011-11-03 10:49:50 +00:00
|
|
|
LDFLAGS+=$(subst r_,-L$(LIBR)/,$(DEPS))
|
2012-09-27 17:35:19 +00:00
|
|
|
LDFLAGS+=$(subst r_,-lr_,$(DEPS))
|
2011-11-03 10:49:50 +00:00
|
|
|
LDFLAGS+=$(subst r_,-L$(LIBR)/,$(BINDEPS))
|
2012-09-27 17:35:19 +00:00
|
|
|
LDFLAGS+=$(subst r_,-lr_,$(BINDEPS))
|
2010-01-21 20:22:30 +00:00
|
|
|
CFLAGS+=${PIC_CFLAGS}
|
|
|
|
LDFLAGS+=${PIC_CFLAGS}
|
|
|
|
else
|
2010-11-10 09:45:47 +00:00
|
|
|
ifneq ($(DEPS),)
|
2011-11-03 10:49:50 +00:00
|
|
|
LDFLAGS+=$(shell echo ${DEPS} | sed -e 's:r_\([^ ]\+\):$(LIBR)/\1/libr_\1.${EXT_AR}:g')
|
2010-01-21 20:22:30 +00:00
|
|
|
endif
|
2010-11-10 09:45:47 +00:00
|
|
|
ifneq ($(BINDEPS),)
|
2012-02-18 00:49:59 +00:00
|
|
|
LDLIBS+=$(shell echo "${BINDEPS} " | sed -e 's:r_\([^ ]*\):$(LIBR)/\1/libr_\1.${EXT_AR}:g')
|
2011-11-03 10:49:50 +00:00
|
|
|
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)
|
2011-11-03 10:49:50 +00:00
|
|
|
LDLIBS+=-lm
|
|
|
|
endif
|
2013-06-05 21:58:31 +00:00
|
|
|
endif
|
2011-11-03 10:49:50 +00:00
|
|
|
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
|
2010-01-21 20:22:30 +00:00
|
|
|
endif
|
|
|
|
endif
|
2010-01-15 00:32:28 +00:00
|
|
|
|
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
|
|
|
|
CFLAGS+=-g -Wall
|
|
|
|
|
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
|
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
|
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
|
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
|
2011-10-08 21:39:06 +00:00
|
|
|
libname=-shared -o $1.${EXT_SO} ${LDFLAGS_SONAME}$1.${EXT_SO}.${LIBVERSION}
|
2011-09-26 00:10:25 +00:00
|
|
|
endif
|
2011-10-12 01:24:19 +00:00
|
|
|
endif
|
2012-08-13 23:48:39 +00:00
|
|
|
|
|
|
|
# -- singleton
|
|
|
|
endif
|