summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 3e4e189fbebe129783ef75b3a0ad3f03761b8011 (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
#! /usr/bin/make -f
## debian/rules for ratpoison
## Copyright (C) 2001 Gergely Nagy <8@free.bsd.hu>

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
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 \
			--disable-debug
			--build=$(DEB_BUILD_GNU_TYPE) \
			--host=$(DEB_HOST_GNU_TYPE)
	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

# 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 src/ChangeLog $(DEBHELPER_OPTIONS)
	dh_installwm $(DEBHELPER_OPTIONS)
	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