-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
106 lines (85 loc) · 3.28 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
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
105
## Makefile to simplify Octave Forge package maintenance tasks
PACKAGE = $(shell $(SED) -n -e 's/^Name: *\(\w\+\)/\1/p' DESCRIPTION | $(TOLOWER))
VERSION = $(shell $(SED) -n -e 's/^Version: *\(\w\+\)/\1/p' DESCRIPTION | $(TOLOWER))
DEPENDS = $(shell $(SED) -n -e 's/^Depends[^,]*, \(.*\)/\1/p' DESCRIPTION | $(SED) 's/ *([^()]*),*/ /g')
RELEASE_DIR = $(PACKAGE)-$(VERSION)
RELEASE_TARBALL = $(PACKAGE)-$(VERSION).tar.gz
HTML_DIR = $(PACKAGE)-html
HTML_TARBALL = $(PACKAGE)-html.tar.gz
MD5SUM ?= md5sum
MKOCTFILE ?= mkoctfile
OCTAVE ?= octave
SED ?= sed
TAR ?= tar
TOLOWER = $(SED) -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'
.PHONY: help dist html release install all check run doc clean maintainer-clean
help:
@echo "Targets:"
@echo " dist - Create $(RELEASE_TARBALL) for release"
@echo " html - Create $(HTML_TARBALL) for release"
@echo " release - Create both of the above and show md5sums"
@echo
@echo " install - Install the package in GNU Octave"
@echo " all - Build all oct files"
@echo " check - Execute package tests (w/o install)"
@echo " run - Run Octave with development in PATH (no install)"
@echo " doc - Build Texinfo package manual"
@echo
@echo " clean - Remove releases, html documentation, and oct files"
@echo " maintainer-clean - Additionally remove all generated files"
$(RELEASE_DIR): .hg/dirstate
@echo "Creating package version $(VERSION) release ..."
-rm -rf $@
hg archive --exclude ".hg*" --exclude Makefile --type files $@
cd $@/doc && $(MAKE) all
cd $@/src && autoconf -Wall
-rm -rf $@/src/autom4te.cache
chmod -R a+rX,u+w,go-w $@
$(RELEASE_TARBALL): $(RELEASE_DIR)
$(TAR) cf - --posix $< | gzip -9n > $@
-rm -rf $<
$(HTML_DIR): install
@echo "Generating HTML documentation. This may take a while ..."
-rm -rf $@
$(OCTAVE) --silent \
--eval 'graphics_toolkit ("gnuplot");' \
--eval 'pkg load generate_html $(PACKAGE);' \
--eval 'generate_package_html ("$(PACKAGE)", "$@", "octave-forge");'
chmod -R a+rX,u+w,go-w $@
$(HTML_TARBALL): $(HTML_DIR)
$(TAR) cf - --posix $< | gzip -9n > $@
-rm -rf $<
dist: $(RELEASE_TARBALL)
html: $(HTML_TARBALL)
release: dist html
@$(MD5SUM) $(RELEASE_TARBALL) $(HTML_TARBALL)
@echo "Upload @ https://sourceforge.net/p/octave/package-releases/new/"
@echo "Execute: hg tag \"$(VERSION)\""
install: $(RELEASE_TARBALL)
@echo "Installing package locally ..."
$(OCTAVE) --silent --eval 'pkg install $(RELEASE_TARBALL);'
all:
cd src && autoconf -Wall
cd src && ./configure
cd src && $(MAKE) $@
cd src && $(MAKE) PKG_ADD PKG_DEL
check: all
$(OCTAVE) --silent \
--eval 'pkg load $(DEPENDS);' \
--eval 'addpath (fullfile ([pwd filesep "inst"]));' \
--eval 'addpath (fullfile ([pwd filesep "src"]));' \
--eval 'runtests ("inst"); runtests ("src");'
run: all
$(OCTAVE) --silent --persist \
--eval 'pkg load $(DEPENDS);' \
--eval 'addpath (fullfile ([pwd filesep "inst"]));' \
--eval 'addpath (fullfile ([pwd filesep "src"]));'
doc:
cd doc && $(MAKE) all
clean:
-rm -rf $(RELEASE_DIR) $(RELEASE_TARBALL) $(HTML_TARBALL) $(HTML_DIR)
cd src && $(MAKE) $@
cd doc && $(MAKE) $@
maintainer-clean: clean
cd src && $(MAKE) $@
cd doc && $(MAKE) $@