Makefile 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. # The contents of this file are subject to the Mozilla Public
  2. # License Version 1.1 (the "License"); you may not use this file
  3. # except in compliance with the License. You may obtain a copy of
  4. # the License at http://www.mozilla.org/MPL/
  5. #
  6. # Software distributed under the License is distributed on an "AS
  7. # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  8. # implied. See the License for the specific language governing
  9. # rights and limitations under the License.
  10. #
  11. # The Original Code is the Netscape Portable Runtime library.
  12. #
  13. # The Initial Developer of the Original Code is Netscape
  14. # Communications Corporation. Portions created by Netscape are
  15. # Copyright (C) 1994-2000 Netscape Communications Corporation. All
  16. # Rights Reserved.
  17. #
  18. # Contributor(s): Silicon Graphics, Inc.
  19. #
  20. # Portions created by SGI are Copyright (C) 2000-2001 Silicon
  21. # Graphics, Inc. All Rights Reserved.
  22. #
  23. # Alternatively, the contents of this file may be used under the
  24. # terms of the GNU General Public License Version 2 or later (the
  25. # "GPL"), in which case the provisions of the GPL are applicable
  26. # instead of those above. If you wish to allow use of your
  27. # version of this file only under the terms of the GPL and not to
  28. # allow others to use your version of this file under the MPL,
  29. # indicate your decision by deleting the provisions above and
  30. # replace them with the notice and other provisions required by
  31. # the GPL. If you do not delete the provisions above, a recipient
  32. # may use your version of this file under either the MPL or the
  33. # GPL.
  34. ##########################
  35. # Target dir and cc:
  36. CC = cc
  37. TARGETDIR = objs
  38. ##########################
  39. # Supported OSes:
  40. OS = LINUX
  41. ifneq ($(shell test -f /usr/include/sys/epoll.h && echo yes), yes)
  42. default:
  43. @echo "epoll not found"
  44. @exit 1
  45. endif
  46. EXTRA_OBJS = $(TARGETDIR)/md.o
  47. CFLAGS =
  48. OTHER_FLAGS += -Wall -g -O0
  49. DEFINES = -D$(OS) -DDEBUG -DMD_HAVE_EPOLL -DMALLOC_STACK
  50. ##########################
  51. # Other possible defines:
  52. # To use malloc(3) instead of mmap(2) for stack allocation:
  53. # DEFINES += -DMALLOC_STACK
  54. #
  55. # To provision more than the default 16 thread-specific-data keys
  56. # (but not too many!):
  57. # DEFINES += -DST_KEYS_MAX=<n>
  58. #
  59. # Note that you can also add these defines by specifying them as
  60. # make/gmake arguments (without editing this Makefile). For example:
  61. #
  62. # make EXTRA_CFLAGS=-UMD_HAVE_EPOLL <target>
  63. #
  64. ##########################
  65. CFLAGS += $(DEFINES) $(OTHER_FLAGS) $(EXTRA_CFLAGS)
  66. OBJS = $(TARGETDIR)/sched.o \
  67. $(TARGETDIR)/stk.o \
  68. $(TARGETDIR)/sync.o \
  69. $(TARGETDIR)/key.o \
  70. $(TARGETDIR)/io.o \
  71. $(TARGETDIR)/event.o \
  72. $(TARGETDIR)/srs.o
  73. OBJS += $(EXTRA_OBJS)
  74. SRS = $(TARGETDIR)/srs
  75. linux-debug: all
  76. all: $(TARGETDIR) $(SRS)
  77. $(TARGETDIR):
  78. if [ ! -d $(TARGETDIR) ]; then mkdir $(TARGETDIR); fi
  79. $(SRS): $(OBJS)
  80. $(CC) $(CFLAGS) -o $@ $(OBJS)
  81. $(TARGETDIR)/md.o: md.S
  82. $(CC) $(CFLAGS) -c $< -o $@
  83. $(TARGETDIR)/%.o: %.c common.h md.h Makefile
  84. $(CC) $(CFLAGS) -c $< -o $@
  85. clean:
  86. rm -rf $(TARGETDIR)