/[debian-cd]/branches/EFI_support/Makefile
ViewVC logotype

Contents of /branches/EFI_support/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2404 - (show annotations) (download)
Sun Aug 5 16:05:17 2012 UTC (9 months, 2 weeks ago) by 93sam
File size: 12621 byte(s)
working branch for EFI
1 #!/usr/bin/make -f
2
3 # Main Makefile for debian-cd
4 #
5 # Copyright 1999 Rapha?l Hertzog <hertzog@debian.org>
6 # See the README file for the license
7 #
8 # Significantly modified 2005-2006 Steve McIntyre <93sam@debian.org>
9 # for multi-arch and mixed bin/src discs
10 #
11 # The environment variables must have been set
12 # before. For this you can source the CONF.sh
13 # file in your shell
14
15
16 ## DEFAULT VALUES
17 ifndef VERBOSE_MAKE
18 Q=@
19 endif
20 ifndef TASK
21 TASK=Debian-generic
22 endif
23 ifndef MKISOFS
24 export MKISOFS=$(shell which genisoimage mkisofs | head -1)
25 endif
26 ifndef MKISOFS_OPTS
27 #For normal users
28 MKISOFS_OPTS=-r
29 #For symlink farmers
30 #MKISOFS_OPTS=-r -F .
31 endif
32 ifndef HOOK
33 HOOK=$(BASEDIR)/tools/$(CODENAME).hook
34 endif
35
36 export BUILD_DATE=$(shell date -u +%Y%m%d-%H:%M)
37 export ARCHES_NOSRC=$(shell echo $(ARCHES) | sed 's/source//')
38 ifeq ($(ARCHES),source)
39 export SOURCEONLY=yes
40 endif
41 ifeq ($(shell echo $(ARCHES) | sed 's/.*source.*/1/'),1)
42 export INC_SOURCE=yes
43 endif
44
45 UNDER_ARCHES=$(shell echo $(ARCHES) | sed 's/\ /_/g')
46 ARCH_MKISOFS = ${${UNDER_ARCHES}_MKISOFS}
47 ARCH_MKISOFS_OPTS = ${${UNDER_ARCHES}_MKISOFS_OPTS}
48 ifneq (${ARCH_MKISOFS},)
49 MKISOFS = ${ARCH_MKISOFS}
50 endif
51 ifneq (${ARCH_MKISOFS_OPTS},)
52 MKISOFS_OPTS = ${ARCH_MKISOFS_OPTS}
53 endif
54
55 ## Internal variables
56 apt=$(BASEDIR)/tools/apt-selection
57 sort_deps=$(BASEDIR)/tools/sort_deps
58 md5sum=md5sum
59 jigdo_cleanup=$(BASEDIR)/tools/jigdo_cleanup
60 grab_md5=$(BASEDIR)/tools/grab_md5
61 make_image=$(BASEDIR)/tools/make_image
62 merge_package_lists=$(BASEDIR)/tools/merge_package_lists
63 update_popcon=$(BASEDIR)/tools/update_popcon
64 update_tasks=$(BASEDIR)/tools/update_tasks
65 grab_source_list=$(BASEDIR)/tools/grab_source_list
66 which_deb=$(BASEDIR)/tools/which_deb
67
68 BDIR=$(TDIR)/$(CODENAME)
69 TASKDIR=$(BDIR)/tasks
70 ADIR=$(APTTMP)
71 DB_DIR=$(BDIR)/debootstrap
72
73 export DEBOOTSTRAP_DIR := $(DB_DIR)/usr/lib/debootstrap
74 export PATH := $(DB_DIR)/usr/sbin:$(PATH)
75 export BDIR
76 export TASKDIR
77
78 ## DEBUG STUFF ##
79
80 default:
81 @echo "Please refer to the README file for more information"
82 @echo "about the different targets available."
83
84 ## CHECKS ##
85
86 # Basic checks in order to avoid problems
87 ok:
88 ifdef FORCE_FAIL
89 @echo Debug variable FORCE_FAIL defined -- abort now; false
90 endif
91 ifndef TDIR
92 @echo TDIR undefined -- set up CONF.sh; false
93 endif
94 ifndef BASEDIR
95 @echo BASEDIR undefined -- set up CONF.sh; false
96 endif
97 ifndef MIRROR
98 @echo MIRROR undefined -- set up CONF.sh; false
99 endif
100 ifndef ARCHES
101 @echo ARCHES undefined -- set up CONF.sh; false
102 endif
103 ifndef CODENAME
104 @echo CODENAME undefined -- set up CONF.sh; false
105 endif
106 ifndef OUT
107 @echo OUT undefined -- set up CONF.sh; false
108 endif
109 ifdef NONFREE
110 ifdef EXTRANONFREE
111 @echo Never use NONFREE and EXTRANONFREE at the same time; false
112 endif
113 endif
114 @if [ $(DISKTYPE) = "NETINST" -o $(DISKTYPE) = "BC" ] ; then \
115 if [ "$(INC_SOURCE)"x = "yes"x ] ; then \
116 echo "Including source is not supported on a netinst/bc CD"; \
117 false; \
118 fi; \
119 fi
120
121 ## INITIALIZATION ##
122
123 # Creation of the directories needed
124 init: ok $(OUT) $(TDIR) $(BDIR) $(ADIR) $(TASKDIR) $(BDIR)/DATE $(DB_DIR) unstable-map
125 $(OUT):
126 $(Q)mkdir -p $(OUT)
127 $(TDIR):
128 $(Q)mkdir -p $(TDIR)
129 $(BDIR):
130 $(Q)mkdir -p $(BDIR)
131 $(ADIR):
132 $(Q)mkdir -p $(ADIR)
133 $(TASKDIR):
134 ifneq ($(ARCHES),source)
135 $(Q)echo "Updating task files..."
136 $(Q)mkdir -p $(TASKDIR)
137 $(Q)echo "- copying task files from 'tasks/$(DI_CODENAME)/'"
138 $(Q)cp -r $(BASEDIR)/tasks/$(CODENAME)/* $(TASKDIR)
139 $(Q)echo "- generating dynamic task files"
140 $(Q)set -e; cd $(TASKDIR); \
141 $(BASEDIR)/tools/update_tasks; \
142 $(BASEDIR)/tools/generate_di_list; \
143 $(BASEDIR)/tools/generate_di+k_list
144 ifeq ($(FORCE_FIRMWARE),1)
145 # Generate firmware task file using the contents of the archive
146 $(Q)$(BASEDIR)/tools/generate_firmware_task "$(ARCHES)" $(TASKDIR)/firmware
147 endif
148 endif
149 $(BDIR)/DATE:
150 $(Q)date -u '+%Y%m%d' > $(BDIR)/DATE
151 $(Q)date -u '+%Y%m%dT%H%M%SZ' > $(BDIR)/DATE-zulu
152
153 ifdef MIRROR
154 LATEST_DB := $(MIRROR)/$(shell $(which_deb) $(MIRROR) $(CODENAME) debootstrap)
155 $(DB_DIR): $(LATEST_DB)
156 @rm -rf $(DB_DIR)
157 $(Q)dpkg -x $(LATEST_DB) $(DB_DIR)
158 $(Q)if [ ! -e $(DEBOOTSTRAP_DIR) ] ; then \
159 ln -sf share $(DB_DIR)/usr/lib ; \
160 fi
161 endif
162
163 # Make sure unstable/sid points to testing/wheezy, as there is no build
164 # rule for unstable/sid.
165 unstable-map:
166 $(Q)if [ ! -d $(BASEDIR)/data/sid ] ; then \
167 ln -s wheezy $(BASEDIR)/data/sid ; \
168 fi
169 $(Q)if [ ! -d $(BASEDIR)/tools/boot/sid ] ; then \
170 ln -s wheezy $(BASEDIR)/tools/boot/sid ; \
171 fi
172
173 #################
174 ## CLEAN RULES ##
175 #################
176
177 # Cleans the current arch tree (but not packages selection info)
178 clean: ok dir-clean
179 dir-clean:
180 $(Q)rm -rf $(BDIR)/CD[1234567890]*
181 $(Q)rm -rf $(TASKDIR)
182 $(Q)rm -f $(BDIR)/*.filelist*
183 $(Q)rm -f $(BDIR)/packages-stamp $(BDIR)/upgrade-stamp $(BDIR)/md5-check
184
185 # Completely cleans the current arch tree
186 realclean: distclean
187 distclean: ok clean
188 $(Q)echo "Cleaning the build directory"
189 $(Q)rm -rf $(ADIR)
190 $(Q)rm -rf $(TDIR)
191
192 ####################
193 ## STATUS and APT ##
194 ####################
195
196 $(CODENAME)_status: ok init
197 $(Q)for ARCH in $(ARCHES_NOSRC); do \
198 echo "Using the provided status file for $(CODENAME)-$$ARCH ..."; \
199 cp $(BASEDIR)/data/$(CODENAME)/status.$$ARCH $(ADIR)/$(CODENAME)-$$ARCH/status 2>/dev/null || $(MAKE) status || $(MAKE) correctstatus ; \
200 done
201
202 # Regenerate the status file with only packages that
203 # are of priority standard or higher
204 status: init $(ADIR)/status
205 $(ADIR)/status:
206 @echo "Generating a fake status file for apt-get and apt-cache..."
207 $(Q)for ARCH in $(ARCHES); do \
208 mkdir -p $(ADIR)/$(CODENAME)-$$ARCH/apt/preferences.d; \
209 if [ $$ARCH = "source" -o "$(INSTALLER_CD)" = "1" -o "$(INSTALLER_CD)" = "2" -o "$(INSTALLER_CD)" = "C" ];then \
210 :> $(ADIR)/$(CODENAME)-$$ARCH/status ; \
211 else \
212 zcat $(MIRROR)/dists/$(CODENAME)/main/binary-$$ARCH/Packages.gz | \
213 perl -000 -ne 's/^(Package: .*)$$/$$1\nStatus: install ok installed/m; print if (/^Priority: (required|important|standard)/m or /^Section: base/m);' \
214 >> $(ADIR)/$(CODENAME)-$$ARCH/status ; \
215 fi; \
216 done;
217 :> $(ADIR)/status
218 # Updating the apt database
219 $(Q)for ARCH in $(ARCHES); do \
220 export ARCH=$$ARCH; \
221 $(apt) update; \
222 done
223 #
224 # Checking the consistency of the standard system
225 # If this does fail, then launch make correctstatus
226 #
227 $(Q)for ARCH in $(ARCHES); do \
228 export ARCH=$$ARCH; \
229 $(apt) check || $(MAKE) correctstatus; \
230 done
231
232 # Only useful if the standard system is broken
233 # It tries to build a better status file with apt-get -f install
234 correctstatus: status apt-update
235 # You may need to launch correctstatus more than one time
236 # in order to correct all dependencies
237 #
238 # Removing packages from the system :
239 $(Q)set -e; \
240 if [ "$(ARCHES)" != "source" ] ; then \
241 for ARCH in $(ARCHES_NOSRC); do \
242 export ARCH=$$ARCH; \
243 for i in `$(apt) deselected -f install`; do \
244 echo $$ARCH:$$i; \
245 perl -i -000 -ne "print unless /^Package: \Q$$i\E/m" \
246 $(ADIR)/$(CODENAME)-$$ARCH/status; \
247 done; \
248 done; \
249 fi
250 #
251 # Adding packages to the system :
252 $(Q)set -e; \
253 if [ "$(ARCHES)" != "source" ] ; then \
254 for ARCH in $(ARCHES_NOSRC); do \
255 export ARCH=$$ARCH; \
256 for i in `$(apt) selected -f install`; do \
257 echo $$ARCH:$$i; \
258 $(apt) cache dumpavail | perl -000 -ne \
259 "s/^(Package: .*)\$$/\$$1\nStatus: install ok installed/m; \
260 print if /^Package: \Q$$i\E\s*\$$/m;" \
261 >> $(ADIR)/$(CODENAME)-$$ARCH/status; \
262 done; \
263 done; \
264 fi
265 #
266 # Showing the output of apt-get check :
267 $(Q)for ARCH in $(ARCHES_NOSRC); do \
268 ARCH=$$ARCH $(apt) check; \
269 done
270
271 apt-update: status
272 $(Q)if [ "$(ARCHES)" != "source" ] ; then \
273 for ARCH in $(ARCHES); do \
274 echo "Apt-get is updating its files ..."; \
275 ARCH=$$ARCH $(apt) update; \
276 done; \
277 fi
278
279 ## GENERATING LISTS ##
280
281 # Deleting the list only
282 deletelist: ok
283 $(Q)-rm $(BDIR)/rawlist
284 $(Q)-rm $(BDIR)/list
285
286 packagelists: ok apt-update genlist
287
288 # Build the raw list (cpp output) with doubles and spaces
289 $(BDIR)/rawlist:
290 # Dirty workaround for saving space, we add some hints to break ties.
291 # This is just a temporal solution, sort_deps should be a little bit less
292 # silly so that this is not needed. For more info have a look at
293 # http://lists.debian.org/debian-cd/2004/debian-cd-200404/msg00093.html
294 $(Q)if [ "$(SOURCEONLY)"x != "yes"x ] ; then \
295 if [ "$(INSTALLER_CD)"x = "1"x ] ; then \
296 : ; \
297 elif [ "$(INSTALLER_CD)"x = "2"x -o "$(INSTALLER_CD)"x = "C"x ] ; then \
298 echo -e "mawk" >>$(BDIR)/rawlist; \
299 else \
300 echo -e "mawk\nexim4-daemon-light" >>$(BDIR)/rawlist; \
301 fi; \
302 fi
303
304 $(Q)if [ "$(SOURCEONLY)"x != "yes"x ] ; then \
305 if [ _$(INSTALLER_CD) != _1 ]; then \
306 for ARCH in $(ARCHES_NOSRC); do \
307 BINCLUDE=`[ -n "$(BASE_INCLUDE)" ] && cat $(BASE_INCLUDE) | tr "\n" "," | sed 's!,$$!!g'`; \
308 [ -z "$$BINCLUDE" ] || BINCLUDE="--include=$$BINCLUDE"; \
309 BEXCLUDE=`[ -n "$(BASE_EXCLUDE)" ] && cat $(BASE_EXCLUDE) | tr "\n" "," | sed 's!,$$!!g'`; \
310 [ -z "$$BEXCLUDE" ] || BEXCLUDE="--exclude=$$BEXCLUDE"; \
311 debootstrap --arch $$ARCH \
312 --print-debs \
313 $$BINCLUDE $$BEXCLUDE \
314 $(CODENAME) \
315 $(TDIR)/debootstrap.tmp \
316 file:$(MIRROR) \
317 $(DEBOOTSTRAP_SCRIPT) 2>/dev/null \
318 | tr ' ' '\n' > $(BDIR)/debootstrap-list; \
319 cat $(BDIR)/debootstrap-list >>$(BDIR)/rawlist; \
320 rm -rf $(TDIR)/debootstrap.tmp; \
321 done; \
322 fi; \
323 fi
324
325 $(Q)for ARCH in $(ARCHES_NOSRC); do \
326 ARCHDEFS="$$ARCHDEFS -D ARCH_`echo $$ARCH | sed 's/-/_/'`"; \
327 ARCHUNDEFS="$$ARCHUNDEFS -U $$ARCH"; \
328 done; \
329 for VARIANT in $(VARIANTS); do \
330 VARIANTDEFS="$$VARIANTDEFS -D VARIANT_$$VARIANT"; \
331 done; \
332 if [ "$(FORCE_FIRMWARE)"x = "1"x ] ; then \
333 ARCHDEFS="$$ARCHDEFS -DFORCE_FIRMWARE"; \
334 fi; \
335 if [ "$(EXCLUDE_486_KERNEL)"x = "1"x ] ; then \
336 ARCHDEFS="$$ARCHDEFS -DARCH_i386_EXCLUDE_486_KERNEL"; \
337 fi; \
338 if [ "$(SOURCEONLY)"x != "yes"x ] ; then \
339 cat $(TASKDIR)/$(TASK) | \
340 cpp -nostdinc -nostdinc++ -P -undef $$ARCHDEFS $$VARIANTDEFS\
341 $$ARCHUNDEFS -U i386 -U linux -U unix \
342 -DFORCENONUSONCD1=0 \
343 -I $(TASKDIR) - - >> $(BDIR)/rawlist; \
344 fi
345
346 # If we're *only* doing source, then we need to build a list of all the
347 # available source packages. Deliberately ignore the tasks too.
348 $(Q)if [ "$(SOURCEONLY)"x = "yes"x ] ; then \
349 awk '/^Package:/ {print $$2}' $(ADIR)/$(CODENAME)-source/apt-state/lists/*Sources | \
350 sort -u > $(BDIR)/rawlist; \
351 fi
352 # ls -al $(BDIR)/rawlist
353
354 # Generate the complete listing of packages from the task
355 # Build a nice list without doubles and without spaces
356 genlist: ok $(BDIR)/list
357 $(BDIR)/list: $(BDIR)/rawlist
358 @echo "Generating the complete list of packages to be included in $(BDIR)/list..."
359 $(Q)perl -ne 'chomp; next if /^\s*$$/; \
360 print "$$_\n" if not $$seen{$$_}; $$seen{$$_}++;' \
361 $(BDIR)/rawlist \
362 > $(BDIR)/list
363
364 ## IMAGE BUILDING ##
365
366 image-trees: ok genlist
367 # Use sort_deps to do the dependency sorting
368 $(Q)for ARCH in $(ARCHES_NOSRC); do \
369 ARCH=$$ARCH $(sort_deps) $(BDIR)/list; \
370 done
371 $(Q)if [ "$(SOURCEONLY)"x = "yes"x ] ; then \
372 $(grab_source_list) $(BDIR) $(ADIR) $(BDIR)/list $(BDIR)/packages; \
373 else \
374 $(merge_package_lists) $(BDIR) $(ADIR) "$(ARCHES)" $(BDIR)/packages; \
375 fi
376 $(Q)if [ "$(INC_SOURCE)"x = "yes"x ] ; then \
377 grep ^source $(BDIR)/packages > $(BDIR)/packages.source; \
378 fi
379 $(Q)$(BASEDIR)/tools/make_disc_trees.pl $(BASEDIR) $(MIRROR) $(TDIR) $(CODENAME) "$(ARCHES)" "$(MKISOFS)" "$(MKISOFS_OPTS) $(JIGDO_OPTS)"
380
381 images: ok $(OUT) $(BDIR)/md5-check
382 $(Q)$(make_image) "$(BDIR)" "$(ARCHES)" "$(OUT)" "$(DEBVERSION)" "$(MIRROR)" "$(MKISOFS)" "$(MKISOFS_OPTS)" "$(JIGDO_OPTS)" "$(jigdo_cleanup)"
383
384 check-number-given:
385 @test -n "$(CD)" || (echo "Give me a CD=<num> parameter !" && false)
386
387 # Generate only one image number $(CD)
388 image: check-number-given images
389
390 # Calculate the md5sums for the images (if available), or get from templates
391 imagesums:
392 $(Q)$(BASEDIR)/tools/imagesums $(OUT) $(SUMS_EXTENSION)
393
394 ## MISC TARGETS ##
395
396 $(BDIR)/md5-check: mirrorcheck
397
398 mirrorcheck: ok
399 $(Q)$(grab_md5) $(MIRROR) "$(ARCHES)" $(CODENAME) $(DI_CODENAME) $(BDIR)/md5-check
400 $(Q)for ARCH in $(ARCHES); do \
401 if [ -e $(BASEDIR)/data/$(CODENAME)/$$ARCH/extra-sources ]; then \
402 echo "Extra dedicated source added; need to grab source MD5 info too"; \
403 $(grab_md5) $(MIRROR) source $(CODENAME) $(DI_CODENAME) $(BDIR)/md5-check; \
404 fi; \
405 done
406
407 update-popcon:
408 $(update_popcon) tasks/$(CODENAME)/popularity-contest
409
410 # Little trick to simplify things
411 official_images: ok init packagelists image-trees images

Properties

Name Value
svn:eol-style native
svn:executable *
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.5