Makefile 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. .PHONY: all all_javascript all_python clean clean_javascript clean_python test test_javascript test_python help
  2. SCCDC = python3 -m sccd.compiler.sccdc
  3. PYTHON = python3
  4. BROWSER = firefox 2>/dev/null -new-window
  5. JS_FLAGS = -l javascript -p eventloop
  6. PY_FLAGS = -l python -p threads
  7. SRC_DIRS = semantics
  8. BUILD_DIR = build
  9. SOURCES = $(shell find $(SRC_DIRS) -type f -name *\.xml)
  10. JS_TARGETS = $(addprefix $(BUILD_DIR)/, $(SOURCES:%.xml=%.js))
  11. PY_TARGETS = $(addprefix $(BUILD_DIR)/, $(SOURCES:%.xml=%.py))
  12. all: ## Build all tests.
  13. all: all_javascript all_python
  14. all_javascript: ## Build Javascript tests.
  15. all_javascript: $(JS_TARGETS) $(JS_TARGETS) $(JS_ONLY_TARGETS)
  16. all_python: ## Build Python tests.
  17. all_python: $(PY_TARGETS)
  18. clean: ## Remove all build artifacts.
  19. clean:
  20. rm -rf $(BUILD_DIR)
  21. test: ## Run all tests.
  22. test: test_javascript test_python
  23. test_javascript: ## Run Javascript tests. This will cause a browser window to open.
  24. test_javascript: all_javascript run_tests.html
  25. $(BROWSER) run_tests.html &
  26. test_python: ## Run Python tests.
  27. test_python:
  28. $(PYTHON) test.py $(SRC_DIRS)
  29. $(BUILD_DIR)/%.py : %.xml
  30. mkdir -p $(dir $@)
  31. -$(SCCDC) $(PY_FLAGS) -o $@ $<
  32. $(BUILD_DIR)/%.js : %.xml
  33. mkdir -p $(dir $@)
  34. -$(SCCDC) $(JS_FLAGS) -o $@ $<
  35. help: ## Show this help.
  36. @fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
  37. ##