File: makefile.mk.in

package info (click to toggle)
cdbs 0.4.130
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 1,348 kB
  • sloc: sh: 4,534; xml: 2,159; makefile: 178; perl: 138; python: 94; ansic: 7; java: 5
file content (75 lines) | stat: -rw-r--r-- 4,429 bytes parent folder | download | duplicates (2)
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
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2002,2003 Colin Walters <walters@debian.org>
# Copyright © 2003,2010 Jonas Smedegaard <dr@jones.dk>
# Description: Builds and cleans packages which have a Makefile
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

#PATH_RULES#

ifndef _cdbs_class_makefile
_cdbs_class_makefile = 1

include $(_cdbs_rules_path)/buildcore.mk$(_cdbs_makefile_suffix)
include $(_cdbs_class_path)/makefile-vars.mk$(_cdbs_makefile_suffix)

cdbs_make_flavors = $(sort $(DEB_MAKE_FLAVORS))
cdbs_make_builddir_check = $(if $(call cdbs_streq,$(DEB_BUILDDIR),$(DEB_SRCDIR)),$(error DEB_MAKE_FLAVORS in use: DEB_BUILDDIR must be different from DEB_SRCDIR, and needs to be declared before including makefile.mk))
cdbs_make_build_stamps = $(if $(cdbs_make_flavors),$(cdbs_make_builddir_check)$(patsubst %,debian/stamp-makefile-build/%,$(cdbs_make_flavors)),debian/stamp-makefile-build)
cdbs_make_install_stamps = $(if $(cdbs_make_flavors),$(cdbs_make_builddir_check)$(patsubst %,debian/stamp-makefile-install/%,$(cdbs_make_flavors)),debian/stamp-makefile-install)
cdbs_make_check_stamps = $(if $(cdbs_make_flavors),$(cdbs_make_builddir_check)$(patsubst %,debian/stamp-makefile-check/%,$(cdbs_make_flavors)),debian/stamp-makefile-check)
cdbs_make_clean_nonstamps = $(if $(cdbs_make_flavors),$(patsubst %,makefile-clean/%,$(cdbs_make_flavors)),makefile-clean)
cdbs_make_curflavor = $(filter-out %/,$(subst /,/ ,$@))
cdbs_make_curbuilddir = $(if $(cdbs_make_flavors),$(subst @FLAVOR@,$(cdbs_make_curflavor),$(or $(DEB_MAKE_BUILDDIRSKEL_$(cdbs_make_curflavor)),$(DEB_MAKE_BUILDDIRSKEL))),$(cdbs_curbuilddir))
cdbs_make_curdestdir = $(if $(cdbs_make_flavors),$(subst @FLAVOR@,$(cdbs_make_curflavor),$(or $(DEB_MAKE_DESTDIRSKEL_$(cdbs_make_curflavor)),$(DEB_MAKE_DESTDIRSKEL))),$(cdbs_curdestdir))

DEB_PHONY_RULES += makefile-clean $(cdbs_make_clean_nonstamps)

pre-build::
	$(if $(cdbs_make_flavors),mkdir -p debian/stamp-makefile-build debian/stamp-makefile-install)
	$(and $(cdbs_make_flavors),$(DEB_MAKE_CHECK_TARGET),mkdir -p debian/stamp-makefile-check)

common-build-arch common-build-indep:: $(cdbs_make_build_stamps)
$(cdbs_make_build_stamps):
	+$(DEB_MAKE_INVOKE) $(DEB_MAKE_BUILD_TARGET)
	touch $@

cleanbuilddir:: makefile-clean
makefile-clean:: $(if $(cdbs_make_flavors),$(cdbs_make_clean_nonstamps))
	$(if $(cdbs_make_flavors),-rmdir --ignore-fail-on-non-empty debian/stamp-makefile-build debian/stamp-makefile-install,rm -f debian/stamp-makefile-build debian/stamp-makefile-install)

$(cdbs_make_clean_nonstamps)::
	$(if $(DEB_MAKE_CLEAN_TARGET),+-$(DEB_MAKE_INVOKE) -k $(DEB_MAKE_CLEAN_TARGET),@echo "DEB_MAKE_CLEAN_TARGET unset, not running clean")
	$(if $(cdbs_make_flavors),rm -f $(@:makefile-clean%=debian/stamp-makefile-build%) $(@:makefile-clean%=debian/stamp-makefile-install%))

common-install-arch common-install-indep:: common-install-impl
common-install-impl:: $(cdbs_make_install_stamps)
$(cdbs_make_install_stamps)::
	$(if $(DEB_MAKE_INSTALL_TARGET),+$(DEB_MAKE_INVOKE) $(DEB_MAKE_INSTALL_TARGET),@echo "DEB_MAKE_INSTALL_TARGET unset, skipping default makefile.mk common-install target")
	$(if $(DEB_MAKE_INSTALL_TARGET),touch $@)

ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
common-build-arch common-build-indep:: $(cdbs_make_check_stamps)
$(cdbs_make_check_stamps) : debian/stamp-makefile-check% : debian/stamp-makefile-build%
	$(if $(DEB_MAKE_CHECK_TARGET),+$(DEB_MAKE_INVOKE) $(DEB_MAKE_CHECK_TARGET),@echo "DEB_MAKE_CHECK_TARGET unset, not running checks")
	$(if $(DEB_MAKE_CHECK_TARGET),touch $@)

makefile-clean::
	$(if $(DEB_MAKE_CHECK_TARGET),$(if $(cdbs_make_flavors),-rmdir --ignore-fail-on-non-empty debian/stamp-makefile-check,rm -f debian/stamp-makefile-check))

$(cdbs_make_clean_nonstamps)::
	$(if $(cdbs_make_flavors),rm -f $(@:makefile-clean%=debian/stamp-makefile-check%))
endif

endif