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.
 
 
 

163 line
4.5 KiB

  1. #
  2. # Define these variables from the beginning
  3. #
  4. CLEANFILES =
  5. SUFFIXES =
  6. EXTRA_DIST =
  7. #
  8. # Miscellaneous rules
  9. #
  10. lol_recursive_rule = \
  11. @if test -n "$(SUBDIRS)"; then for subdir in $(SUBDIRS); do \
  12. if test "$$subdir" != "."; then \
  13. ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $(patsubst %-recursive, %, $@)) || exit 1; \
  14. fi; done; fi
  15. bench: bench-recursive
  16. bench-recursive:
  17. $(lol_recursive_rule)
  18. lolcheck: lolcheck-recursive
  19. lolcheck-recursive:
  20. $(lol_recursive_rule)
  21. #
  22. # Flex and Bison files build rule
  23. #
  24. generated: generated-recursive
  25. generated-recursive:
  26. $(lol_recursive_rule)
  27. @if test -n "$(filter %-scanner.l, $(EXTRA_DIST))"; then \
  28. echo $(MKDIR_P) generated; \
  29. $(MKDIR_P) generated; \
  30. rm -f generated/[a-zA-Z]*; \
  31. for scanner in $(patsubst %-scanner.l, %, $(filter %-scanner.l, $(EXTRA_DIST))); do \
  32. b="`basename $$scanner`"; \
  33. echo flex -v -o "generated/$$b-scanner.cpp" "$$scanner-scanner.l"; \
  34. flex -v -o "generated/$$b-scanner.cpp" "$$scanner-scanner.l" || exit 1; \
  35. done; \
  36. for parser in $(patsubst %-parser.y, %, $(filter %-parser.y, $(EXTRA_DIST))); do \
  37. b="`basename $$parser`"; \
  38. echo bison -o "generated/$$b-parser.cpp" --defines="generated/$$b-parser.h" -d -b "generated/$$b" "$$parser-parser.y"; \
  39. bison -o "generated/$$b-parser.cpp" --defines="generated/$$b-parser.h" -d -b "generated/$$b" "$$parser-parser.y" || exit 1; \
  40. done; \
  41. fi
  42. #
  43. # .lolfx build rule
  44. #
  45. lolfx_gen = $(lolfx_gen_$(V))
  46. lolfx_gen_ = $(lolfx_gen_$(AM_DEFAULT_VERBOSITY))
  47. lolfx_gen_0 = @echo " LOLFX " $@;
  48. SUFFIXES += .lolfx
  49. .lolfx.o:
  50. $(lolfx_gen)
  51. $(AM_V_at)(echo "char const *"; \
  52. echo "lolfx_resource_$(notdir $(basename $(filter %.lolfx, $^))) ="; \
  53. $(SED) 's/"/\\"/g' $(filter %.lolfx, $^) | $(SED) 's/\([^\r]*\).*/"\1\\n"/'; \
  54. echo ";") \
  55. > $@.lolfx.cpp && \
  56. $(CXXCOMPILE) -xc++ -c $@.lolfx.cpp -o $@ && \
  57. exit=0 || exit=1; rm -f $@.lolfx.cpp ; exit "$$exit"
  58. # Disable on the fly compilation because emscripten doesn't support it
  59. # | $(CXXCOMPILE) -xc++ -c - -o $@
  60. #
  61. # PS3 fself support rules
  62. #
  63. fself_gen = $(fself_gen_$(V))
  64. fself_gen_ = $(fself_gen_$(AM_DEFAULT_VERBOSITY))
  65. fself_gen_0 = echo " FSELF " $${x}.self;
  66. fself_gen_1 = echo make_fself $${x}$(EXEEXT) $${x}.self;
  67. all-local: all-local-ps3
  68. all-local-ps3: $(PROGRAMS) $(noinst_PROGRAMS)
  69. @if test -n "$^"; then for x in $(^:%$(EXEEXT)=%); do \
  70. if test x$(MAKE_FSELF) != xno; then \
  71. $(fself_gen) \
  72. make_fself $${x}$(EXEEXT) $${x}.self; \
  73. fi; \
  74. done; fi
  75. CLEANFILES += $(PROGRAMS:%$(EXEEXT)=%.self) \
  76. $(PROGRAMS:%$(EXEEXT)=%.elf) \
  77. $(noinst_PROGRAMS:%$(EXEEXT)=%.self) \
  78. $(noinst_PROGRAMS:%$(EXEEXT)=%.elf)
  79. #
  80. # Win32 rules
  81. #
  82. # This is here in case we forget to make clean after a Windows build
  83. CLEANFILES += $(PROGRAMS:%$(EXEEXT)=%.exe) \
  84. $(noinst_PROGRAMS:%$(EXEEXT)=%.exe)
  85. #
  86. # Emscripten rules
  87. #
  88. CLEANFILES += $(PROGRAMS:%$(EXEEXT)=%.data) \
  89. $(noinst_PROGRAMS:%$(EXEEXT)=%.data)
  90. #
  91. # Android rules
  92. #
  93. all-local: all-local-android
  94. clean-local: clean-local-android
  95. if USE_ANDROID
  96. all-local-android: $(foreach p, $(PROGRAMS:%$(EXEEXT)=%), .$(p).androidstamp)
  97. .%.androidstamp: %$(EXEEXT)
  98. $(eval p := $(^:%$(EXEEXT)=%))
  99. $(eval d := .$(p).androiddir)
  100. rm -rf "$(d)"
  101. $(MKDIR_P) "$(d)" $(sort $(foreach f, $($(p)_DATA), "$(d)/assets/$(dir $(f))"))
  102. $(foreach f, $($(p)_DATA), $(LN_S) "$(abs_srcdir)/$(f)" "$(d)/assets/$(f)" &&) true
  103. $(SED) -e 's,@PROGRAM@,$(subst -,_,$(p)),' "$(top_srcdir)/build/android/AndroidManifest.xml" > "$(d)/AndroidManifest.xml"
  104. $(MKDIR_P) "$(d)/src/net/lolengine"
  105. $(SED) -e 's,@PROGRAM@,$(subst -,_,$(p)),' "$(top_srcdir)/build/android/LolActivity.java" > "$(d)/src/net/lolengine/LolActivity.java"
  106. $(MKDIR_P) "$(d)/res/values"
  107. $(SED) -e 's,@PROGRAM@,$(subst -,_,$(p)),' "$(top_srcdir)/build/android/strings.xml" > "$(d)/res/values/strings.xml"
  108. $(MKDIR_P) "$(d)/res/drawable"
  109. cp "$(top_srcdir)/build/android/icon.png" "$(d)/res/drawable/"
  110. $(MKDIR_P) "$(d)/libs/armeabi"
  111. $(LN_S) "$(abs_builddir)/$(p)$(EXEEXT)" "$(d)/libs/armeabi/lib$(p).so"
  112. $(LN_S) "$${ANDROID_NDK_ROOT}/sources/cxx-stl/stlport/libs/armeabi/libstlport_shared.so" "$(d)/libs/armeabi"
  113. android update project -t android-19 -n "$(p)" -p "$(d)"
  114. ant debug -f "$(d)/build.xml"
  115. touch $@
  116. else
  117. all-local-android:
  118. endif
  119. clean-local-android:
  120. $(foreach p, $(PROGRAMS:%$(EXEEXT)=%), rm -rf ".$(p).androiddir";)
  121. $(foreach p, $(PROGRAMS:%$(EXEEXT)=%), rm -f ".$(p).androidstamp";)
  122. #
  123. # Additional rules
  124. #
  125. EXTRA_DIST += $(foreach p, $(PROGRAMS), $($(p)_DATA))
  126. .PHONY: bench lolcheck generated