diff options
author | n-peugnet <n.peugnet@free.fr> | 2021-09-30 17:42:43 +0200 |
---|---|---|
committer | n-peugnet <n.peugnet@free.fr> | 2021-09-30 17:42:43 +0200 |
commit | 471645d24895b8383acff8498b84dd65aab0d9c8 (patch) | |
tree | 7b9b5d7bf06a9bf7dae547b8e37682b4be4ae53a | |
parent | 9405a9fd6ced89701abbb426a9d4877fabfab657 (diff) | |
download | dna-backup-471645d24895b8383acff8498b84dd65aab0d9c8.tar.gz dna-backup-471645d24895b8383acff8498b84dd65aab0d9c8.zip |
first add of exp and Makefiles
-rw-r--r-- | .github/workflows/build.yml | 4 | ||||
-rw-r--r-- | Makefile | 36 | ||||
-rw-r--r-- | README.md | 8 | ||||
-rw-r--r-- | exp/.gitignore | 3 | ||||
-rw-r--r-- | exp/Makefile | 33 |
5 files changed, 77 insertions, 7 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d0d89e9..693cf7c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,7 +50,7 @@ jobs: ${{ runner.os }}-go- - name: Build - run: go build -v ./... + run: make build - name: Test - run: go test -v ./... + run: make test diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8957aff --- /dev/null +++ b/Makefile @@ -0,0 +1,36 @@ +BIN := dna-backup +SRC := $(shell find . -not \( -path './exp' -prune \) -type f -name '*.go') +V := $(if $(CI),-v) + +# Default installation paths +PREFIX ?= /usr/local +BINDIR = $(DESTDIR)$(PREFIX)/bin + +.PHONY: all +all: build + +.PHONY: build +build: $(BIN) + +$(BIN): $(SRC) + go build $V -o $@ + +.PHONY: clean +clean: + rm -rf $(BIN) + +.PHONY: test +test: + go test $V ./... + +.PHONY: exp +exp: + $(MAKE) -C $@ + +.PHONY: install +install: $(BIN) + install -D $(BIN) $(BINDIR) + +.PHONY: uninstall +uninstall: + -rm -f $(BINDIR)/$(BIN) @@ -142,8 +142,6 @@ des _chunks_ de ce fichier. <!-- LTeX: language=en --> ## Build instructions -_Classical go_ - ### Requirements - Go >= 1.16 @@ -152,13 +150,13 @@ _Classical go_ ```bash # Build -go build +make # Test -go test ./... +make test # Run -go run . <source-dir> <repository> +./dna-backup commit <source-dir> <repository> ``` [build-img]: https://github.com/n-peugnet/dna-backup/actions/workflows/build.yml/badge.svg diff --git a/exp/.gitignore b/exp/.gitignore new file mode 100644 index 0000000..a0991ff --- /dev/null +++ b/exp/.gitignore @@ -0,0 +1,3 @@ +* +!.gitignore +!Makefile diff --git a/exp/Makefile b/exp/Makefile new file mode 100644 index 0000000..37fa8c8 --- /dev/null +++ b/exp/Makefile @@ -0,0 +1,33 @@ +REPO_URL := https://club1.fr/~nicolas/git/dna-backup/ + +REPO_PATH := repo +GIT_PATH := git +GITC := git -C $(REPO_PATH) + +BIN_PATH := .. + +.PHONY: apply +apply: commits ../dna-backup + cat $< | while read i; do \ + $(GITC) checkout `echo "$$i" | cut -f1`; \ + done + +$(BIN_PATH)/dna-backup: .FORCE + $(MAKE) -C $(BIN_PATH) dna-backup + +commits: Makefile repo git + $(GITC) log --reverse --no-merges --pretty=tformat:"%H %as" \ + | sort --unique --key=2 \ + > $@ + +repo git: + git clone --separate-git-dir=$(GIT_PATH) $(REPO_URL) $(REPO_PATH) +# remove warning about detached head state + $(GITC) config advice.detachedHead false + +.PHONY: clean +clean: + rm -rf $(REPO_PATH) $(GIT_PATH) + rm -f commits + +.FORCE: ; |