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.
 
 
 

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