如何在Makefile中自动设置版本号?
我有一个Makefile,用于启动包构建工具。我的debian文件和rpm构建文件在同一个目录中,我可以说builddeb或buildrpm和包build 现在,当我更新包时,我正在对源代码进行必要的标记,并使用新版本号手动更新Makefile。我想自动化版本号,因为这是乏味的,但我不知道如何去做 我的Makefile如下所示:如何在Makefile中自动设置版本号?,makefile,debian,packaging,rpmbuild,Makefile,Debian,Packaging,Rpmbuild,我有一个Makefile,用于启动包构建工具。我的debian文件和rpm构建文件在同一个目录中,我可以说builddeb或buildrpm和包build 现在,当我更新包时,我正在对源代码进行必要的标记,并使用新版本号手动更新Makefile。我想自动化版本号,因为这是乏味的,但我不知道如何去做 我的Makefile如下所示: # a list of tools we depend on and must install if they're missing DEBTOOLS=/usr/bin
# a list of tools we depend on and must install if they're missing
DEBTOOLS=/usr/bin/debuild-pbuilder
RPMBUILD=/usr/bin/rpmbuild
# convenience target for "make deb"
deb: my-packages_1.1.1_all.deb
# check for the pbuilder package
/usr/bin/debuild-pbuilder:
apt-get -y install pbuilder
# convenience target for "make rpm". This should acctually be strutured to depend on the RPM file as "deb" does
rpm:
my-package-1.1.1-Public.noarch.rpm
# the target package (on Ubuntu at least)
my-package_1.0_all.deb: $(DEBTOOLS)
cd my-package; debuild-pbuilder -us -uc
my-package-1.1-Public.noarch.rpm: $(RPMBUILD) tar-source
cd my-package-rpm; rpmbuild -bb SPECS/my-packages.spec
tar-source:
tar -cvzf my-packages-1.1.1.tar.gz my-package-1.1.1/
我不知道rpm,但对于debian,您可以使用-v参数创建一个调用debchange的目标 未经测试的样本:
VERSION=`git describe`
bump-version:
dch -v $(VERSION)
您可以尝试使用以下类似的方法来获取Debian版本字符串: dpkg parsechangelog-显示字段版本 我不知道rpm的案子