File: rules

package info (click to toggle)
gambc 4.2.8-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 54,404 kB
  • ctags: 10,660
  • sloc: ansic: 661,388; lisp: 143,554; sh: 3,531; makefile: 3,312; cpp: 2,143; perl: 1,730; sed: 498; java: 265
file content (153 lines) | stat: -rwxr-xr-x 4,566 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
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

.NOTPARALLEL:

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
  CROSS = --build $(DEB_HOST_GNU_TYPE)
else
  CROSS = --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
endif

config.status:
	@echo "**** Configuring source..."
	cp -a /usr/share/misc/config.sub .
	cp -a /usr/share/misc/config.guess .
	autoconf
	# running the new configure:
	LDFLAGS="$(LDFLAGS) -Wl,-z,defs " \
	CFLAGS="$(CFLAGS)" \
		./configure \
		$(CROSS) \
		--prefix=/usr \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--enable-shared \
		--enable-single-host

build-arch: build
build-indep: build
build: patch-stamp build-stamp
build-stamp:  config.status
	@echo "**** Build bootstrap Gambit compiler from *.c as gsc-comp..."
	# don't rebuild these:
	touch doc/gambit-c.pdf
	touch doc/gambit-c.html
	$(MAKE) bootstrap PACKAGE_SUBDIR=""
	@echo "**** Modify .scm source and rebuild system..."
	dpatch apply -v 99_move_base_link_file
	$(MAKE) PACKAGE_SUBDIR=""
	touch build-stamp

clean: clean-patched
clean-patched: patch-stamp
	@echo "**** Cleaning tree..."
	rm -f build-stamp
	# distclean everything except gsi/ gsc/ lib/ which contain generated
	# C files needed to build the Scheme compiler.  'mostlyclean' those
	# dirs and delete the makefiles manually (config.status is gone)
	@for dir in gsi gsc lib ; do \
		echo "* mostlyclean $$dir" ; \
		[ ! -f $$dir/makefile ] || (cd $$dir && $(MAKE) mostlyclean) ; \
		echo "* saving  $$dir" ; \
		rm -rf $$dir.copy ; \
		cp -a $$dir $$dir.copy ; \
	done
	[ ! -f makefile ] || $(MAKE) distclean
	@for dir in gsi gsc lib ; do \
		echo "* restore $$dir; remove makefile and links" ; \
		rm -rf $$dir ; \
		mv $$dir.copy $$dir ; \
		[ ! -f $$dir/makefile ] || \
			(cd $$dir && rm -f makefile libgambc*) ; \
	done
	# further cleaning approaching distribution configuration
	rm -rf gsi/gsi gsc/gsc gsc-comp
	rm -rf doc/gambit-c.info*
	dh_clean
	debian/rules unpatch
	rm -f config.guess config.sub configure
	# restore original gsc directory prior to repeating build
	@if [ -d gsc.hold ]; then \
		rm -rf gsc ; \
		echo "**** Restoring upstream gsc directory..." ; \
		cp -a gsc.hold/ gsc/ ; \
		rm -rf gsc.hold/ ; \
	fi

install: build
	@echo "**** Installing into debian/tmp..."
	dh_prep
	dh_installdirs
	# Add here commands to install the package into debian/tmp
	$(MAKE) install prefix=$(CURDIR)/debian/tmp/usr \
                        PACKAGE_SUBDIR=""
	# scheme-r5rs will be handled by upgrade-alternatives
	rm debian/tmp/usr/bin/scheme-r5rs

# Build architecture-independent files here.
binary-indep: build install
	@echo "**** Building arch-independent debs..."
	dh_installchangelogs -i
	dh_installdocs -i
	dh_installemacsen -i
	dh_installexamples -i --exclude=makefile
	dh_installinfo -i
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

# Build architecture-dependent files here.
binary-arch: build install
	@echo "**** Building arch-dependent debs..."
	dh_installchangelogs -a
	dh_installdocs -a
	dh_install -a --sourcedir=debian/tmp/usr
	dh_installman -a debian/gsi.1
	dh_link -a
	dh_strip -a
	dh_compress -a
	dh_fixperms -a
	dh_makeshlibs -a
	dh_installdeb -a
	dh_shlibdeps -a -L libgambc4 -l debian/libgambc4/usr/lib
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

patch: patch-stamp
patch-stamp:
	@echo "**** Save a copy of the original gsc/..."
	rm -rf gsc.hold/
	cp -a gsc/ gsc.hold/
	@echo "**** Patching source..."
	dpatch apply 01_texinfo
	dpatch apply 02_gambit.el
	dpatch apply 100_pass_soname_when_linking
	# (Note: 99_move_base_link_file is applied after bootstrap)
	touch patch-stamp

unpatch:
	@echo "**** Unpatching source..."
	-dpatch deapply-all
	rm -rf patch-stamp debian/patched

binary: binary-indep binary-arch

.PHONY: build build-arch build-indep clean binary-indep binary-arch binary install \
        clean-patched patch unpatch