-
Notifications
You must be signed in to change notification settings - Fork 4
/
transform-files.mk
57 lines (46 loc) · 2.33 KB
/
transform-files.mk
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
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2008 Tim Abbott <[email protected]> and
# Anders Kaseorg <[email protected]>
#
# 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, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# 02111-1307 USA.
# Don't include transform-files.mk in your rules files directly;
# instead use config-package.mk.
ifndef _cdbs_rules_transform_files
_cdbs_rules_transform_files = 1
include /usr/share/cdbs/1/rules/check-files.mk
DEB_TRANSFORM_FILES = $(foreach package,$(DEB_ALL_PACKAGES),$(DEB_TRANSFORM_FILES_$(package)))
DEB_TRANSFORM_FILES_TMPDIR=debian/transform_file_copies
debian_transform_files = $(patsubst %,$(DEB_TRANSFORM_FILES_TMPDIR)%,$(1))
undebian_transform_files = $(patsubst $(DEB_TRANSFORM_FILES_TMPDIR)%,%,$(1))
debian_transform_script = $(if $(DEB_TRANSFORM_SCRIPT_$(cdbs_curpkg)_$(call undebian_transform_files,$(1))), \
$(DEB_TRANSFORM_SCRIPT_$(cdbs_curpkg)_$(call undebian_transform_files,$(1))), \
$(if $(DEB_TRANSFORM_SCRIPT_$(call undebian_transform_files,$(1))), \
$(DEB_TRANSFORM_SCRIPT_$(call undebian_transform_files,$(1))), \
debian/transform_$(notdir $(call undebian_transform_files,$(1)))))
common-build-arch common-build-indep:: $(foreach file,$(DEB_TRANSFORM_FILES),$(call debian_transform_files,$(file)))
$(call debian_transform_files,%): $(call debian_check_files,%)
mkdir -p $(@D)
chmod +x $(call debian_transform_script,$@)
$(call debian_transform_script,$@) < $< > $@
$(patsubst %,binary-install/%,$(DEB_ALL_PACKAGES)) :: binary-install/%:
set -e; \
$(foreach file,$(DEB_TRANSFORM_FILES_$(cdbs_curpkg)), \
install -d debian/$(cdbs_curpkg)/$(dir $(file)); \
cp -a $(call debian_transform_files,$(file)) \
debian/$(cdbs_curpkg)/$(dir $(file));)
clean::
rm -rf $(DEB_TRANSFORM_FILES_TMPDIR)
endif