commit
8efa9e8b85
35
Makefile
35
Makefile
|
@ -13,13 +13,21 @@ endif
|
||||||
ifeq ($(ARCH),$(filter $(ARCH),armv7l))
|
ifeq ($(ARCH),$(filter $(ARCH),armv7l))
|
||||||
override ARCH = arm
|
override ARCH = arm
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(ARCH),$(filter $(ARCH),arm64))
|
||||||
|
override ARCH = aarch64
|
||||||
|
endif
|
||||||
|
|
||||||
LIBDIR := /lib
|
LIBDIR := /lib
|
||||||
INCLUDEDIR := /usr/include
|
INCLUDEDIR := /usr/include
|
||||||
PKGCONFIGDIR := /usr/lib/pkgconfig
|
PKGCONFIGDIR := /usr/lib/pkgconfig
|
||||||
CFLAGS := -ggdb3 -O2 -Wall
|
CFLAGS := -ggdb3 -O2 -Wall
|
||||||
CPPFLAGS := -Iinclude -Iarch/${ARCH} -Iarch/common
|
CPPFLAGS := -Iinclude -Iarch/${ARCH} -Iarch/common
|
||||||
|
ifneq ($(shell uname),Darwin)
|
||||||
EXPORT_UNPREFIXED := yes
|
EXPORT_UNPREFIXED := yes
|
||||||
|
else
|
||||||
|
# Darwin does not support aliases
|
||||||
|
EXPORT_UNPREFIXED := no
|
||||||
|
endif
|
||||||
FREESTANDING := no
|
FREESTANDING := no
|
||||||
|
|
||||||
ifeq ($(FREESTANDING),yes)
|
ifeq ($(FREESTANDING),yes)
|
||||||
|
@ -34,13 +42,30 @@ endif
|
||||||
LIBUCONTEXT_C_SRC = $(wildcard arch/${ARCH}/*.c)
|
LIBUCONTEXT_C_SRC = $(wildcard arch/${ARCH}/*.c)
|
||||||
LIBUCONTEXT_S_SRC = $(wildcard arch/${ARCH}/*.S)
|
LIBUCONTEXT_S_SRC = $(wildcard arch/${ARCH}/*.S)
|
||||||
|
|
||||||
|
ifeq ($(shell test -d arch/${ARCH}/include; echo $?),0)
|
||||||
|
CPPFLAGS += -Iarch/${ARCH}/include
|
||||||
|
endif
|
||||||
|
|
||||||
LIBUCONTEXT_VERSION := $(shell head -n 1 VERSION)
|
LIBUCONTEXT_VERSION := $(shell head -n 1 VERSION)
|
||||||
LIBUCONTEXT_OBJ = ${LIBUCONTEXT_C_SRC:.c=.o} ${LIBUCONTEXT_S_SRC:.S=.o}
|
LIBUCONTEXT_OBJ = ${LIBUCONTEXT_C_SRC:.c=.o} ${LIBUCONTEXT_S_SRC:.S=.o}
|
||||||
LIBUCONTEXT_SOVERSION = 1
|
LIBUCONTEXT_SOVERSION = 1
|
||||||
|
ifeq ($(shell uname),Darwin)
|
||||||
|
LIBUCONTEXT_NAME = libucontext.dylib
|
||||||
|
LIBUCONTEXT_SONAME = libucontext.${LIBUCONTEXT_SOVERSION}.dylib
|
||||||
|
LIBUCONTEXT_POSIX_NAME = libucontext_posix.dylib
|
||||||
|
LIBUCONTEXT_POSIX_SONAME = libucontext_posix.${LIBUCONTEXT_SOVERSION}.dylib
|
||||||
|
LIBUCONTEXT_LINKER_FLAGS = -Wl,-dynamiclib,-install_name,${LIBUCONTEXT_SONAME},-current_version,${LIBUCONTEXT_SOVERSION},-compatibility_version,${LIBUCONTEXT_SOVERSION}
|
||||||
|
LIBUCONTEXT_POSIX_LINKER_FLAGS = -Wl,-dynamiclib,-install_name,${LIBUCONTEXT_POSIX_SONAME},-current_version,${LIBUCONTEXT_SOVERSION},-compatibility_version,${LIBUCONTEXT_SOVERSION}
|
||||||
|
else
|
||||||
LIBUCONTEXT_NAME = libucontext.so
|
LIBUCONTEXT_NAME = libucontext.so
|
||||||
|
LIBUCONTEXT_SONAME = libucontext.so.${LIBUCONTEXT_SOVERSION}
|
||||||
|
LIBUCONTEXT_POSIX_NAME = libucontext_posix.so
|
||||||
|
LIBUCONTEXT_POSIX_SONAME = libucontext_posix.so.${LIBUCONTEXT_SOVERSION}
|
||||||
|
LIBUCONTEXT_LINKER_FLAGS = -Wl,-shared,-soname,${LIBUCONTEXT_SONAME}
|
||||||
|
LIBUCONTEXT_POSIX_LINKER_FLAGS = -Wl,-shared,-soname,${LIBUCONTEXT_POSIX_SONAME}
|
||||||
|
endif
|
||||||
LIBUCONTEXT_STATIC_NAME = libucontext.a
|
LIBUCONTEXT_STATIC_NAME = libucontext.a
|
||||||
LIBUCONTEXT_PC = libucontext.pc
|
LIBUCONTEXT_PC = libucontext.pc
|
||||||
LIBUCONTEXT_SONAME = libucontext.so.${LIBUCONTEXT_SOVERSION}
|
|
||||||
LIBUCONTEXT_PATH = ${LIBDIR}/${LIBUCONTEXT_SONAME}
|
LIBUCONTEXT_PATH = ${LIBDIR}/${LIBUCONTEXT_SONAME}
|
||||||
LIBUCONTEXT_STATIC_PATH = ${LIBDIR}/${LIBUCONTEXT_STATIC_NAME}
|
LIBUCONTEXT_STATIC_PATH = ${LIBDIR}/${LIBUCONTEXT_STATIC_NAME}
|
||||||
LIBUCONTEXT_HEADERS = \
|
LIBUCONTEXT_HEADERS = \
|
||||||
|
@ -48,11 +73,9 @@ LIBUCONTEXT_HEADERS = \
|
||||||
include/libucontext/bits.h
|
include/libucontext/bits.h
|
||||||
LIBUCONTEXT_EXAMPLES = \
|
LIBUCONTEXT_EXAMPLES = \
|
||||||
examples/cooperative_threading
|
examples/cooperative_threading
|
||||||
LIBUCONTEXT_POSIX_NAME = libucontext_posix.so
|
|
||||||
LIBUCONTEXT_POSIX_STATIC_NAME = libucontext_posix.a
|
LIBUCONTEXT_POSIX_STATIC_NAME = libucontext_posix.a
|
||||||
LIBUCONTEXT_POSIX_C_SRC = libucontext_posix.c
|
LIBUCONTEXT_POSIX_C_SRC = libucontext_posix.c
|
||||||
LIBUCONTEXT_POSIX_OBJ = ${LIBUCONTEXT_POSIX_C_SRC:.c=.o}
|
LIBUCONTEXT_POSIX_OBJ = ${LIBUCONTEXT_POSIX_C_SRC:.c=.o}
|
||||||
LIBUCONTEXT_POSIX_SONAME = libucontext_posix.so.${LIBUCONTEXT_SOVERSION}
|
|
||||||
LIBUCONTEXT_POSIX_PATH = ${LIBDIR}/${LIBUCONTEXT_POSIX_SONAME}
|
LIBUCONTEXT_POSIX_PATH = ${LIBDIR}/${LIBUCONTEXT_POSIX_SONAME}
|
||||||
LIBUCONTEXT_POSIX_STATIC_PATH = ${LIBDIR}/${LIBUCONTEXT_POSIX_STATIC_NAME}
|
LIBUCONTEXT_POSIX_STATIC_PATH = ${LIBDIR}/${LIBUCONTEXT_POSIX_STATIC_NAME}
|
||||||
|
|
||||||
|
@ -64,8 +87,7 @@ endif
|
||||||
all: ${LIBUCONTEXT_SONAME} ${LIBUCONTEXT_STATIC_NAME} ${LIBUCONTEXT_POSIX_NAME} ${LIBUCONTEXT_POSIX_STATIC_NAME} ${LIBUCONTEXT_PC}
|
all: ${LIBUCONTEXT_SONAME} ${LIBUCONTEXT_STATIC_NAME} ${LIBUCONTEXT_POSIX_NAME} ${LIBUCONTEXT_POSIX_STATIC_NAME} ${LIBUCONTEXT_PC}
|
||||||
|
|
||||||
${LIBUCONTEXT_POSIX_NAME}: ${LIBUCONTEXT_NAME} ${LIBUCONTEXT_POSIX_OBJ}
|
${LIBUCONTEXT_POSIX_NAME}: ${LIBUCONTEXT_NAME} ${LIBUCONTEXT_POSIX_OBJ}
|
||||||
$(CC) -fPIC -o ${LIBUCONTEXT_POSIX_NAME} -Wl,-soname,${LIBUCONTEXT_POSIX_SONAME} \
|
$(CC) -fPIC -o ${LIBUCONTEXT_POSIX_NAME} ${LIBUCONTEXT_POSIX_LINKER_FLAGS} ${LIBUCONTEXT_POSIX_OBJ} ${LDFLAGS}
|
||||||
-shared ${LIBUCONTEXT_POSIX_OBJ} ${LDFLAGS}
|
|
||||||
|
|
||||||
${LIBUCONTEXT_POSIX_STATIC_NAME}: ${LIBUCONTEXT_STATIC_NAME} ${LIBUCONTEXT_POSIX_OBJ}
|
${LIBUCONTEXT_POSIX_STATIC_NAME}: ${LIBUCONTEXT_STATIC_NAME} ${LIBUCONTEXT_POSIX_OBJ}
|
||||||
$(AR) rcs ${LIBUCONTEXT_POSIX_STATIC_NAME} ${LIBUCONTEXT_POSIX_OBJ}
|
$(AR) rcs ${LIBUCONTEXT_POSIX_STATIC_NAME} ${LIBUCONTEXT_POSIX_OBJ}
|
||||||
|
@ -77,8 +99,7 @@ ${LIBUCONTEXT_STATIC_NAME}: ${LIBUCONTEXT_HEADERS} ${LIBUCONTEXT_OBJ}
|
||||||
$(AR) rcs ${LIBUCONTEXT_STATIC_NAME} ${LIBUCONTEXT_OBJ}
|
$(AR) rcs ${LIBUCONTEXT_STATIC_NAME} ${LIBUCONTEXT_OBJ}
|
||||||
|
|
||||||
${LIBUCONTEXT_NAME}: ${LIBUCONTEXT_HEADERS} ${LIBUCONTEXT_OBJ}
|
${LIBUCONTEXT_NAME}: ${LIBUCONTEXT_HEADERS} ${LIBUCONTEXT_OBJ}
|
||||||
$(CC) -fPIC -o ${LIBUCONTEXT_NAME} -Wl,-soname,${LIBUCONTEXT_SONAME} \
|
$(CC) -fPIC -o ${LIBUCONTEXT_NAME} ${LIBUCONTEXT_LINKER_FLAGS} ${LIBUCONTEXT_OBJ} ${LDFLAGS}
|
||||||
-shared ${LIBUCONTEXT_OBJ} ${LDFLAGS}
|
|
||||||
|
|
||||||
${LIBUCONTEXT_SONAME}: ${LIBUCONTEXT_NAME}
|
${LIBUCONTEXT_SONAME}: ${LIBUCONTEXT_NAME}
|
||||||
ln -sf ${LIBUCONTEXT_NAME} ${LIBUCONTEXT_SONAME}
|
ln -sf ${LIBUCONTEXT_NAME} ${LIBUCONTEXT_SONAME}
|
||||||
|
|
Loading…
Reference in New Issue