source: trunk/debathena/debathena/config-package-dev/transform-files.mk @ 23076

Revision 23076, 2.0 KB checked in by tabbott, 16 years ago (diff)
Improve config-package-dev documentation and examples.
Line 
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# Don't include transform-files.mk in your rules files directly;
21# instead use config-package.mk.
22
23ifndef _cdbs_rules_transform_files
24_cdbs_rules_transform_files = 1
25
26include /usr/share/cdbs/1/rules/check-files.mk
27
28DEB_TRANSFORM_FILES = $(foreach package,$(DEB_ALL_PACKAGES),$(DEB_TRANSFORM_FILES_$(package)))
29
30DEB_TRANSFORM_FILES_TMPDIR=debian/transform_file_copies
31
32debian_transform_files = $(patsubst %,$(DEB_TRANSFORM_FILES_TMPDIR)%,$(1))
33undebian_transform_files = $(patsubst $(DEB_TRANSFORM_FILES_TMPDIR)%,%,$(1))
34
35common-build-arch common-build-indep:: $(foreach file,$(DEB_TRANSFORM_FILES),$(call debian_transform_files,$(file)))
36
37$(call debian_transform_files,%): $(call debian_check_files,%)
38        mkdir -p $(@D)
39        $(if $(DEB_TRANSFORM_SCRIPT_$(call undebian_transform_files,$@)), \
40            $(DEB_TRANSFORM_SCRIPT_$(call undebian_transform_files,$@)), \
41            debian/transform_$(notdir $(call undebian_transform_files,$@))) < $< > $@
42
43$(patsubst %,binary-install/%,$(DEB_ALL_PACKAGES)) :: binary-install/%:
44        $(foreach file,$(DEB_TRANSFORM_FILES_$(cdbs_curpkg)), \
45                install -d $(DEB_DESTDIR)/$(dir $(file)); \
46                cp -a $(call debian_transform_files,$(file)) \
47                    $(DEB_DESTDIR)/$(dir $(file));)
48
49clean::
50        rm -rf $(DEB_TRANSFORM_FILES_TMPDIR)
51
52endif
Note: See TracBrowser for help on using the repository browser.