-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathMakefile-std
104 lines (86 loc) · 3.29 KB
/
Makefile-std
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# vim:noexpandtab:autoindent:tabstop=8:shiftwidth=8:filetype=make:nocindent:tw=0:
# This is a template of all of the 'Standard' stuff that we use in all our
# projects.
CLEANFILES=$(PACKAGE_NAME)-*.tar.gz $(PACKAGE_NAME)-*.tar.xz _buildtemp version
DISTCLEANFILES=*~ dist
EXTRA_DIST =
EXTRA_PROGRAMS=
CLEANFILES += $(EXTRA_PROGRAMS)
CLEANFILES += po/*.gmo src/python/libsmbios_c/__pycache__/ src/pyunit/__pycache__/ src/py-cli/__pycache__/
DISTCLEANFILES += pkg/$(PACKAGE).spec
clean-local:
-test -z "$(CLEANFILES)" || rm -rf $(CLEANFILES)
distclean-local:
-test -z "$(DISTCLEANFILES)" || rm -rf $(DISTCLEANFILES)
.PHONY: git-tag
git-tag:
git tag -s -m "tag for official release: $(PACKAGE_STRING)" v$(PACKAGE_VERSION)
.PHONY: get-version
get-version:
@echo 'PACKAGE_STRING="$(PACKAGE_STRING)"'
@echo 'PACKAGE_VERSION="$(PACKAGE_VERSION)"'
@echo 'PACKAGE="$(PACKAGE)"'
REPLACE_VARS=GETTEXT_PACKAGE PACKAGE_VERSION PACKAGE localedir libdir libexecdir datadir sysconfdir pythondir pkgpythondir pkgdatadir pkgconfdir pkggladedir pkglibexecdir
export $(REPLACE_VARS)
DATA_HOOK_REPLACE=
install-data-hook:
for i in $(DATA_HOOK_REPLACE); do \
file=$(DESTDIR)/$$i ;\
for var in $(REPLACE_VARS) ;\
do \
var="$$var" perl -p -i -e 's|^\Q$$ENV{var}\E\s*=.*|$$ENV{var}="$$ENV{$$ENV{var}}"|' $$file;\
done ;\
done
EXEC_HOOK_REPLACE=
install-exec-hook:
for i in $(EXEC_HOOK_REPLACE); do \
file=$(DESTDIR)/$$i ;\
for var in $(REPLACE_VARS) ;\
do \
var="$$var" perl -p -i -e 's|^\Q$$ENV{var}\E\s*=.*|$$ENV{var}="$$ENV{$$ENV{var}}"|' $$file;\
done ;\
done
# set default project. can be overridden on cmdline with 'make -e ...'
PROJECT=home:$(USER)
TOPDIR := $(shell cd $(top_builddir);pwd)
BUILDDIR = $(TOPDIR)/_rpmbuild
RPMDIR = $(TOPDIR)
SOURCEDIR = $(TOPDIR)
SPECFILE= $(TOPDIR)/pkg/$(PACKAGE_NAME).spec
SPECDIR = $(TOPDIR)/pkg
SRCRPMDIR = $(TOPDIR)
AM_RPM_DEFINES = --define "_topdir $(TOPDIR)" \
--define "_builddir $(BUILDDIR)" \
--define "_rpmdir $(RPMDIR)" \
--define "_sourcedir $(SOURCEDIR)" \
--define "_specdir $(SPECDIR)" \
--define "_srcrpmdir $(SRCRPMDIR)" \
$(RPM_DEFINES)
.PHONY: rpm srpm
rpm: pkg/$(PACKAGE_NAME).spec dist
mkdir -p $(BUILDDIR)
rpmbuild $(AM_RPM_DEFINES) $(CI) -ba --nodeps $(SPECFILE)
rm -rf $(BUILDDIR)
srpm: pkg/$(PACKAGE_NAME).spec dist
mkdir -p $(BUILDDIR)
rpmbuild $(AM_RPM_DEFINES) -bs --nodeps $(SPECFILE)
rm -rf $(BUILDDIR)
TARBALL=$(PACKAGE_NAME)-*.tar.xz
DESCRIBE=$(shell git describe)
debmagic: dist-xz
mkdir -p dist/
cp $(TARBALL) $(DEB_TMP_BUILDDIR)/$(PACKAGE_NAME)_$(PACKAGE_VERSION).orig.tar.xz
tar -C $(DEB_TMP_BUILDDIR) -xf $(TARBALL)
cp -ar pkg/debian $(DEB_TMP_BUILDDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)/debian
chmod +x $(DEB_TMP_BUILDDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)/debian/rules
cd $(DEB_TMP_BUILDDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) ; \
mv debian/changelog.in debian/changelog; \
dch -b -D $(DIST) "Built from source $(DESCRIBE)" -v "$(PACKAGE_VERSION)-0" ;\
dpkg-buildpackage -us -uc -D -rfakeroot ; \
mv ../*.deb $(TOPDIR)/dist/ ; \
cd -
debs:
dist=$(DIST); [ "x$${dist}" != "x" ] || dist=`lsb_release -c -s`; \
tmp_dir=`mktemp -d /tmp/libsmbios.XXXXXXXX` ; \
make debmagic DEB_TMP_BUILDDIR=$${tmp_dir} DIST=$${dist}; \
rm -rf $${tmp_dir}