]>
Commit | Line | Data |
---|---|---|
ab8e2a67 TA |
1 | # -*- mode: makefile; coding: utf-8 -*- |
2 | # Copyright © 2008 Tim Abbott <tabbott@mit.edu> and | |
3 | # Anders Kaseorg <andersk@mit.edu> | |
4 | # | |
5 | # This program is free software; you can redistribute it and/or | |
6 | # modify it under the terms of the GNU General Public License as | |
7 | # published by the Free Software Foundation; either version 2, or (at | |
8 | # your option) any later version. | |
9 | # | |
10 | # This program is distributed in the hope that it will be useful, but | |
11 | # WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | # General Public License for more details. | |
14 | # | |
15 | # You should have received a copy of the GNU General Public License | |
16 | # along with this program; if not, write to the Free Software | |
17 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
18 | # 02111-1307 USA. | |
19 | ||
20 | ifndef _cdbs_rules_replace_files | |
21 | _cdbs_rules_replace_files = 1 | |
22 | ||
23 | include /usr/share/cdbs/1/rules/check-files.mk | |
24 | ||
25 | DEB_REPLACE_FILES = $(foreach package,$(DEB_ALL_PACKAGES),$(DEB_REPLACE_FILES_$(package))) | |
26 | ||
27 | DEB_REPLACE_FILES_DIR=debian/replace_file_copies | |
28 | ||
29 | debian_replace_files = $(patsubst %,$(DEB_REPLACE_FILES_DIR)%,$(1)) | |
30 | undebian_replace_files = $(patsubst $(DEB_REPLACE_FILES_DIR)%,%,$(1)) | |
31 | ||
32 | common-build-indep:: $(foreach file,$(DEB_REPLACE_FILES),$(call debian_replace_files,$(file))) | |
33 | ||
34 | $(call debian_replace_files,%): $(call debian_check_files,%) | |
35 | mkdir -p $(@D) | |
36 | $(if $(DEB_TRANSFORM_SCRIPT_$(call undebian_replace_files,$@)), \ | |
37 | $(DEB_TRANSFORM_SCRIPT_$(call undebian_replace_files,$@)), \ | |
38 | debian/transform_$(notdir $(call undebian_replace_files,$@))) < $< > $@ | |
39 | ||
40 | $(patsubst %,binary-install/%,$(DEB_ALL_PACKAGES)) :: binary-install/%: | |
41 | $(foreach file,$(DEB_REPLACE_FILES_$(cdbs_curpkg)), \ | |
42 | install -d $(DEB_DESTDIR)/$(dir $(file)); \ | |
43 | cp -a $(DEB_REPLACE_FILES_DIR)$(file) \ | |
44 | $(DEB_DESTDIR)/$(dir $(file));) | |
45 | ||
46 | clean:: | |
47 | $(foreach file,$(DEB_REPLACE_FILES),rm -f debian/$(notdir $(file))) | |
48 | rm -rf $(DEB_REPLACE_FILES_DIR) | |
49 | ||
50 | endif |