File: Makefile

package info (click to toggle)
dish 1.16.2-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 236 kB
  • ctags: 27
  • sloc: exp: 1,248; sh: 196; makefile: 114
file content (105 lines) | stat: -rw-r--r-- 2,869 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
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 for dish
# 
# It is needed only to create manual pages, VERSION file, and packages
# For installing the software you can use essentially ./install.sh
#

PROG = dish
DOC_MAN = $(PROG).1
DOC_MAN_NAME="tool for parallel sysadmin of multiple hosts"
DOC_HTML = $(DOC_MAN).html
DOC_SEEALSO = seealso
DIR_SRC = src
VERSION = VERSION

# Installation directories
prefix = /usr/local
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
mandir = $(prefix)/man
man1dir = $(mandir)/man1
# Debian directories
destbin = usr/bin
destman = usr/share/man/man1


all: $(VERSION) $(DIR_SRC)/$(DOC_MAN) $(DIR_SRC)/$(DOC_HTML) $(DIR_SRC)/$(DOC_SEEALSO)
	umask 022

$(VERSION): $(DIR_SRC)/$(PROG)
	$< -V > $(VERSION)

$(DIR_SRC)/$(DOC_MAN): $(DIR_SRC)/$(PROG) $(DIR_SRC)/$(DOC_SEEALSO)
	cd $(DIR_SRC) ; \
	help2man -N -n $(DOC_MAN_NAME) -i $(DOC_SEEALSO) ../$< \
	|sed -e 's/\([^\\]\)-/\1\\-/g;s/\([^\\]\)-/\1\\-/g;' > $(DOC_MAN)

$(DIR_SRC)/$(DOC_HTML): $(DIR_SRC)/$(DOC_MAN)
	cd $(DIR_SRC) ; \
	man2html $(DOC_MAN) |egrep -vi "(^Section:|^Content-type|Return to Main Contents|^Time:|<H1>$<</H1>)" |sed -e 's_H2>_H3>_g' > $(DOC_HTML)

$(DOC_SEEALSO):

clean:
	rm -f $(VERSION) $(DIR_SRC)/$(DOC_MAN) $(DIR_SRC)/$(DOC_HTML)

install: installdirs all
	if [ -n $(DESTDIR) ] ; then \
		DESTBIN=$(DESTDIR)/$(destbin) ; \
		DESTMAN=$(DESTDIR)/$(destman) ; \
	else \
		DESTBIN=$(bindir) && DESTMAN=$(man1dir) ; \
	fi ; \
	./install.sh -i -q -b $$DESTBIN -m $$DESTMAN

uninstall:
	if [ -n $(DESTDIR) ] ; then \
		DESTBIN=$(DESTDIR)/$(destbin) ; \
		DESTMAN=$(DESTDIR)/$(destman) ; \
	else \
		DESTBIN=$(bindir) && DESTMAN=$(man1dir) ; \
	fi ; \
	./install.sh -u -q -b $$DESTBIN -m $$DESTMAN

installdirs: $(DIR_SRC)/mkinstalldirs
	cd $(DIR_SRC) ; \
	if [ -n $(DESTDIR) ] ; then \
		DESTBIN=$(DESTDIR)/$(destbin) ; \
		DESTMAN=$(DESTDIR)/$(destman) ; \
	else \
		DESTBIN=$(bindir) && DESTMAN=$(man1dir) ; \
	fi ; \
	./mkinstalldirs $$DESTBIN $$DESTMAN

tar: all $(DIR_SRC)/$(DOC_HTML)
	exclude="--exclude=debian --exclude=*-stamp \
		--exclude=*.swp" ; \
	vers=`cat $(VERSION)` ; \
	dvers=`test -f debian/changelog && \
	       head -1 debian/changelog |cut -f2 -d" "|tr -d '()'` ; \
	GZIP=--best ; \
	export GZIP ; \
	cd .. && \
	tar czpvf $(PROG)-$$vers.tar.gz $(PROG)-$$vers $$exclude && \
	tar czpvf $(PROG)_$$dvers.full.tar.gz $(PROG)-$$vers

debsrc: all tar
	debuild -S

packages: all tar
	@( debuild && \
	dvers=`test -f debian/changelog && \
	       head -1 debian/changelog |cut -f2 -d" "|tr -d '()'` && \
	umask 022 && \
	echo "" && \
	echo Trying to convert $(PROG)_$${dvers}_all.deb to RPM && \
	su -c "alien -k -r ../$(PROG)_$${dvers}_all.deb" && \
	mv -f *.rpm ..)

sums:
	@vers=`cat $(VERSION)` ; \
	dvers=`head -1 debian/changelog |cut -f2 -d" "|tr -d '()'` ; \
	cd .. && \
	sha1sum *$$dvers*{rpm,deb} *$$vers*.tar.gz \
		|egrep -v "full|orig" |tac -> $(PROG)-$$vers.sha1