| 1 |
|
| 2 |
g> |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
SHELL=/bin/bash -o pipefail |
| 8 |
|
| 9 |
DESTDIR:=tmp |
| 10 |
|
| 11 |
all: build install |
| 12 |
|
| 13 |
build-depends: |
| 14 |
@echo "Check all build dependencies are present" |
| 15 |
@help2man --version | head -n 1 |
| 16 |
|
| 17 |
test-depends: |
| 18 |
@echo "Check all test dependencies are present" |
| 19 |
@echo -n "Codespell version: " |
| 20 |
@codespell --version |
| 21 |
@echo $$(shellcheck --version | head -n 2) |
| 22 |
|
| 23 |
build: manpage build-depends |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
manpage: |
| 32 |
@echo "Generate man page for Debcraft" |
| 33 |
mkdir --verbose --parents $(DESTDIR)/usr/share/man/man1 |
| 34 |
help2man \ |
| 35 |
--name "Easy, fast and secure way to build Debian packages" \ |
| 36 |
--section 1 \ |
| 37 |
--manual "Debcraft usage" \ |
| 38 |
--output $(DESTDIR)/usr/share/man/man1/debcraft.1 \ |
| 39 |
--no-info \ |
| 40 |
./debcraft.sh |
| 41 |
# Filter out inclusion of DEB_BUILD_OPTIONS in static Makefile. |
| 42 |
sed -i -e 's@ (currently DEB_BUILD_OPTIONS=.*)\.@.@g' \ |
| 43 |
$(DESTDIR)/usr/share/man/man1/debcraft.1 |
| 44 |
|
| 45 |
install: build |
| 46 |
install -v -p -D debcraft.sh $(DESTDIR)/usr/bin/debcraft |
| 47 |
install -v -p -D --mode=0644 bash-completion/debcraft-completion.sh $(DESTDIR)/usr/share/bash-completion/completions/debcraft |
| 48 |
# install -v -p -D --target-directory=$(DESTDIR)/usr/share/debcraft src/* |
| 49 |
# GNU 'install' does not support subdirectories, so use regular 'cp' instead |
| 50 |
cp -a src $(DESTDIR)/usr/share/debcraft |
| 51 |
|
| 52 |
install-local: |
| 53 |
@echo "Installing Debcraft as symlink at ~/bin/debcraft" |
| 54 |
mkdir -p ~/.local/bin |
| 55 |
mkdir -p ~/.local/share/bash-completion/completions |
| 56 |
ln --force --symbolic --verbose ${PWD}/debcraft.sh ~/.local/bin/debcraft |
| 57 |
ln --force --symbolic --verbose ${PWD}/bash-completion/debcraft-completion.sh ~/.local/share/bash-completion/completions/debcraft |
| 58 |
|
| 59 |
test: test-static test-debcraft |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
test-static: test-depends |
| 65 |
@echo "Running static tests" |
| 66 |
if grep --exclude Makefile --exclude Containerfile -r -E '; do|; then' *; then echo "Unnecessary semicolon use found"; exit 1; fi |
| 67 |
codespell --interactive=0 --check-filenames --check-hidden --skip=.git \ |
| 68 |
--ignore-words-list soler |
| 69 |
shellcheck -x --shell=bash $(shell grep -Irnw -e '^#!.*/bash' | sort -u |cut -d ':' -f 1 | xargs) |
| 70 |
|
| 71 |
|
| 72 |
test-debcraft: |
| 73 |
@echo "Running Debcraft tests" |
| 74 |
tests/debcraft-tests.sh |