File: rules

package info (click to toggle)
supercat 0.5.5-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, squeeze, wheezy
  • size: 572 kB
  • ctags: 107
  • sloc: sh: 985; ansic: 778; makefile: 95
file content (111 lines) | stat: -rwxr-xr-x 3,373 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
#!/usr/bin/make -f
# -*- makefile -*-

DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

# Package name
PACKAGE_NAME = supercat

# Install program
INSTALL = install

INSTALL_FILE    = $(INSTALL) -p    -o root -g root  -m  644
INSTALL_PROGRAM = $(INSTALL) -p    -o root -g root  -m  755
INSTALL_SCRIPT  = $(INSTALL) -p    -o root -g root  -m  755
INSTALL_DIR     = $(INSTALL) -p -d -o root -g root  -m  755


# The installation directory
PACKAGE_DIR = debian/$(PACKAGE_NAME)

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

ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
else
CROSS= --build $(DEB_BUILD_GNU_TYPE)
endif

ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
INSTALL_PROGRAM += -s
endif

config.status: configure
	$(checkdir)
ifneq "$(wildcard /usr/share/misc/config.sub)" ""
	cp -f /usr/share/misc/config.sub config.sub
endif
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
	cp -f /usr/share/misc/config.guess config.guess
endif
	./configure $(CROSS) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs"


build: build-stamp

build-stamp: config.status
	$(checkdir)
	$(MAKE)
	touch $@

clean: checkroot
	$(checkdir)
	rm -f build-stamp
	[ ! -f Makefile ] || $(MAKE) distclean
	rm -f config.sub config.guess
	rm -rf $(PACKAGE_DIR) debian/files debian/substvars

install: checkroot build
	$(checkdir)
	$(MAKE) DESTDIR=$(CURDIR)/$(PACKAGE_DIR) install

# Build architecture-independent files here.
binary-indep: checkroot build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: checkroot build install
	$(checkdir)
	$(INSTALL_DIR) $(PACKAGE_DIR)/usr/share/doc/$(PACKAGE_NAME)/
	for i in doc/spc.txt debian/README.Debian;do \
		$(INSTALL_FILE) -m 644 $$i $(PACKAGE_DIR)/usr/share/doc/$(PACKAGE_NAME)/; \
	done;
	$(INSTALL_FILE) -m 644 ChangeLog $(PACKAGE_DIR)/usr/share/doc/$(PACKAGE_NAME)/changelog
	$(INSTALL_FILE) -m 644 debian/changelog $(PACKAGE_DIR)/usr/share/doc/$(PACKAGE_NAME)/changelog.Debian
	for i in $(PACKAGE_DIR)/usr/share/doc/$(PACKAGE_NAME)/changelog*;do \
		gzip -9v $$i; \
	done;
	$(INSTALL_FILE) -m 644 debian/copyright $(PACKAGE_DIR)/usr/share/doc/$(PACKAGE_NAME)/copyright
	$(INSTALL_DIR) $(PACKAGE_DIR)/etc/$(PACKAGE_NAME)
	$(INSTALL_DIR) $(PACKAGE_DIR)/usr/share/man/man1
	$(INSTALL_FILE) -m 644 doc/spc.1 $(PACKAGE_DIR)/usr/share/man/man1
	gzip -9v $(PACKAGE_DIR)/usr/share/man/*/*
# Strip binaries (including hack by policy wonks)
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	strip -R.note -R.comment $(PACKAGE_DIR)/usr/bin/*
endif
	dpkg-shlibdeps $(PACKAGE_DIR)/usr/bin/spc
	$(INSTALL_DIR) $(PACKAGE_DIR)/DEBIAN
	cd $(PACKAGE_DIR) && ls etc/$(PACKAGE_NAME)/*|sed 's|^|/|' > DEBIAN/conffiles
	cd $(PACKAGE_DIR) && find * -type f ! -regex '^DEBIAN/.*' -print0 | xargs -r0 md5sum > DEBIAN/md5sums
	dpkg-gencontrol -p$(PACKAGE_NAME) -P$(PACKAGE_DIR)
	dpkg-deb --build $(PACKAGE_DIR) ..

binary: binary-indep binary-arch

define checkdir
	test -f src/spc.h && test -f debian/rules
endef

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


.PHONY: build clean binary-indep binary-arch binary install