forked from overfl0/mockfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (47 loc) · 1.72 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
CTAGS ?= ctags
NOSE ?= nosetests
PYTHON ?= python
RSYNC ?= rsync -r --stats --delete --exclude=.gitignore --exclude=.git
RM ?= rm
# Define MOCKFS_PREFIX in the environment to override the default prefix,
# or supply "DESTDIR" and "prefix" on the command-line, e.g.
# make DESTDIR=/tmp/DESTDIR prefix=/usr install
MOCKFS_PREFIX ?= $(CURDIR)/mockfs-$(version)
prefix ?= $(MOCKFS_PREFIX)
libdir ?= $(shell $(PYTHON) -c 'import os, distutils.sysconfig as sc; print(os.path.basename(sc.get_config_var("LIBDIR")))')
pythonver ?= $(shell $(PYTHON) -c 'import distutils.sysconfig as sc; print(sc.get_python_version())')
pythonsite ?= $(prefix)/$(libdir)/python$(pythonver)/site-packages
docdir ?= $(prefix)/share/doc/mockfs/html
webdir ?= $(docdir)
version ?= $(shell grep __version__ mockfs/__init__.py | \
awk '{print $$3}' | sed -e "s,',,g")
SETUP_INSTALL_ARGS ?= --single-version-externally-managed --record MANIFEST
ifdef DESTDIR
SETUP_INSTALL_ARGS += --root=$(DESTDIR)
endif
ifndef mac_pkg
SETUP_INSTALL_ARGS += --prefix=$(prefix)
SETUP_INSTALL_ARGS += --install-lib=$(pythonsite)
endif
# Site configuration goes in untracked config.mak
-include config.mak
all: mockfs/*.py setup.py
@echo mockfs v$(version)
$(PYTHON) setup.py build
install: all
$(PYTHON) setup.py install $(SETUP_INSTALL_ARGS)
docs: all
@$(RM) -rf docs/build
@$(MAKE) -C docs html
install-doc: docs
@mkdir -p $(DESTDIR)$(docdir)
@$(RSYNC) docs/build/html/ $(DESTDIR)$(docdir)/
website-docs: docs
@mkdir -p $(DESTDIR)$(webdir)
@$(RSYNC) docs/build/html/ $(DESTDIR)$(webdir)/
tags:
find mockfs -name '*.py' -print0 | xargs -0 $(CTAGS)
test: all
@$(MAKE) -C docs doctest
@$(NOSE) --with-doctest
.PHONY: all docs install install-docs website-docs tags test