Skip to content

Commit 0f6e180

Browse files
committed
add create-rpm target, check for VER when doing release targets
1 parent 847fa91 commit 0f6e180

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

Makefile

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ endif
2727

2828
DEBUG := 0
2929

30-
.PHONY: default clean modules load unload install patch check_hdaps mk-hdaps.diff
30+
.PHONY: default clean modules load unload install patch check_hdaps mk-hdaps.diff \
31+
check-ver set-version create-tgz create-rpm
3132
export TP_MODULES
3233

3334
#####################################################################
@@ -136,16 +137,29 @@ patch: $(KSRC)
136137
#####################################################################
137138
# Tools for preparing a release. Ignore these.
138139

139-
set-version:
140+
TGZ=../tp_smapi-$(VER).tgz
141+
142+
check-ver:
143+
@if [ -z "$(VER)"]; then \
144+
echo "VER is unset"; \
145+
echo "run: $(MAKE) $(MAKECMDGOALS) VER=<release version>"; \
146+
exit 1 ;\
147+
fi
148+
149+
set-version: check-ver
140150
perl -i -pe 's/^(tp_smapi version ).*/$${1}$(VER)/' README
141151
perl -i -pe 's/^(#define TP_VERSION ").*/$${1}$(VER)"/' thinkpad_ec.c tp_smapi.c
142152

143-
TGZ=../tp_smapi-$(VER).tgz
144-
create-tgz:
153+
create-tgz: check-ver
145154
git archive --format=tar --prefix=tp_smapi-$(VER)/ HEAD | gzip -c > $(TGZ)
146155
tar tzvf $(TGZ)
147156
echo "Ready: $(TGZ)"
148157

158+
create-rpm: create-tgz
159+
mkdir -p rpmbuild
160+
rpmbuild -tb --define "_topdir $$PWD/rpmbuild" $(TGZ)
161+
162+
149163
else
150164
#####################################################################
151165
# This part runs as a submake in kernel Makefile context:

0 commit comments

Comments
 (0)