File: Makefile

package info (click to toggle)
propellor 5.18-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,864 kB
  • sloc: haskell: 17,638; makefile: 61; sh: 40; perl: 38
file content (65 lines) | stat: -rw-r--r-- 2,184 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
CABAL?=cabal
DATE := $(shell dpkg-parsechangelog 2>/dev/null | grep Date | cut -d " " -f2-)

build: tags propellor.1 configured
	$(CABAL) build
	@if [ -d dist-newstyle ]; then \
		ln -sf $$(cabal exec -- sh -c 'command -v propellor-config') propellor; \
	else \
		ln -sf dist/build/propellor-config/propellor-config propellor; \
	fi

install: install-bin install-src

install-bin:
	install -d $(DESTDIR)/usr/bin
	if [ -d dist-newstyle ]; then \
		install -s $$(cabal exec -- sh -c 'command -v propellor') $(DESTDIR)/usr/bin/propellor; \
	else \
		install -s dist/build/propellor/propellor $(DESTDIR)/usr/bin/propellor; \
	fi

install-src:
	install -d $(DESTDIR)/usr/src/propellor
	mkdir -p gittmp
	# cabal outputs an archive while the setup program outputs files
	if [ -z "$(findstring cabal,$(CABAL))" ]; then \
		$(CABAL) sdist --output-directory=gittmp; \
	else \
		$(CABAL) sdist -o - | (cd gittmp && tar zx --strip-components=1); \
	fi
	# cabal sdist does not preserve symlinks, so copy over file
	cd gittmp && for f in $$(find -type f); do rm -f $$f; cp -a ../$$f $$f; done
	# reset mtime on files in git bundle so bundle is reproducible
	find gittmp -print0 | xargs -0r touch --no-dereference --date="$(DATE)"
	export GIT_AUTHOR_NAME=build \
	&& export GIT_AUTHOR_EMAIL=build@buildhost \
	&& export GIT_AUTHOR_DATE="$(DATE)" \
	&& export GIT_COMMITTER_NAME=build \
	&& export GIT_COMMITTER_EMAIL=build@buildhost \
	&& export GIT_COMMITTER_DATE="$(DATE)" \
	&& cd gittmp && git init -b master \
	&& git add . \
	&& git commit -q -m "distributed version of propellor" \
	&& git bundle create $(DESTDIR)/usr/src/propellor/propellor.git master HEAD \
	&& git show-ref master --hash > $(DESTDIR)/usr/src/propellor/head
	rm -rf gittmp

clean:
	rm -rf dist dist-newstyle configured Setup \
		tags propellor propellor.1 privdata/local
	find . -name \*.o -exec rm {} \;
	find . -name \*.hi -exec rm {} \;

tags:
	@hasktags . -c 2>/dev/null || true

configured: propellor.cabal
	@if [ "$(CABAL)" = ./Setup ]; then ghc --make Setup; fi
	@$(CABAL) configure
	touch configured

propellor.1: doc/usage.mdwn doc/mdwn2man
	doc/mdwn2man propellor 1 < doc/usage.mdwn > propellor.1

.PHONY: tags