123456789101112131415161718192021222324252627282930313233343536373839 |
- VERSION=1.1
- NAME=shcheck
-
- CHECKS=$(wildcard checks/*.sh)
- DIST=$(NAME).sh
- DIST_EXAMPLE=$(NAME)_example.sh
- PKG=$(NAME)-$(VERSION)
- PKG_GZ=$(PKG).tar.gz
- PKG_BZ2=$(PKG).tar.bz2
- PKGS=$(PKG_GZ) $(PKG_BZ2)
-
- all: lint
-
- $(PKGS): $(DIST) $(DIST_EXAMPLE) README
- tar --xform='s|^|./$(NAME)-$(VERSION)/|' -acvf "$@" $^
-
- $(DIST).bz2: $(DIST)
- tar -acvf
-
- $(DIST_EXAMPLE): example.sh
- sed 's|^\. \./check.sh$$|. ./$(DIST)|' < $^ > $@; \
- chmod +x $@; \
- $(MAKE) lint_dist
-
- $(DIST): check.sh $(CHECKS)
- grep -Ev '^\. \./checks/.*\.sh$$' > $@ < $<; \
- cat $(CHECKS) | grep -v '^#' >> $@;
-
- lint_dist: $(DIST) $(DIST_EXAMPLE)
- shellcheck $^
-
- lint: example.sh check.sh $(CHECKS)
- shellcheck -x example.sh check.sh && \
- [ -f "$(DIST)" ] && $(MAKE) lint_dist
-
- .PHONY: clean
-
- clean:
- -rm -vf $(DIST) $(DIST_EXAMPLE) $(PKGS)
|