summaryrefslogtreecommitdiffstats
path: root/t/buildsystems/parallel.mk
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 21:06:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 21:06:40 +0000
commitd827c6cf1631209f5042a9d1d8a7ecc24223c8a0 (patch)
tree91a431d301efd0e524bdfb0c46e97d591a9d7b03 /t/buildsystems/parallel.mk
parentInitial commit. (diff)
downloaddebhelper-upstream.tar.xz
debhelper-upstream.zip
Adding upstream version 13.11.4.upstream/13.11.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 't/buildsystems/parallel.mk')
-rw-r--r--t/buildsystems/parallel.mk21
1 files changed, 21 insertions, 0 deletions
diff --git a/t/buildsystems/parallel.mk b/t/buildsystems/parallel.mk
new file mode 100644
index 0000000..3e0d201
--- /dev/null
+++ b/t/buildsystems/parallel.mk
@@ -0,0 +1,21 @@
+all: FIRST SECOND
+
+TMPFILE ?= $(CURDIR)/parallel.mk.lock
+
+rmtmpfile:
+ @rm -f "$(TMPFILE)"
+
+FIRST: rmtmpfile
+ @c=0; \
+ while [ $$c -le 5 ] && \
+ ([ ! -e "$(TMPFILE)" ] || [ "`cat "$(TMPFILE)"`" != "SECOND" ]); do \
+ c=$$(($$c+1)); \
+ sleep 0.1; \
+ done; \
+ rm -f "$(TMPFILE)"; \
+ if [ $$c -gt 5 ]; then exit 10; else exit 0; fi
+
+SECOND: rmtmpfile
+ @echo $@ > "$(TMPFILE)"
+
+.PHONY: all FIRST SECOND rmtmpfile