Makefile 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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. # ======================================================================= #
  23. # END OF CONFIGURATION #
  24. # ======================================================================= #
  25. # You shouldn't need to change anything below this point unless you are
  26. # actually developing ACK.
  27. OBJDIR = $(abspath $(BUILDDIR)/obj)
  28. BINDIR = $(abspath $(BUILDDIR)/bin)
  29. LIBDIR = $(abspath $(BUILDDIR)/lib)
  30. INCDIR = $(abspath $(BUILDDIR)/include)
  31. INSDIR = $(abspath $(BUILDDIR)/staging)
  32. PLATIND = $(INSDIR)/share/ack
  33. PLATDEP = $(INSDIR)/lib/ack
  34. MAKECMDGOALS ?= +ack
  35. BUILD_FILES = $(shell find * -name '*.lua')
  36. NINJA := $(shell which ninja)
  37. ifneq ($(findstring +, $(MAKECMDGOALS)),)
  38. ifneq ($(NINJA),)
  39. $(MAKECMDGOALS): $(BUILDDIR)/build.ninja
  40. @ninja -f $(BUILDDIR)/build.ninja $(MAKECMDGOALS)
  41. else
  42. $(MAKECMDGOALS): $(BUILDDIR)/rules.mk
  43. +@make -r -f $(BUILDDIR)/rules.mk $@ \
  44. $(MAKEFLAGS)
  45. endif
  46. endif
  47. $(BUILDDIR)/build.ninja: first/ackbuilder.lua Makefile $(BUILD_FILES)
  48. @mkdir -p $(BUILDDIR)
  49. @lua5.1 first/ackbuilder.lua first/build.lua build.lua --ninja \
  50. OBJDIR=$(OBJDIR) \
  51. BINDIR=$(BINDIR) \
  52. LIBDIR=$(LIBDIR) \
  53. INCDIR=$(INCDIR) \
  54. INSDIR=$(INSDIR) \
  55. PLATIND=$(PLATIND) \
  56. PLATDEP=$(PLATDEP) \
  57. AR=$(AR) \
  58. CC=$(CC) \
  59. > $(BUILDDIR)/build.ninja
  60. $(BUILDDIR)/rules.mk: first/ackbuilder.lua Makefile $(BUILD_FILES)
  61. @mkdir -p $(BUILDDIR)
  62. @lua5.1 first/ackbuilder.lua first/build.lua build.lua --make \
  63. OBJDIR=$(OBJDIR) \
  64. BINDIR=$(BINDIR) \
  65. LIBDIR=$(LIBDIR) \
  66. INCDIR=$(INCDIR) \
  67. INSDIR=$(INSDIR) \
  68. PLATIND=$(PLATIND) \
  69. PLATDEP=$(PLATDEP) \
  70. AR=$(AR) \
  71. CC=$(CC) \
  72. > $(BUILDDIR)/rules.mk
  73. clean:
  74. @rm -rf $(BUILDDIR)
  75. #
  76. #CC = gcc
  77. #AR = ar
  78. #RM = rm -f
  79. #CP = cp
  80. #
  81. #hide = @
  82. #
  83. #CFLAGS += \
  84. # -I$(INCDIR) \
  85. # -Imodules/h \
  86. # -Ih
  87. #
  88. #LDFLAGS +=
  89. #
  90. #ACKFLAGS = -Ih
  91. #
  92. #all: installables
  93. #
  94. #.DELETE_ON_ERROR:
  95. #
  96. #include first/core.mk
  97. #
  98. #include modules/src/object/build.mk
  99. #include modules/src/alloc/build.mk
  100. #include modules/src/input/build.mk
  101. #include modules/src/idf/build.mk
  102. #include modules/src/system/build.mk
  103. #include modules/src/string/build.mk
  104. #include modules/src/print/build.mk
  105. #include modules/src/flt_arith/build.mk
  106. #include modules/src/em_code/build.mk
  107. #include modules/src/em_mes/build.mk
  108. #include modules/src/read_em/build.mk
  109. #
  110. #include util/amisc/build.mk
  111. #include util/cmisc/build.mk
  112. #include util/ack/build.mk
  113. #include util/LLgen/build.mk
  114. #include util/data/build.mk
  115. #include util/opt/build.mk
  116. #include util/ncgg/build.mk
  117. #include util/arch/build.mk
  118. #include util/misc/build.mk
  119. #include util/led/build.mk
  120. #include util/topgen/build.mk
  121. #include util/ego/build.mk
  122. #
  123. #include lang/cem/build.mk
  124. #include lang/basic/build.mk
  125. #include lang/pc/build.mk
  126. #include lang/m2/build.mk
  127. #
  128. #include mach/proto/as/build.mk
  129. #include mach/proto/ncg/build.mk
  130. #include mach/proto/top/build.mk
  131. #
  132. #include plat/linux/liblinux/build.mk
  133. #
  134. #include mach/i80/build.mk
  135. #include mach/i386/build.mk
  136. #include mach/i86/build.mk
  137. #include mach/m68020/build.mk
  138. ## include mach/powerpc/build.mk
  139. #include mach/vc4/build.mk
  140. #
  141. #include plat/build.mk
  142. #include plat/pc86/build.mk
  143. #include plat/cpm/build.mk
  144. #include plat/linux386/build.mk
  145. #include plat/linux68k/build.mk
  146. ## include plat/linuxppc/build.mk
  147. #include plat/rpi/build.mk
  148. #
  149. #.PHONY: installables
  150. #installables: $(INSTALLABLES)
  151. # @echo ""
  152. # @echo "Build completed successfully."
  153. #
  154. #.PHONY: install
  155. #install: installables
  156. # @echo INSTALLING into $(PREFIX)
  157. # $(hide) tar cf - -C $(INSDIR) . | tar xvf - -C $(PREFIX)
  158. #
  159. #.PHONY: clean
  160. #clean:
  161. # @echo CLEAN
  162. # $(hide) $(RM) $(CLEANABLES)
  163. #
  164. #$(INCDIR)/local.h:
  165. # @echo LOCAL
  166. # @mkdir -p $(dir $@)
  167. # $(hide) echo '#define VERSION 3' > $@
  168. # $(hide) echo '#define ACKM "$(DEFAULT_PLATFORM)"' >> $@
  169. # $(hide) echo '#define BIGMACHINE 1' >> $@
  170. # $(hide) echo '#define SYS_5' >> $@
  171. #
  172. #$(INCDIR)/em_path.h:
  173. # @echo EM_PATH
  174. # @mkdir -p $(dir $@)
  175. # $(hide) echo '#define TMP_DIR "$(ACK_TEMP_DIR)"' > $@
  176. # $(hide) echo '#define EM_DIR "$(PREFIX)"' >> $@
  177. # $(hide) echo '#define ACK_PATH "share/ack/descr"' >> $@
  178. #
  179. #-include $(DEPENDS)