2
# Separate tarball/patch build system by Adam Heath <doogie@debian.org>
4
# The magic targets that you need to concern yourself with are:
6
# source.build: Unpacks upstream tarballs, optionally applies patches
7
# to fix the upstream patches, then applies upstream
9
# source.make: Applies debian patches.
10
# source.clean: Cleans the build directory, then unfixes the upstream
12
# source.compile: Will compile the source for you. Please check
13
# debian/scripts/vars.
14
# source.cmd: When calling this target, if you define a variable
15
# SOURCE_CMD, it will run that command in the build
17
# make-diff: Generates debian.diff in the current directory which
18
# contains all edits that are currently in the build
21
# Nothing in this file should require any editting. Please look at
22
# debian/scripts/vars for things to change for the local environment.
24
# debian/rules target command
25
# ----------------------------------------------------------------
26
# clean: $(MAKE) -f debian/sys-build.mk source.clean
27
# build: $(MAKE) -f debian/sys-build.mk source.compile
29
# build: $(MAKE) -f debian/sys-build.mk source.make
30
# and, in the rules file, you can
31
# build the targets you want.
37
include debian/scripts/vars
39
DIFF_EXCLUDE:=$(patsubst %,-x %,$(shell echo $(DIFF_EXCLUDE)))
42
BUILD_TREE=$(SOURCE_DIR)/$(TAR_DIR)
44
BUILD_TREE=$(SOURCE_DIR)
65
$(MAKE) -f debian/sys-build.mk source.clean
66
$(MAKE) -f debian/sys-build.mk source.make
67
mv $(BUILD_TREE) $(BUILD_TREE).orig
71
ifdef CLEAN_TARGET_EXTERNAL
72
$(CLEAN_CMD)$(MAKE) -f debian/rules $(CLEAN_TARGET_EXTERNAL)
74
$(CLEAN_CMD)$(MAKE) -C $(BUILD_TREE) $(CLEAN_TARGET)
76
-(cd $(SOURCE_DIR);diff -ruN $(TAR_DIR).orig $(TAR_DIR) $(DIFF_EXCLUDE)) > debian.diff
78
ifdef CLEAN_TARGET_EXTERNAL
79
@echo CLEAN_TARGET_EXTERNAL=\"$(CLEAN_TARGET_EXTERNAL)\"
80
$(CLEAN_CMD)$(MAKE) -f debian/rules $(CLEAN_TARGET_EXTERNAL)
82
$(CLEAN_CMD)for a in $(BUILD_TREE)/*;do $(MAKE) -C $$a $(CLEAN_TARGET);done
84
-(diff -ruN $(BUILD_TREE).orig $(BUILD_TREE) $(DIFF_EXCLUDE)) > debian.diff
85
if [ ! -s debian.diff ];then\
89
rm -rf $(BUILD_TREE).orig
91
patchapply: $(STAMP_DIR)/patchapply
92
$(STAMP_DIR)/patchapply: $(STAMP_DIR)/source.build $(STAMP_DIR)
93
$(SHELL) debian/scripts/patch.apply
95
rm -f $(STAMP_DIR)/patchunapply
97
patchunapply: $(STAMP_DIR)/patchunapply
98
$(STAMP_DIR)/patchunapply: $(STAMP_DIR)/source.build $(STAMP_DIR)
99
$(SHELL) debian/scripts/patch.unapply
101
rm -f $(STAMP_DIR)/patchapply
106
# The rules that really do the work all start with $(STAMPDIR)
107
# This little trick allows us to use stamp files to keep us from
108
# having to rerun long targets over and over. It also puts
109
# all stamp files in one place, for easy cleaning.
111
# If a stampdir rule depends on something else, be sure it is
112
# another stampdir rule. Depending on base rule won't work.
115
source.build: $(STAMP_DIR)/source.build
116
$(STAMP_DIR)/source.build: $(STAMP_DIR)/source.unpack $(STAMP_DIR)/source.patch $(STAMP_DIR)
119
source.make: $(STAMP_DIR)/source.make
120
$(STAMP_DIR)/source.make: $(STAMP_DIR)/source.build $(STAMP_DIR)/patchapply $(STAMP_DIR)
123
source.unpack: $(STAMP_DIR)/source.unpack
124
$(STAMP_DIR)/source.unpack: $(STAMP_DIR)
125
$(SHELL) debian/scripts/source.unpack
128
source.patch: $(STAMP_DIR)/source.patch
129
$(STAMP_DIR)/source.patch: $(STAMP_DIR)/source.unpack $(STAMP_DIR)/fix.source.patch $(STAMP_DIR)
130
$(SHELL) debian/scripts/source.patch
133
fix.source.patch: $(STAMP_DIR)/fix.source.patch
134
$(STAMP_DIR)/fix.source.patch: $(STAMP_DIR)
135
$(SHELL) debian/scripts/fix.source.patch
138
unfix.source.patch: $(STAMP_DIR)/unfix.source.patch
139
$(STAMP_DIR)/unfix.source.patch: $(STAMP_DIR)
140
$(SHELL) debian/scripts/unfix.source.patch
143
source.compile: $(STAMP_DIR)/source.compile
144
$(STAMP_DIR)/source.compile: $(STAMP_DIR)/source.make $(STAMP_DIR)
145
$(MAKE) -C $(BUILD_TREE) $(BUILD_TARGET)
149
(cd $(BUILD_TREE); $(SOURCE_CMD))
151
DIR_TARGETS+=$(STAMP_DIR)
152
STAMP_DIR_TARGETS+=source.make source.unpack source.patch fix.source.patch unfix.source.patch patchunapply patchunapply
157
source.clean: unfix.source.patch
158
$(SHELL) debian/scripts/source.clean