This repository has been archived by the owner on Jun 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.mk
89 lines (70 loc) · 2.48 KB
/
default.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Please update /.templates/default.mk and sync:
#
# source scripts/functions.sh && rsync_files
#
SHELL := /usr/bin/env bash
ALPINE = $(shell which apk 2> /dev/null)
LIBNAME = $(shell basename $$(pwd))
LANGUAGES ?= $(wildcard */)
# https://stackoverflow.com/questions/2483182/recursive-wildcards-in-gnu-make
rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))
default: $(patsubst %,default-%,$(LANGUAGES))
.PHONY: default
default-%: %
if [[ -d $< ]]; then cd $< && make default; fi
.PHONY: default-%
# Need to declare these phonies to avoid errors for packages without a particular language
.PHONY: c dotnet go java javascript objective-c perl python ruby
update-dependencies: $(patsubst %,update-dependencies-%,$(LANGUAGES))
.PHONY: update-dependencies
update-dependencies-%: %
if [[ -d $< ]]; then cd $< && make update-dependencies; fi
.PHONY: update-dependencies-%
update-changelog:
ifdef NEW_VERSION
cat CHANGELOG.md | ../scripts/update_changelog.sh $(NEW_VERSION) > CHANGELOG.md.tmp
mv CHANGELOG.md.tmp CHANGELOG.md
else
@echo -e "\033[0;31mNEW_VERSION is not defined. Can't update version :-(\033[0m"
exit 1
endif
.PHONY: update-changelog
pre-release: update-changelog $(patsubst %,pre-release-%,$(LANGUAGES))
.PHONY: pre-release
pre-release-%: %
if [[ -d $< ]]; then cd $< && make pre-release; fi
.PHONY: pre-release-%
release: publish
.PHONY: release
publish: create-and-push-release-tag $(patsubst %,publish-%,$(LANGUAGES))
.PHONY: publish
publish-%: %
if [[ -d $< ]]; then cd $< && make publish; fi
.PHONY: publish-%
create-and-push-release-tag:
[ -f '/home/cukebot/configure' ] && /home/cukebot/configure
git commit --gpg-sign --all --message "Release $(LIBNAME) v$(NEW_VERSION)"
git tag --sign "$(LIBNAME)/v$(NEW_VERSION)" -m "Release $(LIBNAME) v$(NEW_VERSION)"
git push --tags
.PHONY: create-and-push-release-tag
post-release: $(patsubst %,post-release-%,$(LANGUAGES))
.PHONY: post-release
post-release: commit-and-push-post-release
post-release-%: %
if [[ -d $< ]]; then cd $< && make post-release; fi
.PHONY: post-release-%
commit-and-push-post-release:
ifdef NEW_VERSION
git push --tags
git commit --gpg-sign --all --message "Post release $(LIBNAME) v$(NEW_VERSION)" 2> /dev/null || true
git push
else
@echo -e "\033[0;31mNEW_VERSION is not defined.\033[0m"
exit 1
endif
.PHONY: commit-and-push-post-release
clean: $(patsubst %,clean-%,$(LANGUAGES))
.PHONY: clean
clean-%: %
if [[ -d $< ]]; then cd $< && make clean; fi
.PHONY: clean-%