OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
2.4 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../protothread/makefile.patch
  5. # Copyright (C) 2009 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. Index: protothread.h
  17. ===================================================================
  18. --- ./protothread.h (revision 3)
  19. +++ ./protothread.h (working copy)
  20. @@ -6,7 +6,9 @@
  21. #ifndef PROTOTHREAD_H
  22. #define PROTOTHREAD_H
  23. +#ifndef PT_DEBUG
  24. #define PT_DEBUG 1 /* enabled (else 0) */
  25. +#endif
  26. #define pt_assert(condition) if (PT_DEBUG) assert(condition)
  27. /* standard definitions */
  28. Index: Makefile
  29. ===================================================================
  30. --- ./Makefile (revision 3)
  31. +++ ./Makefile (working copy)
  32. @@ -1,15 +1,56 @@
  33. +CC = gcc
  34. +LD = gcc
  35. +AR = ar
  36. CFLAGS = -g -Wall
  37. -OBJS = \
  38. - protothread_test.o \
  39. +prefix = /usr/local
  40. +bindir = $(prefix)/bin
  41. +libdir = $(prefix)/lib
  42. +includedir = $(prefix)/include
  43. +DESTDIR =
  44. +
  45. +ifeq ($(DEBUG),yes)
  46. + CFLAGS += -DPT_DEBUG=1
  47. +else
  48. +ifeq ($(DEBUG),no)
  49. + CFLAGS += -DPT_DEBUG=0
  50. +endif
  51. +endif
  52. +
  53. +SRCDIR = .
  54. +
  55. +TARGETS = pttest libprotothread.a
  56. +
  57. +LIB_OBJS = \
  58. protothread_lock.o \
  59. protothread_sem.o \
  60. protothread.o \
  61. -pttest: $(OBJS) protothread.h
  62. - $(CC) $(CFLAGS) -o $@ $(OBJS)
  63. +OBJS = $(LIB_OBJS) \
  64. + protothread_test.o
  65. -$(OBJS): protothread.h
  66. +.PHONY: all clean install
  67. +
  68. +all: $(TARGETS)
  69. +
  70. +define OBJ_template
  71. +$(1).o: $(SRCDIR)/$(1).c $(wildcard $(SRCDIR)/$(1).h) $(SRCDIR)/protothread.h
  72. + $(CC) $(CFLAGS) -c -o $$@ -I$(SRCDIR)/ $$<
  73. +endef
  74. +
  75. +$(foreach x,$(basename $(OBJS)),$(eval $(call OBJ_template,$(x))))
  76. +
  77. +pttest: $(OBJS)
  78. + $(LD) $(LDFLAGS) -o $@ $^
  79. +
  80. +libprotothread.a: $(LIB_OBJS)
  81. + $(AR) rcs $@ $^
  82. +
  83. clean:
  84. - rm -f *.o
  85. + rm -f *.o $(TARGETS)
  86. +
  87. +install:
  88. + cp -vf pttest $(DESTDIR)$(bindir)/pttest$(SUFFIX)
  89. + cp -vf libprotothread.a $(DESTDIR)$(libdir)/libprotothread$(SUFFIX).a
  90. + cp -vf $(SRCDIR)/*.h $(DESTDIR)$(includedir)/