File: rules

package info (click to toggle)
nn 6.5.1-4
  • links: PTS
  • area: main
  • in suites: slink
  • size: 2,472 kB
  • ctags: 4,518
  • sloc: ansic: 35,126; sh: 1,489; makefile: 214; awk: 138
file content (138 lines) | stat: -rwxr-xr-x 4,794 bytes parent folder | download | duplicates (2)
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
138
#! /usr/bin/make -f

#   Copyright 1994-98   joey@infodrom.north.de (Martin Schulze)
#
#   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; version 2 dated June, 1991.
#
#   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
SHELL=/bin/bash

# The name and version of the source
#
source = $(shell grep "^Source: " debian/control|head -1|sed 's/Source: \(.*\)/\1/g')
package = $(shell grep "^Package: " debian/control|head -1|sed 's/Package: \(.*\)/\1/g')
version = $(shell grep "^$(source) " debian/changelog|head -1 |sed 's/.*(\(.*\)\-[^\-]*).*/\1/g')
revision = $(shell grep "^$(source) " debian/changelog|head -1 |sed 's/.*([^\-]*\-\(.*\)).*/\1/g')

installbin = install -g root -o root -m 755
installdoc = install -g root -o root -m 644

CFLAGS=-g
LDFLAGS=-lncurses
CPP=gcc -E

build:
	-rm -f update.h
	test -f local_curses.h || sed < /usr/include/curses.h > local_curses.h \
		-e '/^#include <stdarg.h>/d' \
		-e '/^extern int standout/d'
	cp -f debian/term.h .
	cp -f debian/config.h .
	@echo '# the two following MF.c warnings seem benign'
	test -f ymakefile || $(MAKE) CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' CPP='$(CPP)' ymakefile
	$(MAKE) client
	grep "^#" config.h \
		| sed -e '/_MAN_/d' -e 's/[ 	]*\/\*.*$$//' > nnconf
	sed 	-e 's/\\f[BPI]//g' \
		-e 's/\\-/-/g' -e 's/\\&//g' -e 's/\\e/\\/g' \
		-e '/^\.\\"ta/p' -e '/^\.\\"/d' \
		-e '/^\.nf/d' -e '/^\.fi/d' \
		-e '/^\.if/d' -e '/^\.ta/d' -e '/^\.nr/d' \
		-e '/^\.in/d' -e 's/^\.[BI] //' \
		man/nn{,check,grep,post,tidy}.1 | \
		gawk -f format.awk - > Manual
	touch stamp-build

clean: debclean
	rm -f stamp-build
	-$(MAKE) clean
	rm -f config.h local_curses.h term.h Manual log update.h
	rm -rf nnconf *~

debclean:
# Cleans debian binary directories to allow binary creation
	rm -rf debian/tmp
	rm -f debian/{files,substvars}

binary-indep:
# Nothing to be done here

binary-arch: debclean
	test -f stamp-build || $(MAKE) -f debian/rules build
	$(installbin) -d debian/tmp/DEBIAN
	chown -R root.root debian/tmp
	chmod -R g-ws debian/tmp
	$(installbin) debian/{postinst,postrm} debian/tmp/DEBIAN/
	#
	$(installbin) -d debian/tmp/usr/doc/$(package)
	$(installdoc) debian/changelog debian/tmp/usr/doc/$(package)/changelog.Debian
	$(installdoc) debian/copyright debian/tmp/usr/doc/$(package)/
	$(installdoc) debian/README.debian debian/tmp/usr/doc/$(package)/
	$(installdoc) ChangeLog debian/tmp/usr/doc/$(package)/changelog
	$(installdoc) olddocs/README debian/tmp/usr/doc/$(package)/
	gzip -9f debian/tmp/usr/doc/$(package)/{changelog.Debian,README{,.debian},changelog}
	$(installdoc) init.sample debian/tmp/usr/doc/$(package)/
	#
	$(installbin) -d debian/tmp/usr/bin
	$(installbin) -s nn debian/tmp/usr/bin
	cd debian/tmp/usr/bin && \
	for p in nncheck nntidy nngrep nnpost nnview; do \
		ln -s nn $$p; done
	#
	$(installbin) -d debian/tmp/usr/lib/$(package)/help
	$(installbin) aux upgrade_rc debian/tmp/usr/lib/$(package)
	$(installdoc) nnconf debian/tmp/usr/lib/$(package)/conf
	#
	for h in `cd help; echo *`; do \
		./cvt-help < help/$$h > help.txt; \
		$(installdoc) help.txt debian/tmp/usr/lib/$(package)/help/$$h; \
	done
	rm -f help.txt
	$(installdoc) Manual debian/tmp/usr/lib/$(package)/help
	#
	$(installbin) -d debian/tmp/usr/lib/menu
	$(installdoc) debian/menu debian/tmp/usr/lib/menu/nn
	#
	$(installbin) -d debian/tmp/usr/man/man{1,8}
	$(installdoc) man/*.1 man/*.1m debian/tmp/usr/man/man1
	$(installdoc) man/*.8 debian/tmp/usr/man/man8
	gzip -9 debian/tmp/usr/man/man?/*
	#
	dpkg-shlibdeps debian/tmp/usr/bin/nn
	dpkg-gencontrol
	dpkg --build debian/tmp ..

binary: binary-indep binary-arch

source diff:
	@echo >&2 'source and diff are obsolete - use dpkg-source -b' or dsc; false

dsc:
	-test -d debian/tmp && $(MAKE) -f debian/rules clean
	if [ ! -f ../$(source)_$(version).orig.tar.gz -a -f ../orig/$(source)_$(version).orig.tar.gz ]; \
	then \
	  ln -s orig/$(source)_$(version).orig.tar.gz ../$(source)_$(version).orig.tar.gz; \
	  touch /tmp/stamp-$(source)-link; \
	fi; \
	cd .. && dpkg-source -b $(source)-$(version)
	if [ -f /tmp/stamp-$(source)-link ]; then \
	  rm ../$(source)_$(version).orig.tar.gz /tmp/stamp-$(source)-link; \
	fi

checkroot:
	$(checkdir)
	test root = "`whoami`"

dist: binary dsc

.PHONY: binary binary-arch binary-indep clean checkroot