File: Makefile

package info (click to toggle)
num-utils 0.5-15
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 984 kB
  • sloc: perl: 1,266; sh: 113; makefile: 94
file content (137 lines) | stat: -rw-r--r-- 4,094 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
131
132
133
134
135
136
137
# $Id: Makefile,v 1.12 2003/09/23 22:26:12 suso Exp $
# num-utils         A set of programs for doing operations on numbers
# Copyright (C) 2002-2003 Suso Banderas

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
# You may contact the author at <suso@suso.org>.

VERSION	= $(shell cat VERSION)
PROJECT	= num-utils
DIST	= $(PROJECT)-$(VERSION)
FILES	= $(shell cat MANIFEST)
UTILS	= average bound interval normalize numgrep numprocess numsum random range round
DOCS	= template README GOALS WARNING
TESTS	= file fractionalnums numbers numbers2 README zeros
# rpm --showrc is gettin to be hard to parse anymore.
#RPMDIR	= /usr/src/redhat  
#RPMDIR	= $(shell rpm --showrc | grep " _topdir" | \
#	perl -n -e \
#	'/_topdir(?:\s+|\s+:\s+)(\/.*|%{_usrsrc}.*$$)/; \
#	$$dir = $$1; $$dir =~ s|%{_usrsrc}|/usr/src|; print "$$1\n";')

# Modify these as necessary
PERL	= /usr/bin/perl
BINDIR	= /usr/bin
TOPDIR	= $(ROOT)/usr
MANDIR	= $(TOPDIR)/share/man/man1
DOCDIR	= $(TOPDIR)/share/doc/$(PROJECT)
BINDIR	= $(TOPDIR)/bin
TARFILE	= $(DIST).tar.gz
RPMFILE	= $(RPMDIR)
SPECFILE= $(PROJECT).spec
RPMFILE	= $(RPMDIR)/RPMS/noarch/$(DIST)-1.noarch.rpm
SRPMFILE= $(RPMDIR)/SRPMS/$(DIST)-1.src.rpm


all: manpages
	for file in $(UTILS) ; do \
		cat $$file | sed 's|^#!/usr/bin/perl|#!$(PERL)|' > $$file.out ; \
		mv $$file.out $$file ; chmod a+x $$file ; done

install:
	install -m 0755 -o 0 -g 0 -d		$(DESTDIR)/$(BINDIR)
	for util in $(UTILS) ; do \
	    install -m 0755 -o 0 -g 0 $$util	$(DESTDIR)/$(BINDIR) ; done

	install -m 0755 -o 0 -g 0 -d		$(DESTDIR)/$(DOCDIR)
	for doc in $(DOCS) ; do \
	    install -m 0644 -o 0 -g 0 $$doc	$(DESTDIR)/$(DOCDIR) ; done

	install -m 0755 -o 0 -g 0 -d		$(DESTDIR)/$(MANDIR)
	for man in $(UTILS) ; do \
		install -m 0644 -o 0 -g 0 $$man.1.gz $(DESTDIR)/$(MANDIR) ; done

uninstall:
	for util in $(UTILS) ; do \
		rm -f $(DESTDIR)/$(BINDIR)/$$util ; done
	rmdir $(DESTDIR)/$(BINDIR)

	for doc in $(DOCS) ; do \
		rm -f $(DESTDIR)/$(DOCDIR)/$$doc ; done
	rmdir $(DESTDIR)/$(DOCDIR)

	for man in $(UTILS) ; do \
		rm -f $(DESTDIR)/$(MANDIR)/$$man.1.gz ; done
	rmdir $(DESTDIR)/$(MANDIR)

manpages:
	for doc in $(UTILS) ; do \
		pod2man $$doc > $$doc.1 ; \
		gzip -9 $$doc.1 ; chmod 644 $$doc.1.gz \
		; done

rpminstall:
	install -m 0755 -d		$(BINDIR)
	for util in $(UTILS) ; do \
	    install -m 0755 $$util	$(BINDIR) ; done

	install -m 0755 -d		$(DOCDIR)
	for doc in $(DOCS) ; do \
	    install -m 0644 $$doc	$(DOCDIR) ; done

	install -m 0755 -d		$(MANDIR)
	for man in $(UTILS) ; do \
		install -m 0644 $$man.1.gz $(MANDIR) ; done

clean:
	rm -f $(PROJECT).spec
	rm -f $(TARFILE)
	for file in $(UTILS) ; do \
	    rm -f $$file.1 ; done
	for file in $(UTILS) ; do \
		cat $$file | sed 's|^#!$(PERL)|#!/usr/bin/perl|' > $$file.out ; \
		mv $$file.out $$file ; chmod a+x $$file ; done

dist: $(TARFILE)


test:
	for file in $(UTILS) ; do $(PERL) -Tcw $$file ; done

$(TARFILE): $(FILES)
	rm -fr $(DIST)
	rm -f $(TARFILE)
	mkdir $(DIST)
	perl -pe 'chomp; symlink "../$$_", "$(DIST)/$$_" or die $$!' MANIFEST
	tar zchf $(DIST).tar.gz $(DIST) --exclude CVS
	rm -r $(DIST)

rpm: $(RPMFILE) $(SRPMFILE)

$(RPMFILE): do-rpm

$(SRPMFILE): do-rpm

do-rpm: $(TARFILE) $(SPECFILE)
	cp $(SPECFILE) $(RPMDIR)/SPECS/
	cp $(TARFILE) $(RPMDIR)/SOURCES/
	rpmbuild -ba $(RPMDIR)/SPECS/$(SPECFILE)

$(SPECFILE): $(SPECFILE).in VERSION
	perl -pe 's[\@(\S+)\@] \
		[open F, $$1 or die; $$x = join "", <F>; chomp $$x; $$x]ge' \
			< $< > $@