2 # $Id: rules,v 1.8 2022/01/08 19:53:07 tom Exp $
4 # Uncomment this to turn on verbose mode.
7 # These are used for cross-compiling and for saving the configure script
8 # from having to guess our platform (since we know it already)
9 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
10 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
12 PACKAGES.arch = byacc byacc2
14 QA_FIX = DEB_BUILD_MAINT_OPTIONS="hardening=+all qa=+bug reproducible=+all"
16 CPPFLAGS := $(shell $(QA_FIX) dpkg-buildflags --get CPPFLAGS)
17 CFLAGS := $(shell $(QA_FIX) dpkg-buildflags --get CFLAGS)
18 LDFLAGS := $(shell $(QA_FIX) dpkg-buildflags --get LDFLAGS)
20 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
25 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
29 BYACC_DIR = $(CURDIR)/debian/byacc
30 BTYACC_DIR = $(CURDIR)/debian/byacc2
38 CPPFLAGS="$(CPPFLAGS)" \
40 LDFLAGS="$(LDFLAGS)" \
42 --host=$(DEB_HOST_GNU_TYPE) \
43 --build=$(DEB_BUILD_GNU_TYPE) \
45 --mandir=\$${prefix}/share/man \
47 --enable-stdnoreturn \
48 --program-transform-name='s,^yacc,byacc,'
53 build: build-indep build-arch
55 binary: binary-indep binary-arch
57 config-arch: $(PACKAGES.arch:%=config-%-stamp)
58 build-arch: $(PACKAGES.arch:%=build-%-stamp)
59 install-arch: $(PACKAGES.arch:%=install-%-stamp)
68 cd $(BYACC_TMP); $(configure)
76 mkdir -p $(BTYACC_TMP)
77 cd $(BTYACC_TMP); $(configure) \
79 --with-max-table-size=123456 \
80 --program-transform-name='s,^yacc,byacc2,'
84 build-byacc-stamp: config-byacc-stamp
87 cd $(BYACC_TMP); $(MAKE)
91 build-byacc2-stamp: config-byacc2-stamp
94 cd $(BTYACC_TMP); $(MAKE)
98 install-byacc-stamp: build-byacc-stamp
103 cd $(BYACC_TMP); $(MAKE) install DESTDIR=$(BYACC_DIR)
104 sed -i '/- an LALR/s,^..N,byacc,' $(BYACC_DIR)/usr/share/man/man1/byacc.1
108 install-byacc2-stamp: build-byacc2-stamp
113 cd $(BTYACC_TMP); $(MAKE) install DESTDIR=$(BTYACC_DIR)
114 sed -i '/- an LALR/s,^..N,byacc2,' $(BTYACC_DIR)/usr/share/man/man1/byacc2.1
126 # Build architecture-independent files here.
127 binary-indep: build install
130 dh_lintian $(verbose) $(PACKAGES.arch:%=-p%)
131 dh_installdocs $(verbose) $(PACKAGES.arch:%=-p%)
132 dh_installexamples $(verbose) $(PACKAGES.arch:%=-p%)
133 dh_installchangelogs $(verbose) $(PACKAGES.arch:%=-p%) CHANGES
135 # Build architecture-dependent files here.
136 binary-arch: build install
137 ifneq ($(PACKAGES.arch),)
138 rm -f $(PACKAGES.arch:%=install-%-stamp)
141 dh_lintian $(verbose) $(PACKAGES.arch:%=-p%)
142 dh_strip $(verbose) $(PACKAGES.arch:%=-p%)
143 dh_compress $(verbose) $(PACKAGES.arch:%=-p%)
144 dh_fixperms $(verbose) $(PACKAGES.arch:%=-p%)
145 dh_installdeb $(verbose) $(PACKAGES.arch:%=-p%)
146 dh_shlibdeps $(verbose) $(PACKAGES.arch:%=-p%)
147 dh_gencontrol $(verbose) $(PACKAGES.arch:%=-p%)
148 dh_md5sums $(verbose) $(PACKAGES.arch:%=-p%)
149 dh_builddeb $(verbose) $(PACKAGES.arch:%=-p%)
152 .PHONY: build clean config config-arch binary binary-indep binary-arch install install-arch