File: rules

package info (click to toggle)
core-memoize-clojure 0.7.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 224 kB
  • sloc: makefile: 57; xml: 53
file content (74 lines) | stat: -rwxr-xr-x 2,323 bytes parent folder | download
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
#!/usr/bin/make -f

include /usr/share/javahelper/java-vars.mk
include /usr/share/dpkg/pkg-info.mk

MDWN_DOCS = $(patsubst %.md,%.html,$(wildcard $(CURDIR)/*.md))

DEB_PKGNAME := $(shell dpkg-parsechangelog -SSource)
DEB_VERSION := $(shell dpkg-parsechangelog -SVersion)
DEB_NOEPOCH_VERSION := $(shell echo $(DEB_VERSION) | cut -d: -f2-)
DEB_UPSTREAM_VERSION := $(shell echo $(DEB_NOEPOCH_VERSION) | sed 's/-[^-]*$$//')
GIT_TAG := $(shell echo '$(DEB_UPSTREAM_VERSION)' | sed -e 's/~/_/')
UPSTREAM_GIT = https://github.com/clojure/core.memoize

export CLASSPATH=/usr/share/java/clojure.jar:/usr/share/java/core.cache.jar

PRODUCED_JAR=core.memoize.jar

%:
	dh $@ --with javahelper --with maven_repo_helper

override_jh_build: $(MDWN_DOCS)
	jar cf $(PRODUCED_JAR) -C src/main/clojure .
	mkdir -p $(CURDIR)/doc/html && mv $^ $(CURDIR)/doc/html

override_dh_auto_test:
	dh_auto_test
	(cd src/test/clojure && \
	  find . -name "test_*.clj" | xargs clojure -cp $(CURDIR)/$(PRODUCED_JAR))

override_jh_classpath:
	jh_classpath $(PRODUCED_JAR)

override_jh_installlibs:
	jh_installlibs $(PRODUCED_JAR)

override_dh_installdocs:
	dh_installdocs $(CURDIR)/*.md $(CURDIR)/doc/*

override_jh_clean:
	jh_clean
	rm -f $(CURDIR)/$(PRODUCED_JAR)
	rm -rf $(CURDIR)/doc

get-orig-source:
	uscan --download-version $(DEB_VERSION_UPSTREAM) --force-download --rename

%.html:%.md
	@echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"' \
		'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' > $@
	@echo "<html>" >> $@
	@echo "<head>" >> $@
	@echo "<title>$(shell head -n 1 $< | sed 's/^#*\s*//')</title>" >> $@
	@echo "</head>" >> $@
	@echo "<body>" >> $@
	markdown $< >> $@
	@echo "</body>" >> $@
	@echo "</html>" >> $@

gen-orig-xz:
	git tag -v $(GIT_TAG) || true
	if [ ! -f ../$(DEBPKGNAME)_$(VERSION).orig.tar.xz ] ; then \
		git archive --prefix=$(DEB_PKGNAME)-$(DEB_UPSTREAM_VERSION)/ $(GIT_TAG) | xz >../$(DEB_PKGNAME)_$(DEB_UPSTREAM_VERSION).orig.tar.xz ; \
		mkdir -p ../build-area ; \
		cp ../$(DEB_PKGNAME)_$(DEB_UPSTREAM_VERSION).orig.tar.xz ../build-area ; \
	fi

fetch-upstream-remote:
ifeq (,$(findstring https:,$(UPSTREAM_GIT)))
	$(error Using insecure proto in UPSTREAM_GIT: $(UPSTREAM_GIT))
endif
	git remote add upstream $(UPSTREAM_GIT) || true
	git remote set-url upstream $(UPSTREAM_GIT)
	git fetch upstream