2010-01-21 21:22:30 +01:00
|
|
|
# config.mk.tail
|
2010-01-15 13:02:54 +01:00
|
|
|
|
2011-11-03 11:49:50 +01:00
|
|
|
LIBR:=$(abspath $(dir $(lastword $(MAKEFILE_LIST))))
|
2010-01-15 13:02:54 +01:00
|
|
|
|
2013-03-01 02:00:22 +01:00
|
|
|
#include $(LIBR)/../config-user.mk
|
2011-11-03 11:49:50 +01:00
|
|
|
include $(LIBR)/../global.mk
|
|
|
|
include $(LIBR)/../mk/${COMPILER}.mk
|
2011-07-13 18:55:16 +02:00
|
|
|
|
2010-01-15 01:32:28 +01:00
|
|
|
CFLAGS+=${CFLAGS_APPEND}
|
2012-06-13 01:42:47 +02:00
|
|
|
CFLAGS+=${CPPFLAGS}
|
2010-01-21 21:22:30 +01:00
|
|
|
|
|
|
|
ifeq ($(WITHPIC),1)
|
2011-11-03 11:49:50 +01:00
|
|
|
LDFLAGS+=$(subst r_,-L$(LIBR)/,$(DEPS))
|
2012-09-27 19:35:19 +02:00
|
|
|
LDFLAGS+=$(subst r_,-lr_,$(DEPS))
|
2011-11-03 11:49:50 +01:00
|
|
|
LDFLAGS+=$(subst r_,-L$(LIBR)/,$(BINDEPS))
|
2012-09-27 19:35:19 +02:00
|
|
|
LDFLAGS+=$(subst r_,-lr_,$(BINDEPS))
|
2010-01-21 21:22:30 +01:00
|
|
|
CFLAGS+=${PIC_CFLAGS}
|
|
|
|
LDFLAGS+=${PIC_CFLAGS}
|
|
|
|
else
|
2010-11-10 10:45:47 +01:00
|
|
|
ifneq ($(DEPS),)
|
2011-11-03 11:49:50 +01:00
|
|
|
LDFLAGS+=$(shell echo ${DEPS} | sed -e 's:r_\([^ ]\+\):$(LIBR)/\1/libr_\1.${EXT_AR}:g')
|
2010-01-21 21:22:30 +01:00
|
|
|
endif
|
2010-11-10 10:45:47 +01:00
|
|
|
ifneq ($(BINDEPS),)
|
2012-02-18 01:49:59 +01:00
|
|
|
LDLIBS+=$(shell echo "${BINDEPS} " | sed -e 's:r_\([^ ]*\):$(LIBR)/\1/libr_\1.${EXT_AR}:g')
|
2011-11-03 11:49:50 +01: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 11:49:50 +01:00
|
|
|
LDLIBS+=-lm
|
|
|
|
endif
|
2013-06-05 21:58:31 +00:00
|
|
|
endif
|
2011-11-03 11:49:50 +01: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 21:22:30 +01:00
|
|
|
endif
|
|
|
|
endif
|
2010-01-15 01:32:28 +01:00
|
|
|
|
2011-11-03 11:49:50 +01:00
|
|
|
endif
|
|
|
|
|
2010-01-15 01:32:28 +01:00
|
|
|
# Compiler: see mk/gcc.mk
|
|
|
|
# CC CFLAGS CC_LIB CC_AR LINK
|
|
|
|
|
|
|
|
# Debug
|
|
|
|
CFLAGS+=-g -Wall
|
|
|
|
|
2010-05-28 02:44:51 +02:00
|
|
|
# libgmp
|
|
|
|
ifeq (${HAVE_LIB_GMP},1)
|
|
|
|
CFLAGS+=-DHAVE_LIB_GMP=1
|
|
|
|
BN_LIBS=-lgmp
|
|
|
|
endif
|
|
|
|
|
2011-11-03 11:49:50 +01: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 01:32:28 +01:00
|
|
|
# XXX do it in configure stage
|
|
|
|
OSTYPE?=gnulinux
|
2013-02-06 11:47:31 +01:00
|
|
|
ifeq (${OSTYPE},auto)
|
2013-03-01 02:00:22 +01:00
|
|
|
_UNAME=$(shell uname)
|
|
|
|
ifeq ($(_UNAME),Darwin)
|
|
|
|
OSTYPE=darwin
|
|
|
|
else
|
2013-02-06 11:47:31 +01:00
|
|
|
OSTYPE=gnulinux
|
|
|
|
endif
|
2013-03-01 02:00:22 +01:00
|
|
|
endif
|
2013-11-12 02:21:31 +01:00
|
|
|
ifeq (${OSTYPE},openbsd)
|
|
|
|
OSTYPE=bsd
|
|
|
|
endif
|
|
|
|
ifeq (${OSTYPE},netbsd)
|
|
|
|
OSTYPE=bsd
|
|
|
|
endif
|
|
|
|
ifeq (${OSTYPE},freebsd)
|
|
|
|
OSTYPE=bsd
|
|
|
|
endif
|
2010-01-15 01:32:28 +01:00
|
|
|
# Output
|
|
|
|
ifeq (${OSTYPE},windows)
|
2010-01-15 17:02:04 +01:00
|
|
|
CFLAGS+=-D__WINDOWS__=1
|
2010-01-15 01:32:28 +01:00
|
|
|
EXT_AR=lib
|
|
|
|
EXT_SO=dll
|
|
|
|
EXT_EXE=.exe
|
2010-01-21 21:22:30 +01:00
|
|
|
TH_LIBS=
|
2010-01-15 01:32:28 +01:00
|
|
|
endif
|
2013-11-12 02:21:31 +01:00
|
|
|
ifeq (${OSTYPE},bsd)
|
|
|
|
CFLAGS+=-D__UNIX__=1
|
|
|
|
EXT_AR=a
|
|
|
|
EXT_SO=so
|
|
|
|
EXT_EXE=
|
|
|
|
TH_LIBS=-lpthread
|
|
|
|
endif
|
2012-06-01 14:50:24 +02:00
|
|
|
ifeq (${OSTYPE},qnx)
|
|
|
|
CFLAGS+=-D__UNIX__=1
|
|
|
|
EXT_AR=a
|
|
|
|
EXT_SO=so
|
|
|
|
EXT_EXE=
|
|
|
|
TH_LIBS=
|
|
|
|
endif
|
2010-01-15 01:32:28 +01:00
|
|
|
ifeq (${OSTYPE},gnulinux)
|
2010-01-15 17:02:04 +01:00
|
|
|
CFLAGS+=-D__UNIX__=1
|
2010-01-15 01:32:28 +01:00
|
|
|
EXT_AR=a
|
|
|
|
EXT_SO=so
|
|
|
|
EXT_EXE=
|
2010-01-21 21:22:30 +01:00
|
|
|
TH_LIBS=-lpthread
|
2010-01-15 01:32:28 +01: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 20:49:39 +01:00
|
|
|
ifeq (${OSTYPE},darwin)
|
2010-01-15 17:02:04 +01:00
|
|
|
CFLAGS+=-D__UNIX__=1
|
2010-01-15 01:32:28 +01:00
|
|
|
EXT_AR=a
|
|
|
|
EXT_SO=dylib
|
|
|
|
EXT_EXE=
|
2011-11-27 14:02:39 +01:00
|
|
|
ifeq ($(shell uname -p),arm)
|
|
|
|
# iOS
|
|
|
|
TH_LIBS=
|
|
|
|
else
|
|
|
|
# OSX
|
2010-01-21 21:22:30 +01:00
|
|
|
TH_LIBS=-lpthread
|
2010-01-15 01:32:28 +01:00
|
|
|
endif
|
2011-11-27 14:02:39 +01:00
|
|
|
endif
|
2011-09-25 06:57:13 +02:00
|
|
|
ifeq (${OSTYPE},android)
|
|
|
|
CFLAGS+=-D__UNIX__=1
|
|
|
|
EXT_AR=a
|
|
|
|
EXT_SO=so
|
|
|
|
EXT_EXE=
|
|
|
|
TH_LIBS=
|
|
|
|
endif
|
2010-01-15 01:32:28 +01:00
|
|
|
|
2010-07-03 03:35:26 +02:00
|
|
|
ifeq (${EXT_SO},)
|
2013-03-01 02:00:22 +01:00
|
|
|
main:
|
|
|
|
@echo
|
|
|
|
@echo "OSTYPE: ${OSTYPE}"
|
|
|
|
@echo ERROR: Unknown platform
|
|
|
|
@echo
|
|
|
|
@exit 1
|
2010-07-03 03:35:26 +02:00
|
|
|
endif
|
|
|
|
|
2010-01-15 01:32:28 +01:00
|
|
|
LIB=lib${NAME}
|
|
|
|
LIBAR=${LIB}.${EXT_AR}
|
|
|
|
LIBSO=${LIB}.${EXT_SO}
|
2011-09-26 02:10:25 +02:00
|
|
|
ifeq (${OSTYPE},android)
|
2011-10-20 01:58:26 +02:00
|
|
|
libname=-shared -o $1.${EXT_SO}
|
2011-09-26 02:10:25 +02:00
|
|
|
else
|
2011-10-12 03:24:19 +02:00
|
|
|
ifeq (${OSTYPE},windows)
|
|
|
|
libname=-shared -o $1.${EXT_SO}
|
|
|
|
else
|
2011-10-08 23:39:06 +02:00
|
|
|
libname=-shared -o $1.${EXT_SO} ${LDFLAGS_SONAME}$1.${EXT_SO}.${LIBVERSION}
|
2011-09-26 02:10:25 +02:00
|
|
|
endif
|
2011-10-12 03:24:19 +02:00
|
|
|
endif
|
2012-08-14 01:48:39 +02:00
|
|
|
|
|
|
|
# -- singleton
|
|
|
|
endif
|