Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 143 lines (129 sloc) 2.64 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
# config.mk.tail

LIBR:=$(abspath $(dir $(lastword $(MAKEFILE_LIST))))

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_,-lr_,$(DEPS))
LDFLAGS+=$(subst r_,-L$(LIBR)/,$(DEPS))
LDFLAGS+=$(subst r_,-lr_,$(BINDEPS))
LDFLAGS+=$(subst r_,-L$(LIBR)/,$(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)))
LDLIBS+=-lm
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
# Output
ifeq (${OSTYPE},windows)
CFLAGS+=-D__WINDOWS__=1
EXT_AR=lib
EXT_SO=dll
EXT_EXE=.exe
TH_LIBS=
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
ifeq (${OSTYPE},darwin)
CFLAGS+=-D__UNIX__=1
EXT_AR=a
EXT_SO=dylib
EXT_EXE=
ifeq ($(shell uname -p),arm)
# iOS
TH_LIBS=
else
# OSX
TH_LIBS=-lpthread
endif
endif
ifeq (${OSTYPE},android)
CFLAGS+=-D__UNIX__=1
EXT_AR=a
EXT_SO=so
EXT_EXE=
TH_LIBS=
endif

ifeq (${EXT_SO},)
all:
@echo Unidentified platform; exit 1
endif

LIB=lib${NAME}
LIBAR=${LIB}.${EXT_AR}
LIBSO=${LIB}.${EXT_SO}
ifeq (${OSTYPE},android)
libname=-shared -o $1.${EXT_SO}
else
ifeq (${OSTYPE},windows)
libname=-shared -o $1.${EXT_SO}
else
libname=-shared -o $1.${EXT_SO} ${LDFLAGS_SONAME}$1.${EXT_SO}.${LIBVERSION}
endif
endif
Something went wrong with that request. Please try again.