From b62135d7a0d5773b9ff839055364ee6cfb2b55a5 Mon Sep 17 00:00:00 2001 From: Moritz Bitsch Date: Sat, 21 Mar 2015 13:28:01 +0100 Subject: [PATCH] fix building on openbsd * do not depend on gnu make features * use asm coros for openbsd --- Makefile | 5 +++-- coio.c | 2 +- coro.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 3d1af75..2eb9a50 100644 --- a/Makefile +++ b/Makefile @@ -8,14 +8,14 @@ all: $(LIB) $(OBJS): coio.h coro.h -.o: .c +.c.o: $(CC) $(CFLAGS) -W -Wall -Wextra -Werror -c $*.c $(LIB): $(OBJS) $(AR) rvc $(LIB) $? testyield: testyield.c $(LIB) - $(CC) $(CFLAGS) -o $@ $^ + $(CC) $(CFLAGS) -o $@ testyield.c $(LIB) test: testyield @@ -25,3 +25,4 @@ clean: rm -f testyield .PHONY: all clean test +.SUFFIXES: .c .o diff --git a/coio.c b/coio.c index 819dd14..b50bad3 100644 --- a/coio.c +++ b/coio.c @@ -6,7 +6,7 @@ static coro_context _sched_ctx; static unsigned long _taskcount = 0; -CoioTaskList coio_ready = {0}; +CoioTaskList coio_ready = {0, 0}; CoioTask *coio_current; int diff --git a/coro.h b/coro.h index 13cc1aa..9f07c2d 100644 --- a/coro.h +++ b/coro.h @@ -303,7 +303,7 @@ void coro_stack_free (struct coro_stack *stack); # define CORO_ASM 1 # elif defined WINDOWS || defined _WIN32 # 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 # elif defined HAVE_UCONTEXT_H # define CORO_UCONTEXT 1