protobuffs.mk 818 B

123456789101112131415161718192021222324252627282930
  1. # Copyright (c) 2015-2016, Loïc Hoguin <essen@ninenines.eu>
  2. # This file is part of erlang.mk and subject to the terms of the ISC License.
  3. # Verbosity.
  4. proto_verbose_0 = @echo " PROTO " $(filter %.proto,$(?F));
  5. proto_verbose = $(proto_verbose_$(V))
  6. # Core targets.
  7. define compile_proto
  8. $(verbose) mkdir -p ebin/ include/
  9. $(proto_verbose) $(call erlang,$(call compile_proto.erl,$(1)))
  10. $(proto_verbose) erlc +debug_info -o ebin/ ebin/*.erl
  11. $(verbose) rm ebin/*.erl
  12. endef
  13. define compile_proto.erl
  14. [begin
  15. protobuffs_compile:generate_source(F,
  16. [{output_include_dir, "./include"},
  17. {output_src_dir, "./ebin"}])
  18. end || F <- string:tokens("$(1)", " ")],
  19. halt().
  20. endef
  21. ifneq ($(wildcard src/),)
  22. ebin/$(PROJECT).app:: $(sort $(call core_find,src/,*.proto))
  23. $(if $(strip $?),$(call compile_proto,$?))
  24. endif