File: Makefile

package info (click to toggle)
stda 1.3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, sid, stretch
  • size: 240 kB
  • ctags: 64
  • sloc: sh: 1,664; makefile: 108
file content (130 lines) | stat: -rw-r--r-- 3,585 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#
# Makefile for STDA
#

PNAME = stda
VERSION = VERSION
DIR_SRC = src
DOC_MAN = $(DIR_SRC)/$(PNAME).1
DOC_TEXT = $(DIR_SRC)/$(PNAME).txt
PROGS = $(DIR_SRC)/maphimbu $(DIR_SRC)/mintegrate $(DIR_SRC)/mmval $(DIR_SRC)/nnum $(DIR_SRC)/muplot $(DIR_SRC)/prefield
MAN_PAGES = $(DIR_SRC)/maphimbu.1 $(DIR_SRC)/mintegrate.1 $(DIR_SRC)/mmval.1 $(DIR_SRC)/nnum.1 $(DIR_SRC)/muplot.1 $(DIR_SRC)/prefield.1


# Installation directories (default)
base   = /usr/local
bindir = $(base)/bin
mandir = $(base)/man/man1
# Installation directories (Debian)
bindeb = usr/bin
mandeb = usr/share/man/man1
docdeb = usr/share/doc/$PNAME


all: $(VERSION) manpages
	@echo Done.

$(VERSION):
	expr `pwd` : ".*$(PNAME)-\([0-9\.]*\)" > $(VERSION)

manpages: $(DOC_MAN) $(MAN_PAGES) $(PROGS)

$(DOC_MAN): README show_package_desc.sh
	rm -f tar.stamp
	pname="`grep -iE ' \($(PNAME)\)' README |tr -s ' '`" ; \
	help2man -N -n "$$pname" ./show_package_desc.sh \
		|sed -e 's/\([( ]\)\\fB/\1/g;' > $@

%.1: %
	fname=`basename $<` ; \
	pname="`$< -h |grep ^$$fname |cut -f2- -d:`" ; \
	help2man -N -n "$$pname" $< \
		|sed -e 's/\([( ]\)\\fB/\1/g; s/\([^\\]\)-/\1\\-/g; s/\([^\\]\)-/\1\\-/g;' \
		> $<.1 ; \
	rm -f tar.stamp

update:
	cd $(DIR_SRC) && ls -1 \
		|grep -v \.1$ \
		|while read f; \
		do diff -q ~/bin/$$f $$f >/dev/null || cp -p ~/bin/$$f .; \
		done	

install:
	if [ -n "$(DESTDIR)" ] ; then \
		DESTBIN=$(DESTDIR)/$(bindeb) ; \
		DESTMAN=$(DESTDIR)/$(mandeb) ; \
	else \
		DESTBIN=$(bindir) ; \
		DESTMAN=$(mandir) ; \
	fi ; \
	./install.sh install --quiet --bin-dir=$$DESTBIN --man-dir=$$DESTMAN

uninstall:
	if [ -n "$(DESTDIR)" ] ; then \
		DESTBIN=$(DESTDIR)/$(bindeb) ; \
		DESTMAN=$(DESTDIR)/$(mandeb) ; \
	else \
		DESTBIN=$(bindir) ; \
		DESTMAN=$(mandir) ; \
	fi ; \
	./install.sh uninstall --quiet --bin-dir=$$DESTBIN --man-dir=$$DESTMAN

clean:
	rm -f $(DIR_SRC)/$(PNAME).1 $(MAN_PAGES) $(VERSION) tar.stamp

tar: all tar.stamp

tar.stamp: NEWS
	touch tar.stamp ; \
	vers=`cat $(VERSION)` ; \
	ups=`test -f debian/changelog && \
		awk 'NR==3 {print $0}' debian/changelog | \
		grep -i 'new upstream' >/dev/null 2>&1 && echo 0` ; \
	exclude="--exclude=debian --exclude=*-stamp --exclude=*.stamp \
		--exclude=.*.swp" ; \
	GZIP=--best ; \
	export GZIP ; \
	cd .. && tar czpvf $(PNAME)-$$vers.tar.gz $(PNAME)-$$vers $$exclude ; \
	if [ $$ups ]; then \
	     cp -p $(PNAME)-$$vers.tar.gz $(PNAME)_$$vers.orig.tar.gz ; \
	fi

tar-full: all
	vers=`cat $(VERSION)` ; \
	dvers=`test -f debian/changelog && \
	       sed -n '1s/\(.*(\)\(.*\)\().*\)/\2/p' debian/changelog` ; \
	exclude="--exclude=.*.swp" ; \
	GZIP=--best ; \
	export GZIP ; \
	if [ $$dvers ]; then \
		cd .. && \
		tar czpvf $(PNAME)_$$dvers.full.tar.gz $(PNAME)-$$vers $$exclude ; \
	fi

debsrc: tar tar-full
	debuild -S

packages: tar tar-full
	@( debuild && debuild clean && \
	dvers=`test -f debian/changelog && \
	       sed -n '1s/\(.*(\)\(.*\)\().*\)/\2/p' debian/changelog` && \
	echo "" && \
	echo Trying to convert $(PNAME)_$${dvers}_all.deb to .rpm && \
	su -c "umask 022 && alien -k -r ../$(PNAME)_$${dvers}_all.deb" && \
	mv -f *.rpm .. )

sums:
	@vers=`cat $(VERSION)` ; \
	dvers=`sed -n '1s/\(.*(\)\(.*\)\().*\)/\2/p' debian/changelog` ; \
	cd .. && \
	sha1sum $(PNAME)-$$vers.tar.gz $(PNAME)-$$dvers.noarch.rpm \
		> $(PNAME)-$$vers.sha1

sig:
	@test ! -f debian/changelog && exit ; \
	vers=`cat $(VERSION)` ; \
	dvers=`sed -n '1s/\(.*(\)\(.*\)\().*\)/\2/p' debian/changelog` ; \
	cd .. \
	&& gpg --armor --detach-sig $(PNAME)_$$vers.orig.tar.gz \
	&& cp -fp $(PNAME)_$$vers.orig.tar.gz.asc $(PNAME)-$$vers.tar.gz.asc