Makefile 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/usr/bin/make
  2. #
  3. # Copyright (c) 2010-2015, Marcus Rohrmoser mobile Software
  4. # All rights reserved.
  5. #
  6. # Redistribution and use in source and binary forms, with or without modification, are permitted
  7. # provided that the following conditions are met:
  8. #
  9. # 1. Redistributions of source code must retain the above copyright notice, this list of conditions
  10. # and the following disclaimer.
  11. #
  12. # 2. The software must not be used for military or intelligence or related purposes nor
  13. # anything that's in conflict with human rights as declared in http://www.un.org/en/documents/udhr/ .
  14. #
  15. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
  16. # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  17. # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
  18. # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  19. # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  20. # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  21. # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  22. # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23. #
  24. # ##############################################################
  25. # ragel stuff. http://www.complang.org/ragel/
  26. DOT ?= dot
  27. RAGEL ?= ragel
  28. RAGEL_DIR := MROGeometry
  29. GENERATED_DIR := MROGeometry
  30. RAGEL_SOURCES := $(wildcard ./$(RAGEL_DIR)/*.rl)
  31. RAGEL_GENERATED := $(RAGEL_SOURCES:./$(RAGEL_DIR)/%.rl=./$(GENERATED_DIR)/%.m)
  32. RAGEL_PDF := $(RAGEL_SOURCES:./$(RAGEL_DIR)/%.rl=./$(GENERATED_DIR)/%.pdf)
  33. ./$(GENERATED_DIR)/%.m : ./$(RAGEL_DIR)/%.rl
  34. $(RAGEL) -e -s -G2 -C -o $@ $<
  35. ./$(GENERATED_DIR)/%.dot : ./$(RAGEL_DIR)/%.rl
  36. $(RAGEL) -e -p -V -o $@ $<
  37. %.pdf: %.dot
  38. $(DOT) -Tpdf -o $@ $<
  39. ################################################################
  40. ## Run ragel to generate statemachine implementations
  41. generate: $(RAGEL_GENERATED)
  42. ################################################################
  43. ## Create ragel statemachine charts - runs literally for hours
  44. doc: $(RAGEL_PDF)
  45. ################################################################
  46. ## remove all ragel generated artifacts
  47. clean:
  48. -rm $(RAGEL_GENERATED) $(RAGEL_PDF)