aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorn-peugnet <n.peugnet@free.fr>2021-10-01 16:37:39 +0200
committern-peugnet <n.peugnet@free.fr>2021-10-01 16:37:39 +0200
commitfacd05e01768369c3b950093aba7e36814674439 (patch)
tree16df2386e79951511e369bb27dc45eb4a4db7c6c
parent875d015fc4743a457ca504ccf3ef3a9ae26d0eb3 (diff)
downloaddna-backup-facd05e01768369c3b950093aba7e36814674439.tar.gz
dna-backup-facd05e01768369c3b950093aba7e36814674439.zip
call clean and all targets on submakes
-rw-r--r--Makefile16
-rw-r--r--README.md2
-rw-r--r--exp/Makefile9
3 files changed, 16 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 8957aff..3305c13 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,14 @@
BIN := dna-backup
SRC := $(shell find . -not \( -path './exp' -prune \) -type f -name '*.go')
V := $(if $(CI),-v)
+SUBDIRS := exp
# Default installation paths
PREFIX ?= /usr/local
BINDIR = $(DESTDIR)$(PREFIX)/bin
.PHONY: all
-all: build
+all: build $(SUBDIRS)
.PHONY: build
build: $(BIN)
@@ -16,17 +17,16 @@ $(BIN): $(SRC)
go build $V -o $@
.PHONY: clean
-clean:
+clean: buildclean $(SUBDIRS)
+
+.PHONY: buildclean
+buildclean:
rm -rf $(BIN)
.PHONY: test
test:
go test $V ./...
-.PHONY: exp
-exp:
- $(MAKE) -C $@
-
.PHONY: install
install: $(BIN)
install -D $(BIN) $(BINDIR)
@@ -34,3 +34,7 @@ install: $(BIN)
.PHONY: uninstall
uninstall:
-rm -f $(BINDIR)/$(BIN)
+
+.PHONY: $(SUBDIRS)
+$(SUBDIRS):
+ $(MAKE) -C $@ $(MAKECMDGOALS)
diff --git a/README.md b/README.md
index 0f8a500..42c5348 100644
--- a/README.md
+++ b/README.md
@@ -150,7 +150,7 @@ des _chunks_ de ce fichier.
```bash
# Build
-make
+make build
# Test
make test
diff --git a/exp/Makefile b/exp/Makefile
index c2e2e3f..e7314bf 100644
--- a/exp/Makefile
+++ b/exp/Makefile
@@ -6,10 +6,11 @@ GITC := git -C $(REPO_PATH)
TEMP := temp
-.PHONY: all
-all: versions results
+.PHONY: all exp
+all exp: versions results
@echo "total size : `head --lines=1 results | cut -f1`"
@echo "version count : `wc -l versions`"
+ @echo "repo results :\n`cat results`"
versions: results
grep [0-9]$$ $< | cut -f1 > $@
@@ -18,8 +19,8 @@ results: | $(TEMP)
du -bad 2 $(TEMP) | sort -k2 > $@
$(TEMP): commits ../dna-backup
- rm -rf $(TEMP)
- ./exp.sh $< $(REPO_PATH) $(TEMP)
+ rm -rf $@
+ ./exp.sh $< $(REPO_PATH) $@
../dna-backup: .FORCE
@$(MAKE) -C .. --no-print-directory dna-backup