fix building on openbsd

* do not depend on gnu make features
* use asm coros for openbsd
This commit is contained in:
Moritz Bitsch 2015-03-21 13:28:01 +01:00
parent 0452e702a1
commit b62135d7a0
3 changed files with 5 additions and 4 deletions

View file

@ -8,14 +8,14 @@ all: $(LIB)
$(OBJS): coio.h coro.h $(OBJS): coio.h coro.h
.o: .c .c.o:
$(CC) $(CFLAGS) -W -Wall -Wextra -Werror -c $*.c $(CC) $(CFLAGS) -W -Wall -Wextra -Werror -c $*.c
$(LIB): $(OBJS) $(LIB): $(OBJS)
$(AR) rvc $(LIB) $? $(AR) rvc $(LIB) $?
testyield: testyield.c $(LIB) testyield: testyield.c $(LIB)
$(CC) $(CFLAGS) -o $@ $^ $(CC) $(CFLAGS) -o $@ testyield.c $(LIB)
test: testyield test: testyield
@ -25,3 +25,4 @@ clean:
rm -f testyield rm -f testyield
.PHONY: all clean test .PHONY: all clean test
.SUFFIXES: .c .o

2
coio.c
View file

@ -6,7 +6,7 @@
static coro_context _sched_ctx; static coro_context _sched_ctx;
static unsigned long _taskcount = 0; static unsigned long _taskcount = 0;
CoioTaskList coio_ready = {0}; CoioTaskList coio_ready = {0, 0};
CoioTask *coio_current; CoioTask *coio_current;
int int

2
coro.h
View file

@ -303,7 +303,7 @@ void coro_stack_free (struct coro_stack *stack);
# define CORO_ASM 1 # define CORO_ASM 1
# elif defined WINDOWS || defined _WIN32 # elif defined WINDOWS || defined _WIN32
# define CORO_LOSER 1 /* you don't win with windoze */ # define CORO_LOSER 1 /* you don't win with windoze */
# elif __linux && (__i386 || (__x86_64 && !__ILP32)) # elif (__linux || __OpenBSD__) && (__i386 || (__x86_64 && !__ILP32))
# define CORO_ASM 1 # define CORO_ASM 1
# elif defined HAVE_UCONTEXT_H # elif defined HAVE_UCONTEXT_H
# define CORO_UCONTEXT 1 # define CORO_UCONTEXT 1