-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
46 lines (44 loc) · 3.01 KB
/
Makefile
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
VERSION_SRC := .version
VCMD := tools/version_cmd
VDATE := $(shell date +'%F %H:%M %:z')
gittag:
ifneq ($(TAG),)
@git status -s > /tmp/git_st_$$$$; \
if [ -s /tmp/git_st_$$$$ ]; then \
echo "All files not checked in => try again"; \
else \
$(RM) $(VCMD); \
$(RM) $(VERSION_SRC); \
echo '$(TAG)' > $(VERSION_SRC); \
echo '#!/usr/bin/env lua' > $(VCMD); \
echo 'function tag() return "$(TAG)" end' >> $(VCMD); \
echo 'function date() return "$(VDATE)" end' >> $(VCMD); \
echo 'function main()' >> $(VCMD); \
echo ' local a = {}' >> $(VCMD); \
echo ' a[#a+1] = tag()' >> $(VCMD); \
echo ' a[#a+1] = date()' >> $(VCMD); \
echo ' local s = table.concat(a," ")' >> $(VCMD); \
echo ' io.stderr:write("Lmod test suite: Version ",s,"\\n")'>> $(VCMD); \
echo 'end' >> $(VCMD); \
echo 'main()' >> $(VCMD); \
chmod +x $(VCMD); \
git commit -m "moving to TAG_VERSION $(TAG)" $(VCMD) $(VERSION_SRC); \
git tag -a $(TAG) -m 'Setting TAG_VERSION to $(TAG)' ; \
branchName=`git status | head -n 1 | sed 's/^[# ]*On branch //g'` ; \
git push origin $$branchName ; \
git push --tags origin $$branchName ; \
fi; \
rm -f /tmp/git_st_$$$$
else
@echo "To git tag do: make gittag TAG=?"
endif
world_update:
@git status -s > /tmp/git_st_$$$$; \
if [ -s /tmp/git_st_$$$$ ]; then \
echo "All files not checked in => try again"; \
else \
branchName=`git status | head -n 1 | sed 's/^[# ]*On branch //g'`; \
git push github $$branchName; \
git push --tags github $$branchName; \
fi; \
rm -f /tmp/git_st_$$$$