|
|
@ -14,43 +14,84 @@ |
|
|
|
# version.
|
|
|
|
# version.
|
|
|
|
# --- SDE-COPYRIGHT-NOTE-END ---
|
|
|
|
# --- SDE-COPYRIGHT-NOTE-END ---
|
|
|
|
|
|
|
|
|
|
|
|
--- ./Makefile.orig 2009-01-18 19:12:34.000000000 +0000
|
|
|
|
Index: protothread.h
|
|
|
|
+++ ./Makefile 2009-01-18 19:40:18.000000000 +0000
|
|
|
|
===================================================================
|
|
|
|
@@ -1,15 +1,36 @@
|
|
|
|
--- ./protothread.h (revision 3)
|
|
|
|
|
|
|
|
+++ ./protothread.h (working copy)
|
|
|
|
|
|
|
|
@@ -6,7 +6,9 @@
|
|
|
|
|
|
|
|
#ifndef PROTOTHREAD_H
|
|
|
|
|
|
|
|
#define PROTOTHREAD_H
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+#ifndef PT_DEBUG
|
|
|
|
|
|
|
|
#define PT_DEBUG 1 /* enabled (else 0) */
|
|
|
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
#define pt_assert(condition) if (PT_DEBUG) assert(condition)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* standard definitions */
|
|
|
|
|
|
|
|
Index: Makefile
|
|
|
|
|
|
|
|
===================================================================
|
|
|
|
|
|
|
|
--- ./Makefile (revision 3)
|
|
|
|
|
|
|
|
+++ ./Makefile (working copy)
|
|
|
|
|
|
|
|
@@ -1,15 +1,56 @@
|
|
|
|
+CC = gcc
|
|
|
|
+CC = gcc
|
|
|
|
|
|
|
|
+LD = gcc
|
|
|
|
+AR = ar
|
|
|
|
+AR = ar
|
|
|
|
CFLAGS = -g -Wall
|
|
|
|
CFLAGS = -g -Wall
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-OBJS = \
|
|
|
|
|
|
|
|
- protothread_test.o \
|
|
|
|
+prefix = /usr/local
|
|
|
|
+prefix = /usr/local
|
|
|
|
+bindir = $(prefix)/bin
|
|
|
|
+bindir = $(prefix)/bin
|
|
|
|
+libdir = $(prefix)/lib
|
|
|
|
+libdir = $(prefix)/lib
|
|
|
|
+DESTDIR=
|
|
|
|
+includedir = $(prefix)/include
|
|
|
|
|
|
|
|
+DESTDIR =
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+ifeq ($(DEBUG),yes)
|
|
|
|
|
|
|
|
+ CFLAGS += -DPT_DEBUG=1
|
|
|
|
|
|
|
|
+else
|
|
|
|
|
|
|
|
+ifeq ($(DEBUG),no)
|
|
|
|
|
|
|
|
+ CFLAGS += -DPT_DEBUG=0
|
|
|
|
|
|
|
|
+endif
|
|
|
|
|
|
|
|
+endif
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+TARGETS = pttest protothread.a
|
|
|
|
+SRCDIR = .
|
|
|
|
+
|
|
|
|
+
|
|
|
|
OBJS = \
|
|
|
|
+TARGETS = pttest libprotothread.a
|
|
|
|
protothread_test.o \
|
|
|
|
+
|
|
|
|
|
|
|
|
+LIB_OBJS = \
|
|
|
|
protothread_lock.o \
|
|
|
|
protothread_lock.o \
|
|
|
|
protothread_sem.o \
|
|
|
|
protothread_sem.o \
|
|
|
|
protothread.o \
|
|
|
|
protothread.o \
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
-pttest: $(OBJS) protothread.h
|
|
|
|
|
|
|
|
- $(CC) $(CFLAGS) -o $@ $(OBJS)
|
|
|
|
|
|
|
|
+OBJS = $(LIB_OBJS) \
|
|
|
|
|
|
|
|
+ protothread_test.o
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-$(OBJS): protothread.h
|
|
|
|
|
|
|
|
|
|
|
|
+.PHONY: all clean install
|
|
|
|
+.PHONY: all clean install
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+all: $(TARGETS)
|
|
|
|
+all: $(TARGETS)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
pttest: $(OBJS) protothread.h
|
|
|
|
+define OBJ_template
|
|
|
|
$(CC) $(CFLAGS) -o $@ $(OBJS)
|
|
|
|
+$(1).o: $(SRCDIR)/$(1).c $(wildcard $(SRCDIR)/$(1).h) $(SRCDIR)/protothread.h
|
|
|
|
|
|
|
|
+ $(CC) $(CFLAGS) -c -o $$@ -I$(SRCDIR)/ $$<
|
|
|
|
+protothread.a: $(OBJS)
|
|
|
|
+endef
|
|
|
|
+ $(AR) rcs $@ $(OBJS)
|
|
|
|
+
|
|
|
|
|
|
|
|
+$(foreach x,$(basename $(OBJS)),$(eval $(call OBJ_template,$(x))))
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+pttest: $(OBJS)
|
|
|
|
|
|
|
|
+ $(LD) $(LDFLAGS) -o $@ $^
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+libprotothread.a: $(LIB_OBJS)
|
|
|
|
|
|
|
|
+ $(AR) rcs $@ $^
|
|
|
|
+
|
|
|
|
+
|
|
|
|
$(OBJS): protothread.h
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clean:
|
|
|
|
clean:
|
|
|
|
- rm -f *.o
|
|
|
|
- rm -f *.o
|
|
|
|
+ rm -f $(OBJS) $(TARGETS)
|
|
|
|
+ rm -f *.o $(TARGETS)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+install:
|
|
|
|
+install:
|
|
|
|
+ cp -vf pttest $(DESTDIR)$(bindir)/
|
|
|
|
+ cp -vf pttest $(DESTDIR)$(bindir)/pttest$(SUFFIX)
|
|
|
|
+ cp -vf protothread.a $(DESTDIR)$(libdir)/
|
|
|
|
+ cp -vf libprotothread.a $(DESTDIR)$(libdir)/libprotothread$(SUFFIX).a
|
|
|
|
|
|
|
|
+ cp -vf $(SRCDIR)/*.h $(DESTDIR)$(includedir)/
|
|
|
|