forked from ariadne/libucontext
build: fill in more details for freestanding builds
parent
2979186379
commit
0953d71ed1
19
Makefile
19
Makefile
|
@ -5,7 +5,7 @@ endif
|
|||
|
||||
LIBDIR := /lib
|
||||
CFLAGS := -ggdb3 -O2 -Wall
|
||||
CPPFLAGS := -Iarch/${ARCH} -Iarch/common
|
||||
CPPFLAGS := -Iinclude -Iarch/${ARCH} -Iarch/common
|
||||
EXPORT_UNPREFIXED := yes
|
||||
FREESTANDING := no
|
||||
|
||||
|
@ -28,13 +28,16 @@ LIBUCONTEXT_STATIC_NAME = libucontext.a
|
|||
LIBUCONTEXT_SONAME = libucontext.so.${LIBUCONTEXT_SOVERSION}
|
||||
LIBUCONTEXT_PATH = ${LIBDIR}/${LIBUCONTEXT_SONAME}
|
||||
LIBUCONTEXT_STATIC_PATH = ${LIBDIR}/${LIBUCONTEXT_STATIC_NAME}
|
||||
LIBUCONTEXT_HEADERS = \
|
||||
include/libucontext/libucontext.h \
|
||||
include/libucontext/bits.h
|
||||
|
||||
all: ${LIBUCONTEXT_SONAME} ${LIBUCONTEXT_STATIC_NAME}
|
||||
|
||||
${LIBUCONTEXT_STATIC_NAME}: ${LIBUCONTEXT_OBJ}
|
||||
$(AR) rcs ${LIBUCONTEXT_STATIC_NAME} ${LIBUCONTEXT_OBJ}
|
||||
|
||||
${LIBUCONTEXT_NAME}: ${LIBUCONTEXT_OBJ}
|
||||
${LIBUCONTEXT_NAME}: ${LIBUCONTEXT_HEADERS} ${LIBUCONTEXT_OBJ}
|
||||
$(CC) -o ${LIBUCONTEXT_NAME} -Wl,-soname,${LIBUCONTEXT_SONAME} \
|
||||
-shared ${LIBUCONTEXT_OBJ} ${LDFLAGS}
|
||||
|
||||
|
@ -62,4 +65,16 @@ check: test_libucontext ${LIBUCONTEXT_SONAME}
|
|||
test_libucontext: test_libucontext.c ${LIBUCONTEXT_NAME}
|
||||
$(CC) -std=c99 -D_BSD_SOURCE ${CFLAGS} ${CPPFLAGS} $@.c -o $@ -L. -lucontext
|
||||
|
||||
ifeq ($(FREESTANDING),no)
|
||||
|
||||
include/libucontext/bits.h: arch/common/bits.h
|
||||
cp arch/common/bits.h $@
|
||||
|
||||
else
|
||||
|
||||
include/libucontext/bits.h: arch/${ARCH}/freestanding/bits.h
|
||||
cp arch/${ARCH}/freestanding/bits.h
|
||||
|
||||
endif
|
||||
|
||||
.PHONY: check
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef LIBUCONTEXT_BITS_H
|
||||
#define LIBUCONTEXT_BITS_H
|
||||
|
||||
#ifndef FREESTANDING
|
||||
|
||||
#include <ucontext.h>
|
||||
|
||||
typedef ucontext_t libucontext_ucontext_t;
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -48,16 +48,7 @@ __proc: \
|
|||
|
||||
#ifndef LIBUCONTEXT_ASSEMBLY
|
||||
|
||||
#ifndef FREESTANDING
|
||||
|
||||
typedef ucontext_t libucontext_ucontext_t;
|
||||
|
||||
#endif
|
||||
|
||||
int libucontext_getcontext(libucontext_ucontext_t *);
|
||||
void libucontext_makecontext(libucontext_ucontext_t *, void (*)(), int, ...);
|
||||
int libucontext_setcontext(const libucontext_ucontext_t *);
|
||||
int libucontext_swapcontext(libucontext_ucontext_t *, const libucontext_ucontext_t *);
|
||||
#include <libucontext/libucontext.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ extern void libucontext_trampoline(void);
|
|||
|
||||
|
||||
void
|
||||
libucontext_makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
|
||||
libucontext_makecontext(libucontext_ucontext_t *ucp, void (*func)(void), int argc, ...)
|
||||
{
|
||||
greg_t *sp;
|
||||
va_list va;
|
||||
|
|
Loading…
Reference in New Issue