summaryrefslogtreecommitdiff
path: root/ext/ffi_c/libffi.bsd.mk
blob: 16ec6b5e45ef63c8973bc05ca5095696194af304 (plain)
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
# -*- makefile -*-
#
# Makefile for BSD systems
#

INCFLAGS += -I${LIBFFI_BUILD_DIR}/include
LOCAL_LIBS += ${LIBFFI} -lpthread

LIBFFI_CFLAGS = ${FFI_MMAP_EXEC} -pthread
LIBFFI_BUILD_DIR = ${.CURDIR}/libffi-${arch}

.if ${srcdir} == "."
  LIBFFI_SRC_DIR := ${.CURDIR}/libffi
.else
  LIBFFI_SRC_DIR := ${srcdir}/libffi
.endif


LIBFFI = ${LIBFFI_BUILD_DIR}/.libs/libffi_convenience.a
LIBFFI_CONFIGURE = ${LIBFFI_SRC_DIR}/configure --disable-static \
	--with-pic=yes --disable-dependency-tracking

$(OBJS):	${LIBFFI}

$(LIBFFI):		
	@mkdir -p ${LIBFFI_BUILD_DIR}
	@if [ ! -f ${LIBFFI_BUILD_DIR}/Makefile ]; then \
	    echo "Configuring libffi"; \
	    cd ${LIBFFI_BUILD_DIR} && \
		/usr/bin/env CC="${CC}" LD="${LD}" CFLAGS="${LIBFFI_CFLAGS}" GREP_OPTIONS="" \
		/bin/sh ${LIBFFI_CONFIGURE} ${LIBFFI_HOST} > /dev/null; \
	fi
	@cd ${LIBFFI_BUILD_DIR} && ${MAKE}