Makefile 2.53 KB
Newer Older
1 2
# export SVN_REPO_BASE=. if you want to use the local version instead of trunk
# from the subversion repository.
3

4
# use something like "VERSION=0.2 make" to override the VERSION on the command line
5
VERSION ?= $(shell sed -n "s/^.*[\t ]*VERSION[\t ]*=[\t ]*[\"']\([^\"']*\)[\"'].*/\1/gp" pycam/__init__.py)
6
REPO_TAGS ?= https://pycam.svn.sourceforge.net/svnroot/pycam/tags
7 8
RELEASE_PREFIX ?= pycam-
ARCHIVE_DIR_RELATIVE ?= release-archives
9
EXPORT_DIR = $(RELEASE_PREFIX)$(VERSION)
10
EXPORT_FILE_PREFIX = $(EXPORT_DIR)
11 12 13
EXPORT_ZIP = $(EXPORT_FILE_PREFIX).zip
EXPORT_TGZ = $(EXPORT_FILE_PREFIX).tar.gz
EXPORT_WIN32 = $(EXPORT_FILE_PREFIX).win32.exe
14 15 16 17
PYTHON_EXE ?= python
# check if the local version of python's distutils support "--plat-name"
# (introduced in python 2.6)
DISTUTILS_PLAT_NAME = $(shell $(PYTHON_EXE) setup.py --help build_ext | grep -q -- "--plat-name" && echo "--plat-name win32")
lode_leroy's avatar
lode_leroy committed
18

19 20
# turn the destination directory into an absolute path
ARCHIVE_DIR := $(shell pwd)/$(ARCHIVE_DIR_RELATIVE)
lode_leroy's avatar
lode_leroy committed
21

22
.PHONY: zip tgz win32 clean dist git_export upload create_archive_dir man
lode_leroy's avatar
lode_leroy committed
23

24
dist: zip tgz win32
25 26
	@# remove the tmp directory when everything is done
	@rm -rf "$(EXPORT_DIR)"
lode_leroy's avatar
lode_leroy committed
27

28 29 30
clean:
	@rm -rf "$(EXPORT_DIR)"

31
man: git_export
32 33
	@make -C "$(EXPORT_DIR)/man"

34 35 36 37
git_export: clean
	@if git status 2>/dev/null >&2;\
		then git clone . "$(EXPORT_DIR)";\
		else echo "No git repo found."; exit 1;\
38
	fi
39
	# Windows needs a different name for the startup script - due to process creation (no fork/exec)
40
	@cp "$(EXPORT_DIR)/scripts/pycam" "$(EXPORT_DIR)/scripts/pycam-loader.py"
41

42
create_archive_dir:
sumpfralle's avatar
sumpfralle committed
43
	@mkdir -p "$(ARCHIVE_DIR)"
44

45
zip: create_archive_dir man git_export
46
	cd "$(EXPORT_DIR)"; $(PYTHON_EXE) setup.py sdist --format zip --dist-dir "$(ARCHIVE_DIR)"
47

48
tgz: create_archive_dir man git_export
49
	cd "$(EXPORT_DIR)"; $(PYTHON_EXE) setup.py sdist --format gztar --dist-dir "$(ARCHIVE_DIR)"
50

51
win32: create_archive_dir man git_export
52
	# this is a binary release
53
	cd "$(EXPORT_DIR)"; $(PYTHON_EXE) setup.py bdist_wininst --user-access-control force --dist-dir "$(ARCHIVE_DIR)" $(DISTUTILS_PLAT_NAME)
54

55
upload:
56 57 58 59
	svn cp "$(SVN_REPO_BASE)" "$(REPO_TAGS)/release-$(VERSION)" -m "tag release $(VERSION)"
	svn import "$(ARCHIVE_DIR)/$(EXPORT_ZIP)" "$(REPO_TAGS)/archives/$(EXPORT_ZIP)" -m "added released zip file for version $(VERSION)"
	svn import "$(ARCHIVE_DIR)/$(EXPORT_TGZ)" "$(REPO_TAGS)/archives/$(EXPORT_TGZ)" -m "added released tgz file for version $(VERSION)"
	svn import "$(ARCHIVE_DIR)/$(EXPORT_WIN32)" "$(REPO_TAGS)/archives/$(EXPORT_WIN32)" -m "added released win32 installer for version $(VERSION)"
lode_leroy's avatar
lode_leroy committed
60