]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/byacc/package/debian/rules
MFV: r362513
[FreeBSD/FreeBSD.git] / contrib / byacc / package / debian / rules
1 #!/usr/bin/make -f
2 # $Id: rules,v 1.3 2018/05/25 20:03:37 tom Exp $
3 #
4 # Uncomment this to turn on verbose mode.
5 #export DH_VERBOSE=1
6
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)
11
12 PACKAGES.arch  = byacc btyacc
13
14 CPPFLAGS        := $(shell dpkg-buildflags --get CPPFLAGS)
15 CFLAGS          := $(shell dpkg-buildflags --get CFLAGS)
16 LDFLAGS         := $(shell dpkg-buildflags --get LDFLAGS)
17
18 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
19         CFLAGS += -O0
20 else
21         CFLAGS += -O2
22 endif
23 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
24         INSTALL_PROGRAM += -s
25 endif
26
27 BYACC_DIR = $(CURDIR)/debian/byacc
28 BTYACC_DIR = $(CURDIR)/debian/btyacc
29
30 BYACC_TMP = t/byacc
31 BTYACC_TMP = t/btyacc
32
33 verbose = # -v
34
35 configure = \
36         CPPFLAGS="$(CPPFLAGS)" \
37         CFLAGS="$(CFLAGS)" \
38         LDFLAGS="$(LDFLAGS)" \
39         ../../configure \
40                 --host=$(DEB_HOST_GNU_TYPE) \
41                 --build=$(DEB_BUILD_GNU_TYPE) \
42                 --prefix=/usr \
43                 --mandir=\$${prefix}/share/man \
44                 --sysconfdir=/etc \
45                 --program-transform-name='s,^,b,'
46
47 all: build
48
49 config: config-arch
50 build: build-arch
51 install: install-arch
52 binary: binary-arch
53
54 config-arch:  $(PACKAGES.arch:%=config-%-stamp)
55 build-arch:   $(PACKAGES.arch:%=build-%-stamp)
56 install-arch: $(PACKAGES.arch:%=install-%-stamp)
57
58 config-byacc-stamp:
59         dh_testdir
60
61         rm -rf $(BYACC_TMP)
62         mkdir -p $(BYACC_TMP)
63         cd $(BYACC_TMP); $(configure)
64
65         touch $@
66
67 config-btyacc-stamp:
68         dh_testdir
69
70         rm -rf $(BTYACC_TMP)
71         mkdir -p $(BTYACC_TMP)
72         cd $(BTYACC_TMP); $(configure) \
73                 --enable-btyacc \
74                 --with-max-table-size=18000 \
75                 --program-transform-name='s,^,bt,'
76
77         touch $@
78
79 build-byacc-stamp: config-byacc-stamp
80         dh_testdir
81
82         cd $(BYACC_TMP); $(MAKE)
83
84         touch $@
85
86 build-btyacc-stamp: config-btyacc-stamp
87         dh_testdir
88
89         cd $(BTYACC_TMP); $(MAKE)
90
91         touch $@
92
93 install-byacc-stamp: build-byacc-stamp
94         dh_testdir
95         dh_testroot
96         dh_installdirs
97
98         cd $(BYACC_TMP); $(MAKE) install DESTDIR=$(BYACC_DIR)
99
100         touch $@
101
102 install-btyacc-stamp: build-btyacc-stamp
103         dh_testdir
104         dh_testroot
105         dh_installdirs
106
107         cd $(BTYACC_TMP); $(MAKE) install DESTDIR=$(BTYACC_DIR)
108
109         touch $@
110
111 clean:
112         dh_testdir
113         dh_testroot
114
115         dh_clean $(verbose)
116
117         rm -rf t
118
119 # Build architecture-dependent files here.
120 binary-arch: build install
121 ifneq ($(PACKAGES.arch),)
122         rm -f $(PACKAGES.arch:%=install-%-stamp)
123         dh_testdir
124         dh_testroot
125         dh_lintian           $(verbose) $(PACKAGES.arch:%=-p%)
126         dh_installdocs       $(verbose) $(PACKAGES.arch:%=-p%)
127         dh_installexamples   $(verbose) $(PACKAGES.arch:%=-p%)
128         dh_installchangelogs $(verbose) $(PACKAGES.arch:%=-p%) CHANGES
129         dh_strip             $(verbose) $(PACKAGES.arch:%=-p%)
130         dh_compress          $(verbose) $(PACKAGES.arch:%=-p%)
131         dh_fixperms          $(verbose) $(PACKAGES.arch:%=-p%)
132         dh_installdeb        $(verbose) $(PACKAGES.arch:%=-p%)
133         dh_shlibdeps         $(verbose) $(PACKAGES.arch:%=-p%)
134         dh_gencontrol        $(verbose) $(PACKAGES.arch:%=-p%)
135         dh_md5sums           $(verbose) $(PACKAGES.arch:%=-p%)
136         dh_builddeb          $(verbose) $(PACKAGES.arch:%=-p%)
137 endif
138
139 .PHONY: build clean config config-arch binary binary-arch install install-arch