Makefile 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. # ======================================================================= #
  2. # ACK CONFIGURATION #
  3. # (Edit this before building) #
  4. # ======================================================================= #
  5. # What platform to build for by default?
  6. DEFAULT_PLATFORM = pc86
  7. # Where should the ACK put its temporary files?
  8. ACK_TEMP_DIR = /tmp
  9. # Where is the ACK going to be installed, eventually? If you don't want to
  10. # install it and just want to run the ACK from the build directory
  11. # (/tmp/ack-build/staging, by default), leave this as $(INSDIR).
  12. #PREFIX = /usr/local
  13. PREFIX = $(INSDIR)
  14. # Where do you want to put the object files used when building?
  15. BUILDDIR = $(ACK_TEMP_DIR)/ack-build
  16. # What build flags do you want to use?
  17. CFLAGS = -g
  18. LDFLAGS =
  19. # Various commands.
  20. AR = ar
  21. CC = gcc
  22. # Which build system to use; use 'ninja' or 'make' (in lower case). Leave
  23. # blank to autodetect.
  24. BUILDSYSTEM =
  25. # Build flags for ninja.
  26. NINJAFLAGS =
  27. # Build flags for make.
  28. MAKEFLAGS = -r
  29. # ======================================================================= #
  30. # END OF CONFIGURATION #
  31. # ======================================================================= #
  32. # You shouldn't need to change anything below this point unless you are
  33. # actually developing ACK.
  34. OBJDIR = $(abspath $(BUILDDIR)/obj)
  35. BINDIR = $(abspath $(BUILDDIR)/bin)
  36. LIBDIR = $(abspath $(BUILDDIR)/lib)
  37. INCDIR = $(abspath $(BUILDDIR)/include)
  38. INSDIR = $(abspath $(BUILDDIR)/staging)
  39. PLATIND = $(INSDIR)/share/ack
  40. PLATDEP = $(INSDIR)/lib/ack
  41. MAKECMDGOALS ?= +ack
  42. BUILD_FILES = $(shell find * -name '*.lua')
  43. ifneq ($(shell which ninja),)
  44. BUILDSYSTEM = ninja
  45. BUILDFLAGS = $(NINJAFLAGS)
  46. else
  47. BUILDSYSTEM = make
  48. BUILDFLAGS = $(MAKEFLAGS)
  49. endif
  50. ifneq ($(findstring +, $(MAKECMDGOALS)),)
  51. $(MAKECMDGOALS): $(BUILDDIR)/build.$(BUILDSYSTEM)
  52. @$(BUILDSYSTEM) $(BUILDFLAGS) -f $^ $(MAKECMDGOALS)
  53. endif
  54. $(BUILDDIR)/build.$(BUILDSYSTEM): first/ackbuilder.lua Makefile $(BUILD_FILES)
  55. @mkdir -p $(BUILDDIR)
  56. @lua5.1 first/ackbuilder.lua \
  57. first/build.lua build.lua \
  58. --$(BUILDSYSTEM) \
  59. OBJDIR=$(OBJDIR) \
  60. BINDIR=$(BINDIR) \
  61. LIBDIR=$(LIBDIR) \
  62. INCDIR=$(INCDIR) \
  63. INSDIR=$(INSDIR) \
  64. PLATIND=$(PLATIND) \
  65. PLATDEP=$(PLATDEP) \
  66. AR=$(AR) \
  67. CC=$(CC) \
  68. > $(BUILDDIR)/build.$(BUILDSYSTEM)
  69. install:
  70. mkdir -p $(PREFIX)
  71. tar cf - -C $(INSDIR) . | tar xvf - -C $(PREFIX)
  72. clean:
  73. @rm -rf $(BUILDDIR)