-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
executable file
·77 lines (66 loc) · 2.29 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
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
#!/usr/bin/make
# WARN: gmake syntax
########################################################
# Makefile for simApi extension
#
# useful targets:
# make clean ----- cleans distutils
# make pylint ---- source code checks
# make rpm ------ produce RPMs
#
########################################################
# variable section
NAME = "simApi"
PYTHON=python
SITELIB = $(shell $(PYTHON) -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")
# VERSION file provides one place to update the software version
VERSION := $(shell cat VERSION)
# RPM build parameters
RPMSPECDIR = .
RPMSPEC = $(RPMSPECDIR)/simApi.spec
########################################################
all: clean pylint rpm
pylint:
find . -name \*.py | xargs pylint --rcfile .pylintrc
pylint --rcfile .pylintrc plugins/*
clean:
@echo "---------------------------------------------"
@echo "Cleaning up distutils stuff"
@echo "---------------------------------------------"
rm -rf build
rm -rf dist
rm -rf MANIFEST
@echo "---------------------------------------------"
@echo "Cleaning up rpmbuild stuff"
@echo "---------------------------------------------"
rm -rf rpmbuild
@echo "---------------------------------------------"
@echo "Cleaning up byte compiled python stuff"
@echo "---------------------------------------------"
find . -type f -regex ".*\.py[co]$$" -delete
@echo "---------------------------------------------"
@echo "Removing simApi.egg-info"
@echo "---------------------------------------------"
rm -rf simApi.egg-info
sdist: clean
$(PYTHON) setup.py sdist
rpmcommon: sdist
@mkdir -p rpmbuild
@cp dist/*.gz rpmbuild/
@sed -e 's#^Version:.*#Version: $(VERSION)#' $(RPMSPEC) >rpmbuild/$(NAME).spec
rpm: rpmcommon
@rpmbuild --define "_topdir %(pwd)/rpmbuild" \
--define "_builddir %{_topdir}" \
--define "_rpmdir %{_topdir}" \
--define "_srcrpmdir %{_topdir}" \
--define "_specdir $(RPMSPECDIR)" \
--define "_sourcedir %{_topdir}" \
--define "_rpmfilename %%{NAME}-%%{VERSION}.rpm" \
--define "__python /usr/bin/python" \
-ba rpmbuild/$(NAME).spec
@rm -f rpmbuild/$(NAME).spec
@rm -f rpmbuild/*.src.rpm
@echo "---------------------------------------------"
@echo "simApi RPM is built:"
@echo " rpmbuild/$(NAME)-$(VERSION).rpm"
@echo "---------------------------------------------"