File: rules

package info (click to toggle)
sformat 3.5-1.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 3,588 kB
  • ctags: 5,796
  • sloc: ansic: 32,949; sh: 2,138; makefile: 187; pascal: 42
file content (115 lines) | stat: -rwxr-xr-x 3,123 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
#!/usr/bin/make -f

SOURCEDIR := $(shell pwd)
TMPDIR=$(SOURCEDIR)/debian/tmp
MAKE := make MAKEPROG=gmake

# Rules that are created by the (patched) RULES/MKLINKS
# scripts and have to be removed afterwards.
EXTRA_ARCHS = arm ia64 parisc powerpc x86_64 s390
EXTRA_LINKS = r-build.c4x r-build.c4x-dep r-gmake.c4x r-gmake.c4x-dep

include RULES/mk-gmake.id

CFLAGS = -Wall -g

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif

links:
	-cd RULES; sh MKLINKS
	if [ ! -f "RULES/$(K_ARCH)-$(OSNAME)-cc.rul" ]; then \
		echo "No rule file for `uname -m`..."; \
		if [ $(OSNAME) = linux ]; then \
			echo "Os is linux, trying standard"; \
			(cd RULES; \
			ln -sf i586-linux-cc.rul $(K_ARCH)-$(OSNAME)-cc.rul;\
			ln -sf i586-linux-gcc.rul $(K_ARCH)-$(OSNAME)-hcc.rul;\
			);\
		else \
			echo "Not linux, giving up. (add a symlink in RULES)";\
			exit 1;\
		fi;\
	fi
#	Various other symlinks
#	ln -sf ../libscg/scg include/scg

build: links
	$(checkdir)
	$(MAKE) CFLAGS='$(CFLAGS)' all
	touch build

binary-indep:

binary-arch: checkroot build
	$(checkdir)
	-rm -rf $(TMPDIR)
	install -d $(TMPDIR)/DEBIAN $(TMPDIR)/etc $(TMPDIR)/usr/share/doc/sformat
	$(MAKE) INS_BASE=$(TMPDIR)/usr MANDIR=share/man DEFUMASK=022 install
#	fix ups
	mv $(TMPDIR)/usr/etc/sformat.dat $(TMPDIR)/etc
	chmod 644 $(TMPDIR)/etc/sformat.dat
	mv $(TMPDIR)/usr/bin/sformat $(TMPDIR)/usr/sbin/sformat
	rm -r $(TMPDIR)/usr/bin
	rm $(TMPDIR)/usr/sbin/rscsi
	rm -r $(TMPDIR)/usr/lib $(TMPDIR)/usr/share/man/man5 $(TMPDIR)/usr/etc
	rm -r $(TMPDIR)/usr/include
	chmod 644 $(TMPDIR)/usr/share/man/man8/sformat.8
	gzip -9 $(TMPDIR)/usr/share/man/man8/sformat.8
#	copyright etc
	install -m 644 README README.database README.seagate \
		doc/sformat.doc $(TMPDIR)/usr/share/doc/sformat
	install -m 644 debian/changelog \
		$(TMPDIR)/usr/share/doc/sformat/changelog.Debian
	gzip -9 $(TMPDIR)/usr/share/doc/sformat/*
	install -m 644 debian/copyright $(TMPDIR)/usr/share/doc/sformat
#	strip it
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	strip -s -R .comment -R .note $(TMPDIR)/usr/sbin/sformat
endif
#	maintaner
	install -m 644 debian/conffiles $(TMPDIR)/DEBIAN/conffiles
	chown -R root:root $(TMPDIR)
	dpkg-shlibdeps -psformat $(TMPDIR)/usr/sbin/sformat
	cd $(TMPDIR);  find * -type f \
		`sed -e 's@^/\?\(.*\)$$@\! -path \1@' \
		$(TMPDIR)/DEBIAN/conffiles`\
		! -regex '^DEBIAN/.*' -print0 | xargs -0 md5sum \
		> $(TMPDIR)/DEBIAN/md5sums
	dpkg-gencontrol -isp -psformat -P$(TMPDIR)
	dpkg --build $(TMPDIR) ..

clean: links
	$(MAKE) distclean
	-rm -rf $(TMPDIR)
	-rm -f debian/files debian/substvars build
	-rmdir libs
	# remove extra symlinks created by (patched) MKLINKS,
	for arch in $(EXTRA_ARCHS); do\
	  rm -f RULES/$$arch-linux-cc.rul;\
	  rm -f RULES/$$arch-linux-gcc.rul;\
	done
	for link in $(EXTRA_LINKS); do\
	  rm -f RULES/$$link;\
	done
	chmod -R ug-s .

define checkdir
	test -f debian/rules
	test -d sformat
endef

binary: binary-indep binary-arch

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

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

# Local Variables:
# mode:makefile
# end: