summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 753a7d363b66a803242c53d28b0ea598c696260e (plain)
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
#! /usr/bin/make -f
## debian/rules for ratpoison
## Copyright (C) 2001 Gergely Nagy <algernon@debian.org>
##
## Released under the GNU GPL v2
##
## $Id: rules,v 1.7 2001/05/03 15:03:57 algernon Exp $

export DH_COMPAT  = 2
DEBHELPER_OPTIONS = -p$@ -Pdebian/$(DEB_HOST_ARCH)/$@
PWD		 := $(CURDIR)

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

CFLAGS		    = -O2

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
	CFLAGS		+= -g
	CONFIG_FLAGS	+= --enable-debug
else
	CONFIG_FLAGS	+= --disable-debug
endif

# bootstrap - for building from CVS snapshots
bootstrap: build-deb/$(DEB_HOST_ARCH)/bootstrap-stamp
build-deb/$(DEB_HOST_ARCH)/bootstrap-stamp:
	test -f configure || ./autogen.sh
	install -d build-deb/$(DEB_HOST_ARCH)
	touch $@

# config - run configure
config: bootstrap build-deb/$(DEB_HOST_ARCH)/config-stamp
build-deb/$(DEB_HOST_ARCH)/config-stamp:
	dh_testdir
	cd build-deb/$(DEB_HOST_ARCH) && \
	CFLAGS="$(CFLAGS)" ../../configure \
			--prefix=/usr \
			--infodir=/usr/share/info \
			--mandir=/usr/share/man \
			--with-xterm=x-terminal-emulator \
			--build=$(DEB_BUILD_GNU_TYPE) \
			--host=$(DEB_HOST_GNU_TYPE) \
			$(CONFIG_FLAGS)
	touch $@

# build - build the package
build: config build-deb/$(DEB_HOST_ARCH)/build-stamp
build-deb/$(DEB_HOST_ARCH)/build-stamp:
	dh_testdir
	$(MAKE) -C build-deb/$(DEB_HOST_ARCH) all
	touch $@

# clean - remove build directories
clean:
	dh_testdir
	dh_testroot
	-$(MAKE) -C build-deb/$(DEB_HOST_ARCH) distclean
	rm -Rf build-deb/$(DEB_HOST_ARCH)
	@for m in $(shell dh_listpackages); do \
		echo "dh_clean -p$$m -Pdebian/$(DEB_HOST_ARCH)/$$m" ;\
		dh_clean -p$$m -Pdebian/$(DEB_HOST_ARCH)/$$m ;\
	done
	rm -Rf debian/$(DEB_HOST_ARCH)

# install - install the package to debian/<ARCH>/ratpoison
install: build
	dh_testdir
	dh_testroot
	@for m in $(shell dh_listpackages); do \
		echo "dh_clean -k -Pdebian/$(DEB_HOST_ARCH)/$$m -p$$m" ;\
		dh_clean -k -Pdebian/$(DEB_HOST_ARCH)/$$m -p$$m ;\
		echo "dh_installdirs -Pdebian/$(DEB_HOST_ARCH)/$$m -p$$m" ;\
		dh_installdirs -Pdebian/$(DEB_HOST_ARCH)/$$m -p$$m ;\
	done
	$(MAKE) -C build-deb/$(DEB_HOST_ARCH) \
		install DESTDIR=$(PWD)/debian/$(DEB_HOST_ARCH)/ratpoison
	rm -f $(PWD)/debian/$(DEB_HOST_ARCH)/ratpoison/usr/share/doc/ratpoison/COPYING
	rm -f $(PWD)/debian/$(DEB_HOST_ARCH)/ratpoison/usr/share/doc/ratpoison/ChangeLog

# these build the various packages
ratpoison: install
	dh_testdir
	dh_testroot
	dh_installdocs $(DEBHELPER_OPTIONS)
	dh_installexamples $(DEBHELPER_OPTIONS)
	dh_installmenu $(DEBHELPER_OPTIONS)
#	dh_installlogrotate $(DEBHELPER_OPTIONS)
#	dh_installemacsen $(DEBHELPER_OPTIONS)
#	dh_installpam $(DEBHELPER_OPTIONS)
#	dh_installinit $(DEBHELPER_OPTIONS)
#	dh_installcron $(DEBHELPER_OPTIONS)
	dh_installmanpages $(DEBHELPER_OPTIONS)
	dh_installinfo $(DEBHELPER_OPTIONS)
#	dh_undocumented $(DEBHELPER_OPTIONS)
	dh_installchangelogs ChangeLog $(DEBHELPER_OPTIONS)
	dh_installwm $(DEBHELPER_OPTIONS) /usr/bin/ratpoison
	dh_link $(DEBHELPER_OPTIONS)
	dh_strip $(DEBHELPER_OPTIONS)
	dh_compress $(DEBHELPER_OPTIONS)
	dh_fixperms $(DEBHELPER_OPTIONS)
#	dh_makeshlibs $(DEBHELPER_OPTIONS)
	dh_installdeb $(DEBHELPER_OPTIONS)
#	dh_perl $(DEBHELPER_OPTIONS)
	dh_shlibdeps $(DEBHELPER_OPTIONS)
	dh_gencontrol $(DEBHELPER_OPTIONS)
	dh_md5sums $(DEBHELPER_OPTIONS)
	dh_builddeb $(DEBHELPER_OPTIONS)

# binary-arch, binary-indep, binary - targets required by DP
binary-arch: ratpoison
binary-indep:
binary: binary-indep binary-arch

# rebuild - rebuild from (almost) pristine sources
rebuild: clean binary

.PHONY: build clean binary-indep binary-arch binary install rebuild \
	bootstrap config ratpoison