Makefile.vapigen 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # Makefile for Vala API Generator (vapigen)
  2. # Written by Evan Nemerson
  3. #
  4. # The author disclaims copyright to this source code. In place of
  5. # a legal notice, here is a blessing:
  6. #
  7. # May you do good and not evil.
  8. # May you find forgiveness for yourself and forgive others.
  9. # May you share freely, never taking more than you give.
  10. #
  11. # See http://live.gnome.org/Vala/UpstreamGuide for detailed documentation
  12. #
  13. # Variables:
  14. #
  15. # VAPIGEN_FILES
  16. #
  17. # VAPIs to create
  18. #
  19. # *_DEPS / VAPIGEN_DEPS
  20. #
  21. # The dependencies. Generally the pkg-config names.
  22. #
  23. # *_METADATADIRS / VAPIGEN_METADATADIRS
  24. #
  25. # Directory containing the metadata.
  26. #
  27. # *_VAPIDIRS / VAPIGEN_VAPIDIRS
  28. #
  29. # Additional location(s) to search for VAPI dependencies.
  30. #
  31. # *_GIRDIRS / VAPIGEN_GIRDIRS
  32. #
  33. # Additional location(s) to search for GIR dependencies.
  34. #
  35. # *_FILES
  36. #
  37. # The files which should be used to generate the VAPI.
  38. _vapigen_silent_prefix = $(_vapigen_silent_prefix_$(V))
  39. _vapigen_silent_prefix_ = $(_vapigen_silent_prefix_$(AM_DEFAULT_VERBOSITY))
  40. _vapigen_silent_prefix_0 = @echo " VAPIGEN $(1)";
  41. _vapigen_silent_opts = $(_vapigen_silent_opts_$(V))
  42. _vapigen_silent_opts_ = $(_vapigen_silent_opts_$(AM_DEFAULT_VERBOSITY))
  43. _vapigen_silent_opts_0 = --quiet
  44. _vapi_name = $(subst /,_,$(subst -,_,$(subst .,_,$(1))))
  45. define vapigen
  46. $(1): $$($(_vapi_name)_GIR)
  47. $(_vapigen_silent_prefix) \
  48. G_DEBUG='' \
  49. $(VAPIGEN) $(_vapigen_silent_opts) \
  50. --library $(1:.vapi=) \
  51. $(foreach _vapi_metadatadir_name,$(if $($(_vapi_name)_METADATADIRS),$($(_vapi_name)_METADATADIRS),$(VAPIGEN_METADATADIRS)),--metadatadir $(_vapi_metadatadir_name)) \
  52. $(foreach _vapi_dir_name,$(if $($(_vapi_name)_VAPIDIRS),$($(_vapi_name)_VAPIDIRS),$(VAPIGEN_VAPIDIRS)),--vapidir $(_vapi_dir_name)) \
  53. $(foreach _vapi_gir_dir,$(if $($(_vapi_name)_GIRDIRS),$($(_vapi_name)_GIRDIRS),$(VAPIGEN_GIRDIRS)),--girdir $(_vapi_gir_dir)) \
  54. $(foreach _vapi_dep_name,$(if $($(_vapi_name)_DEPS),$($(_vapi_name)_DEPS),$(VAPIGEN_DEPS)),--pkg $(_vapi_dep_name)) \
  55. $$($(_vapi_name)_FILES) && \
  56. touch $(1)
  57. endef
  58. $(foreach vapi,$(VAPIGEN_VAPIS),$(eval $(call vapigen,$(vapi))))