No Description
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.

Makefile 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # Go parameters
  2. GOCMD=go
  3. GOBUILD=$(GOCMD) build
  4. GOCLEAN=$(GOCMD) clean
  5. GOINSTALL=$(GOCMD) install
  6. GOTEST=$(GOCMD) test
  7. GODEP=$(GOTEST)
  8. GOFMT=gofmt -w
  9. GOCOVER=$(GOCMD) tool cover
  10. COVER_DIR=cover
  11. # Package lists
  12. TOPLEVEL_PKG := jsh
  13. CMD_LIST := jsh/ps jsh/free jsh/ls jsh/cat jsh/df
  14. # List building
  15. ALL_LIST = $(TOPLEVEL_PKG) $(CMD_LIST)
  16. BUILD_LIST = $(foreach int, $(ALL_LIST), $(int)_build)
  17. CLEAN_LIST = $(foreach int, $(ALL_LIST), $(int)_clean)
  18. INSTALL_LIST = $(foreach int, $(ALL_LIST), $(int)_install)
  19. IREF_LIST = $(foreach int, $(ALL_LIST), $(int)_iref)
  20. TEST_LIST = $(foreach int, $(ALL_LIST), $(int)_test)
  21. COVER_LIST = $(foreach int, $(ALL_LIST), $(int)_cover)
  22. FMT_TEST = $(foreach int, $(ALL_LIST), $(int)_fmt)
  23. # All are .PHONY for now because dependencyness is hard
  24. .PHONY: $(CLEAN_LIST) $(TEST_LIST) $(FMT_LIST) $(INSTALL_LIST) $(BUILD_LIST) $(IREF_LIST)
  25. all: install
  26. build: $(BUILD_LIST)
  27. clean: $(CLEAN_LIST)
  28. rm -rf $(COVER_DIR)
  29. install: $(INSTALL_LIST)
  30. test: $(TEST_LIST)
  31. cover: $(COVER_LIST)
  32. echo "Output in directory: $(COVER_DIR)"
  33. iref: $(IREF_LIST)
  34. fmt: $(FMT_TEST)
  35. $(BUILD_LIST): %_build: %_fmt %_iref
  36. $(GOBUILD) $*
  37. $(CLEAN_LIST): %_clean:
  38. $(GOCLEAN) $*
  39. $(INSTALL_LIST): %_install: %_fmt %_iref
  40. $(GOINSTALL) $*
  41. $(IREF_LIST): %_iref:
  42. $(GODEP) $*
  43. $(TEST_LIST): %_test:
  44. $(GOTEST) $*
  45. $(COVER_LIST): %_cover:
  46. mkdir -p $(COVER_DIR)/$*
  47. $(GOTEST) -coverprofile=$(COVER_DIR)/$*/c.out $*
  48. $(GOCOVER) -html=$(COVER_DIR)/$*/c.out -o $(COVER_DIR)/$*/index.html
  49. rm -f $(COVER_DIR)/$*/c.out
  50. $(FMT_TEST): %_fmt:
  51. [ -d ./$* ] && $(GOFMT) ./$* || $(GOFMT) .