2 # Thierry Parmentelat - INRIA Sophia Antipolis
10 # this extracts all specfiles and computes .mk from specfiles
11 # you need to specify PLDISTRO here if relevant - see below
13 # for more info on how to invoke this stuff
15 #################### (fedora) distributions
17 # (*) as of nov. 2007, myplc-devel is deprecated
18 # (*) instead, we create a fresh vserver that holds required tools (see e.g. planetlab-devel.lst)
19 # (*) the build uses the current fedora version as a target for the produced images
20 # (*) so you simply need to create a fedora 8 build image for building fedora-8 images
22 #################### (planetlab) distributions
24 # (*) see README-pldistros.txt
25 # (*) then you need to run
26 # make stage1=true PLDISTRO=onelab
29 # This build deals with 3 kinds of objects
31 # (*) packages are named upon the RPM name; they are mostly lowercase
32 # Add a package to ALL if you want it built as part of the default set.
33 # (*) modules are named after the subversion tree; as of this writing their names
34 # are mostly mixed case like MyPLC or VserverReference
35 # (*) rpms are named in the spec files. A package typically defines several rpms;
36 # rpms are used for defining DEPEND-DEVEL-RPMS. See also package.rpmnames
38 #################### packages
39 # basics: how to build a package - you need/may define the following variables
42 # a package needs one or several modules to build.
45 # the package's specfile; this is relative to the FIRST module in package-MODULES
46 # see 'codebase' below
50 # (*) package-SPECVARS
51 # space-separated list of spec variable definitions, where you can reference make variable that relate to
52 # packages defined BEFORE the current one (note: you should use = - as opposed to := - to define these)
53 # e.g. mydriver-SPECVARS = foo=$(kernel-rpm-release)
54 # would let you use the %release from the kernel's package when rpmbuild'ing mydriver - see automatic below
55 # (*) package-DEPEND-PACKAGES
56 # a set of *packages* that this package depends on
57 # (*) package-DEPEND-DEVEL-RPMS
58 # a set of *rpms* that the build will rpm-install before building <package>
59 # (*) package-DEPEND-FILES
60 # a set of files that the package depends on - and that make needs to know about
61 # if this contains RPMS/yumgroups.xml, then the toplevel RPMS's index
62 # is refreshed with createrepo prior to running rpmbuild
63 # (*) package-RPMFLAGS: Miscellaneous RPM flags
64 # (*) package-RPMBUILD: If not rpmbuild - mostly used for sudo'ing rpmbuild
65 # (*) package-BUILD-FROM-SRPM: set this to any non-empty value, if your package is able to produce
66 # a source rpms by running 'make srpm'
67 # (*) package-RPMDATE: set this to any non-empty value to get the rpm package's release field hold the current date
68 # this is useful for container packages, like e.g. bootstrapfs or vserver, that contains much more than the
71 #################### modules
72 # Required information about the various modules (set this in e.g. planetlab-tags.mk)
75 # the complete path where this module lies;
76 # you can specify the trunk or a given tag with this variable
78 # OR if the module is managed under cvs (will be obsoleted)
83 #################### automatic variables
85 # the build defines some make variables that are extracted from spec files
87 # (*) $ make ulogd-pkginfo
88 # to see the list f variables attached to a given package
89 # (*) $ make kernel-devel-rpminfo
90 # to see the list of variables attached to a given rpm
94 # exported to spec files as plrelease
95 PLANETLAB_RELEASE = 4.2
100 # minimal compat with macos, just so this does not complain
101 HOSTARCH := $(shell uname -i 2> /dev/null || uname -m 2> /dev/null)
102 DISTRO := $(shell ./getdistro.sh)
103 RELEASE := $(shell ./getrelease.sh)
104 DISTRONAME := $(shell ./getdistroname.sh)
105 RPM-INSTALL-DEVEL := rpm --force -Uvh
106 # cannot force rpm -e
107 RPM-UNINSTALL-DEVEL := rpm -e
109 #################### Makefile
115 PLDISTRO := planetlab
117 export CVS_RSH := ssh
119 ########## pldistro.mk holds PLDISTRO - it is generated at stage1 (see below)
124 #################### include onelab.mk
125 # describes the set of components
126 PLDISTROCONTENTS := $(PLDISTRO).mk
127 include $(PLDISTROCONTENTS)
129 #################### include <pldistro>-tags.mk
130 # describes where to fetch components, and the related tags if using cvs
131 PLDISTROTAGS := $(PLDISTRO)-tags.mk
132 include $(PLDISTROTAGS)
134 # this used to be set in the -tags.mk files, but that turned out to require
135 # error-prone duplicate changes
136 # so now the nightly build script sets this to what it is currently using
137 # we set a default in case we run the build manually:
138 # if the local directory was svn checked out, then use the corresponding URL
139 svn-info-url-line := $(shell svn info 2> /dev/null | grep URL:)
140 default-build-SVNPATH := $(lastword $(svn-info-url-line))
141 # otherwise, use this hard-coded default
142 ifeq "$(default-build-SVNPATH)" ""
143 default-build-SVNPATH := http://svn.planet-lab.org/svn/build/trunk
145 # use default if necessary
146 build-SVNPATH ?= $(default-build-SVNPATH)
148 ########## stage1 and stage1iter
149 # extract specs and compute .mk files by running
151 # entering stage1, we compute all the spec files
152 # then we use stage1iter to compute the .mk iteratively,
153 # ensuring that the n-1 first makefiles are loaded when creating the n-th one
154 # when stage1iter is set, it is supposed to be an index (starting at 1) in $(ALL)
156 ALLMKS := $(foreach package, $(ALL), MAKE/$(package).mk)
158 ### stage1iter : need some arithmetic, see
159 # http://www.cmcrossroads.com/articles/ask-mr.-make/learning-gnu-make-functions-with-arithmetic.html
160 ifneq "$(stage1iter)" ""
161 # the first n packages
162 packages := $(wordlist 1,$(words $(stage1iter)),$(ALL))
164 package := $(word $(words $(packages)),$(packages))
165 # the n-1 first packages
166 stage1iter_1 := $(wordlist 2,$(words $(stage1iter)),$(stage1iter))
167 previous := $(wordlist 1,$(words $(stage1iter_1)),$(ALL))
168 previousmks := $(foreach package,$(previous),MAKE/$(package).mk)
169 include $(previousmks)
172 @echo "========== stage1iter : $(package)"
173 # @echo "stage1iter : included .mk files : $(previousmks)"
174 all: $($(package).specpath)
175 all: MAKE/$(package).mk
181 @echo "========== stage1"
184 # specs and makes are done sequentially by stage1iter
187 arg=""; for n in $(ALL) ; do arg="$$arg x"; $(MAKE) --no-print-directory stage1iter="$$arg"; done
190 ### once .mks are OK, you can run make normally
197 # mention $(ALL) here rather than rpms
198 # this is because the inter-package dependencies are expressed like
199 # util-vserver: util-python
205 ### yumgroups.xml : compute from all known .pkgs files
208 ./yumgroups.sh $(PLDISTRO) > $@
210 createrepo = createrepo --quiet -g yumgroups.xml RPMS/
212 repo: RPMS/yumgroups.xml
219 # * to make configuration easier, we always use the first module's
220 # definitions (CVSROOT,TAG, or SVNPATH) to extract the spec file
221 # * for the same reason, in case cvs is used, the first module name is added to
222 # $(package)-SPEC - otherwise the cvs modules have to define spec as
223 # <module>/<module>.spec while svn modules just define it as <module>.spec
225 define stage1_variables
226 $(1).spec = $(notdir $($(1)-SPEC))
227 $(1).specpath = SPECS/$(1).spec
228 $(1).module = $(firstword $($(1)-MODULES))
229 $(1)-SVNPATH = $(strip $($(1)-SVNPATH))
232 $(foreach package, $(ALL), $(eval $(call stage1_variables,$(package))))
235 # for each package, compute whether we need to set date
236 # the heuristic is that we mention the date as part of the rpm release flag if
237 # (*) the package has requested it by setting package-RPMDATE (container packages should do that)
238 # (*) or SVNPATH contains 'trunk' or 'branches'
240 define package_hasdate
241 $(1).has-date = $(if $($(1)-RPMDATE),yes, \
242 $(if $($($(1).module)-SVNPATH), \
243 $(if $(findstring /trunk,$($($(1).module)-SVNPATH)),yes, \
244 $(if $(findstring /branches,$($($(1).module)-SVNPATH)),yes,)), \
245 $(if $(findstring HEAD,$($($(1).module)-TAG)),yes,)))
248 $(foreach package, $(ALL), $(eval $(call package_hasdate,$(package))))
250 ### the common header for generated specfiles
251 # useful when trying new specfiles manually
253 (echo -n "# Generated by planetlab build from $($(1)-SPEC) on " ; date) > $@
254 echo "%define distro $(DISTRO)" >> $@
255 echo "%define distrorelease $(RELEASE)" >> $@
256 echo "%define distroname $(DISTRONAME)" >> $@
257 echo "%define pldistro $(PLDISTRO)" >> $@
258 echo "%define plrelease $(PLANETLAB_RELEASE)" >> $@
260 ### extract spec file from scm
262 $($(1).specpath): header.spec
264 cat header.spec > $($(1).specpath)
265 $(if $($(1).has-date),echo "%define date $(shell date +%Y.%m.%d)" >> $($(1).specpath),)
266 $(if $($(1)-SPECVARS), \
267 $(foreach line,$($(1)-SPECVARS), \
268 echo "%define" $(word 1,$(subst =, ,$(line))) "$(word 2,$(subst =, ,$(line)))" >> $($(1).specpath) ;))
269 echo "# included from $($(1)-SPEC)" >> $($(1).specpath)
270 $(if $($($(1).module)-SVNPATH),\
271 svn cat $($($(1).module)-SVNPATH)/$($(1)-SPEC) >> $($(1).specpath) || rm $($(1).specpath),\
272 cvs -d $($($(1).module)-CVSROOT) checkout \
273 -r $($($(1).module)-TAG) \
274 -p $($(1).module)/$($(1)-SPEC) >> $($(1).specpath))
277 $(foreach package,$(ALL),$(eval $(call target_spec,$(package))))
280 # Base rpmbuild in the current directory
281 # issues on fedora 8 : see the following posts
282 # http://forums.fedoraforum.org/showthread.php?t=39625 - and more specifically post#6
283 # https://www.redhat.com/archives/fedora-devel-list/2007-November/msg00171.html
285 FAKEROOT=/longbuildroot
286 PWD=$(shell /bin/pwd)
287 ifeq "$(PWD)" "$(REALROOT)"
288 export HOME := $(FAKEROOT)
290 export HOME := $(PWD)
293 ifeq "$(shell pwd)" "/build"
294 rm -f $(FAKEROOT) ; ln -s $(REALROOT) $(FAKEROOT)
297 echo "%_topdir $(HOME)" >> $@
298 echo "%_tmppath $(HOME)/tmp" >> $@
299 ./getrpmmacros.sh >> $@
301 ### this utility allows to extract various info from a spec file
302 ### and to define them in makefiles
303 spec2make: spec2make.c
304 $(CC) -g -Wall $< -o $@ -lrpm -lrpmbuild
306 ### run spec2make on the spec file and include the result
307 # usage: spec2make package
309 MAKE/$(1).mk: $($(1).specpath) spec2make .rpmmacros
311 ./spec2make $($(1)-RPMFLAGS) $($(1).specpath) $(1) > MAKE/$(1).mk || { rm MAKE/$(1).mk; exit 1; }
314 $(foreach package,$(ALL),$(eval $(call target_mk,$(package))))
316 # stores PLDISTRO in a file
317 # this is done at stage1. later run wont get confused
319 echo "PLDISTRO:=$(PLDISTRO)" > $@
320 echo "PLDISTROTAGS:=$(PLDISTROTAGS)" >> $@
322 savepldistro: pldistro.mk
325 # always refresh this
328 #################### regular make
330 define stage2_variables
331 ### devel dependencies
332 $(1).rpmbuild = $(if $($(1)-RPMBUILD),$($(1)-RPMBUILD),$(RPMBUILD)) $($(1)-RPMFLAGS)
333 $(1).all-devel-rpm-paths := $(foreach rpm,$($(1)-DEPEND-DEVEL-RPMS),$($(rpm).rpm-path))
334 $(1).depend-devel-packages := $(sort $(foreach rpm,$($(1)-DEPEND-DEVEL-RPMS),$($(rpm).package)))
335 ALL-DEVEL-RPMS += $($(1)-DEPEND-DEVEL-RPMS)
338 $(foreach package,$(ALL),$(eval $(call stage2_variables,$(package))))
339 ALL-DEVEL-RPMS := $(sort $(ALL-DEVEL-RPMS))
342 ### pack sources into tarballs
343 ALLTARBALLS:= $(foreach package, $(ALL), $($(package).tarballs))
344 tarballs: $(ALLTARBALLS)
345 @echo $(words $(ALLTARBALLS)) source tarballs OK
348 SOURCES/%.tar.bz2: SOURCES/%
349 tar chpjf $@ -C SOURCES $*
351 SOURCES/%.tar.gz: SOURCES/%
352 tar chpzf $@ -C SOURCES $*
354 SOURCES/%.tgz: SOURCES/%
355 tar chpzf $@ -C SOURCES $*
358 URLS/%: url=$(subst @colon@,:,$(subst @slash@,/,$(notdir $@)))
359 URLS/%: basename=$(notdir $(url))
361 echo curl $(url) -o SOURCES/$(basename)
364 ### the directory SOURCES/<package>-<version> is made
365 # with a copy -rl from CODEBASES/<package>
366 # the former is $(package.source) and the latter is $(package.codebase)
367 ALLSOURCES:=$(foreach package, $(ALL), $($(package).source))
368 # so that make does not use the rule below directly for creating the tarball files
369 .SECONDARY: $(ALLSOURCES)
371 sources: $(ALLSOURCES)
372 @echo $(words $(ALLSOURCES)) versioned source trees OK
375 define target_link_codebase_sources
376 $($(1).source): $($(1).codebase) ; mkdir -p SOURCES ; cp -rl $($(1).codebase) $($(1).source)
379 $(foreach package,$(ALL),$(eval $(call target_link_codebase_sources,$(package))))
381 ### codebase extraction
382 ALLCODEBASES:=$(foreach package, $(ALL), $($(package).codebase))
383 # so that make does not use the rule below directly for creating the tarball files
384 .SECONDARY: $(ALLCODEBASES)
386 codebases : $(ALLCODEBASES)
387 @echo $(words $(ALLCODEBASES)) codebase OK
391 # usage: extract_single_module package
392 define extract_single_module
394 $(if $($($(1).module)-SVNPATH), cd CODEBASES && svn export $($($(1).module)-SVNPATH) $(1), cd CODEBASES && cvs -d $($($(1).module)-CVSROOT) export -r $($($(1).module)-TAG) -d $(1) $($(1).module))
397 # usage: extract_multi_module package
398 define extract_multi_module
399 mkdir -p CODEBASES/$(1) && cd CODEBASES/$(1) && (\
400 $(foreach m,$($(1)-MODULES), $(if $($(m)-SVNPATH), svn export $($(m)-SVNPATH) $(m);, cvs -d $($(m)-CVSROOT) export -r $($(m)-TAG) $(m);)))
403 CODEBASES/%: package=$(notdir $@)
404 CODEBASES/%: multi_module=$(word 2,$($(package)-MODULES))
406 @(echo -n "XXXXXXXXXXXXXXX -- BEG CODEBASE $(package) : $@ " ; date)
407 $(if $(multi_module),\
408 $(call extract_multi_module,$(package)),\
409 $(call extract_single_module,$(package)))
410 @(echo -n "XXXXXXXXXXXXXXX -- END CODEBASE $(package) : $@ " ; date)
413 ALLSRPMS:=$(foreach package,$(ALL),$($(package).srpm))
415 @echo $(words $(ALLSRPMS)) source rpms OK
418 # usage: target_source_rpm package
419 # select upon the package name, whether it contains srpm or not
420 define target_source_rpm
421 ifeq "$($(1)-BUILD-FROM-SRPM)" ""
422 $($(1).srpm): $($(1).specpath) .rpmmacros $($(1).tarballs)
423 mkdir -p BUILD SRPMS tmp
424 @(echo -n "XXXXXXXXXXXXXXX -- BEG SRPM $(1) (using SOURCES) " ; date)
425 $(if $($(1).all-devel-rpm-paths), $(RPM-INSTALL-DEVEL) $($(1).all-devel-rpm-paths))
426 $($(1).rpmbuild) -bs $($(1).specpath)
427 $(if $($(1)-DEPEND-DEVEL-RPMS), $(RPM-UNINSTALL-DEVEL) $($(1)-DEPEND-DEVEL-RPMS))
428 @(echo -n "XXXXXXXXXXXXXXX -- END SRPM $(1) " ; date)
430 $($(1).srpm): $($(1).specpath) .rpmmacros $($(1).codebase)
431 mkdir -p BUILD SRPMS tmp
432 @(echo -n "XXXXXXXXXXXXXXX -- BEG SRPM $(1) (using make srpm) " ; date)
433 $(if $($(1).all-devel-rpm-paths), $(RPM-INSTALL-DEVEL) $($(1).all-devel-rpm-paths))
434 make -C $($(1).codebase) srpm SPECFILE=$(HOME)/$($(1).specpath) && \
435 rm -f SRPMS/$(notdir $($(1).srpm)) && \
436 ln $($(1).codebase)/$(notdir $($(1).srpm)) SRPMS/$(notdir $($(1).srpm))
437 $(if $($(1)-DEPEND-DEVEL-RPMS), $(RPM-UNINSTALL-DEVEL) $($(1)-DEPEND-DEVEL-RPMS))
438 @(echo -n "XXXXXXXXXXXXXXX -- END SRPM $(1) " ; date)
442 $(foreach package,$(ALL),$(eval $(call target_source_rpm,$(package))))
444 ### binary rpms are made from source rpm
445 ALLRPMS:=$(foreach package,$(ALL),$($(package).rpms))
446 # same as above, mention $(ALL) and not $(ALLRPMS)
448 @echo $(words $(ALLRPMS)) binary rpms OK
451 # use tmp dirs when building binary rpm so make remains idempotent
452 # otherwise SOURCES/ or SPEC gets touched again - which leads to rebuilding
453 RPM-USE-TMP-DIRS = --define "_sourcedir $(HOME)/tmp" --define "_specdir $(HOME)/tmp"
454 RPM-USE-COMPILE-DIRS = --define "_sourcedir $(HOME)/COMPILE" --define "_specdir $(HOME)/COMPILE"
456 # usage: build_binary_rpm package
457 # xxx hacky - invoke createrepo if DEPEND-FILES mentions RPMS/yumgroups.xml
458 define target_binary_rpm
459 $($(1).rpms): $($(1).srpm)
461 @(echo -n "XXXXXXXXXXXXXXX -- BEG RPM $(1) " ; date)
462 $(if $(findstring RPMS/yumgroups.xml,$($(1)-DEPEND-FILES)), $(createrepo) , )
463 $(if $($(1).all-devel-rpm-paths), $(RPM-INSTALL-DEVEL) $($(1).all-devel-rpm-paths))
464 $($(1).rpmbuild) --rebuild $(RPM-USE-TMP-DIRS) $($(1).srpm)
465 $(if $($(1)-DEPEND-DEVEL-RPMS), $(RPM-UNINSTALL-DEVEL) $($(1)-DEPEND-DEVEL-RPMS))
466 @(echo -n "XXXXXXXXXXXXXXX -- END RPM $(1) " ; date)
467 # for manual use only - in case we need to investigate the results of an rpmbuild
468 $(1)-compile: $($(1).srpm)
470 @(echo -n "XXXXXXXXXXXXXXX -- BEG compile $(1) " ; date)
471 $(if $(findstring RPMS/yumgroups.xml,$($(1)-DEPEND-FILES)), $(createrepo) , )
472 $(if $($(1).all-devel-rpm-paths), $(RPM-INSTALL-DEVEL) $($(1).all-devel-rpm-paths))
473 $($(1).rpmbuild) --recompile $(RPM-USE-TMP-DIRS) $($(1).srpm)
474 $(if $($(1)-DEPEND-DEVEL-RPMS), $(RPM-UNINSTALL-DEVEL) $($(1)-DEPEND-DEVEL-RPMS))
475 @(echo -n "XXXXXXXXXXXXXXX -- END compile $(1) " ; date)
479 $(foreach package,$(ALL),$(eval $(call target_binary_rpm,$(package))))
481 # e.g. make proper -> does propers rpms
482 # usage shorthand_target package
483 define target_shorthand
486 $(1)-spec: $($(1)-SPEC)
490 $(1)-tarball: $($(1).tarballs)
492 $(1)-codebase: $($(1).codebase)
494 $(1)-source: $($(1).source)
495 .PHONY: $(1)-codebase
496 $(1)-rpms: $($(1).rpms)
498 $(1)-srpm: $($(1).srpm)
502 $(foreach package,$(ALL),$(eval $(call target_shorthand,$(package))))
504 ### file dependencies
505 define package_depends_on_file
510 define target_dependfiles
511 $(foreach file,$($(1)-DEPEND-FILES),$(eval $(call package_depends_on_file,$(1),$(file))))
514 $(foreach package,$(ALL),$(eval $(call target_dependfiles,$(package))))
516 ### package dependencies
517 define package_depends_on_package
520 $($(1).srpm):$($(2).rpms)
523 define target_depends
524 $(foreach package,$($(1)-DEPEND-PACKAGES) $($(1).depend-devel-packages),$(eval $(call package_depends_on_package,$(1),$(package))))
527 $(foreach package,$(ALL),$(eval $(call target_depends,$(package))))
530 # usage: target_clean package
533 rm -rf $($(1).codebase)
534 .PHONY: $(1)-clean-codebase
535 CLEANS += $(1)-clean-codebase
537 rm -rf $($(1).source)
538 .PHONY: $(1)-clean-source
539 CLEANS += $(1)-clean-source
541 rm -rf $($(1).tarballs)
542 .PHONY: $(1)-clean-tarball
543 CLEANS += $(1)-clean-tarball
545 rm -rf BUILD/$(notdir $($(1).source))
546 CLEANS += $(1)-clean-build
549 .PHONY: $(1)-clean-rpms
550 CLEANS += $(1)-clean-rpms
553 .PHONY: $(1)-clean-srpm
554 CLEANS += $(1)-clean-srpm
555 $(1)-codeclean: $(1)-clean-source $(1)-clean-tarball $(1)-clean-build $(1)-clean-rpms $(1)-clean-srpm
556 $(1)-clean: $(1)-clean-codebase $(1)-codeclean
557 .PHONY: $(1)-codeclean $(1)-clean
559 rm -rf $($(1).specpath)
560 .PHONY: $(1)-clean-spec
563 .PHONY: $(1)-clean-make
564 $(1)-distclean: $(1)-distclean1 $(1)-distclean2
565 $(1)-distclean1: $(1)-clean-spec $(1)-clean-make
566 $(1)-distclean2: $(1)-clean
567 .PHONY: $(1)-distclean $(1)-distclean1 $(1)-distclean2
570 $(foreach package,$(ALL),$(eval $(call target_clean,$(package))))
578 @echo Available clean targets
581 ### brute force clean
583 rm -rf pldistro.mk .rpmmacros spec2make header.spec SPECS MAKE
585 rm -rf CODEBASES SOURCES BUILD RPMS SRPMS tmp
586 distclean: distclean1 distclean2
587 .PHONY: distclean1 distclean2 distclean
590 $(RPM-UNINSTALL-DEVEL) $(ALL-DEVEL-RPMS)
593 # gather build information for the 'About' page
594 # when run from crontab, INIT_CWD not properly set (says /root ..)
595 # so, the nightly build passes NIGHTLY_BASE here
596 # also store the nightly_base in .base for any post-processing purposes
598 @echo 'Creating myplc-release'
600 echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx build info" >> $@
601 $(MAKE) --no-print-directory version-build >> $@
602 echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx svn info" >> $@
603 $(MAKE) --no-print-directory version-svns >> $@
604 echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx rpm info" >> $@
605 $(MAKE) --no-print-directory version-rpms >> $@
606 @echo $(NIGHTLY_BASE) > .base
609 @echo -n 'Build build-date: ' ; date '+%Y.%m.%d'
610 @echo -n 'Build build-time: ' ; date '+%H:%M-%Z'
611 @echo -n 'Build build-hostname: ' ; hostname
612 @echo "Build build-base: $(NIGHTLY_BASE)"
613 @echo "Build planetlab-distro: $(PLDISTRO)"
614 @echo "Build planetlab-tags: $(PLDISTROTAGS)"
615 @echo -n 'Build planetlab-tagsid: ' ; fgrep '$$''Id' $(PLDISTROTAGS)
616 @echo "Build target-arch: $(HOSTARCH)"
617 @echo "Build target-distro: $(DISTRO)"
618 @echo "Build target-distroname: $(DISTRONAME)"
619 @echo "Build target-release: $(RELEASE)"
620 @echo "Build target-personality: $(NIGHTLY_PERSONALITY)"
624 VFORMAT="%30s := %s\n"
625 define svn_version_target
627 @$(if $($(1)-SVNPATH),\
628 printf $(VFORMAT) $(1)-SVNPATH "$($(1)-SVNPATH)",\
629 printf $(VFORMAT) $(1)-CVSROOT "$($(1)-CVSROOT)" ; printf $(VFORMAT) $(1)-TAG "$($(1)-TAG)")
632 # compute all modules
634 $(foreach package,$(ALL), $(eval ALL-MODULES+=$($(package)-MODULES)))
635 ALL-MODULES:=$(sort $(ALL-MODULES))
637 $(foreach module,$(ALL-MODULES), $(eval $(call svn_version_target,$(module))))
639 version-svns: $(foreach module, $(ALL-MODULES), $(module)-version-svn)
641 RFORMAT="%20s :: version=%s release=%s\n"
642 define rpm_version_target
644 @printf $(RFORMAT) $($(1).rpm-name) $($(1).rpm-version) $($(1).rpm-release)
645 version-rpms: $(1)-version-rpm
648 $(foreach package,$(sort $(ALL)), $(eval $(call rpm_version_target,$(package))))
650 versions: myplc-release version-build version-svns version-rpms
651 .PHONY: versions version-build version-rpms version-svns
653 #################### package info
654 PKGKEYS := tarballs source codebase srpm rpms rpmnames rpm-release rpm-name rpm-version rpm-subversion
655 %-pkginfo: package=$(subst -pkginfo,,$@)
657 @$(foreach key,$(PKGKEYS),echo "$(package).$(key)=$($(package).$(key))";)
659 RPMKEYS := rpm-path package
660 %-rpminfo: rpm=$(subst -rpminfo,,$@)
662 @$(foreach key,$(RPMKEYS),echo "$(rpm).$(key)=$($(rpm).$(key))";)
664 #################### various lists - designed to run with stage1=true
666 @$(foreach package,$(ALL), echo package=$(package) ref_module=$($(package).module) modules=$($(package)-MODULES) rpmnames=$($(package).rpmnames); )
669 @$(foreach module,$(ALL-MODULES), echo module=$(module) svnpath=$($(module)-SVNPATH); )
672 @$(foreach module,$(ALL-MODULES), \
673 $(if $($(module)-SVNBRANCH),echo module=$(module) branch=$($(module)-SVNBRANCH);))
676 @$(foreach module,$(ALL-MODULES), \
677 $(if $($(module)-SVNPATH), \
678 $(if $($(module)-SVNBRANCH), \
679 echo $(module):$($(module)-SVNBRANCH); , \
682 info: packages modules branches
684 .PHONY: info packages modules branches module-tools
688 @$(if $(TESTS_SVNPATH), echo $(TESTS_SVNPATH) > $@, \
689 echo "http://svn.planet-lab.org/svn/tests/trunk" > $@)
693 @echo "********** Run make in two stages:"
695 @echo "make stage1=true PLDISTRO=onelab"
696 @echo " -> extracts all spec files in SPECS/ and mk files in MAKE/"
697 @echo " as well as save PLDISTRO for subsequent runs"
699 @echo "********** Then you can use the following targets"
701 @echo " rebuilds everything"
702 @echo 'make util-vserver'
703 @echo " makes the RPMS related to util-vserver"
704 @echo " equivalent to 'make util-vserver-rpms'"
706 @echo "********** Or, vertically - step-by-step for a given package"
707 @echo 'make util-vserver-codebase'
708 @echo " performs codebase extraction in CODEBASES/util-vserver"
709 @echo 'make util-vserver-source'
710 @echo " creates source link in SOURCES/util-vserver-<version>"
711 @echo 'make util-vserver-tarball'
712 @echo " creates source tarball in SOURCES/util-vserver-<version>.<tarextension>"
713 @echo 'make util-vserver-srpm'
714 @echo " build source rpm in SRPMS/"
715 @echo 'make util-vserver-rpms'
716 @echo " build rpm(s) in RPMS/"
718 @echo "********** Or, horizontally, reach a step for all known packages"
719 @echo 'make codebases'
721 @echo 'make tarballs'
725 @echo "********** Manual targets"
726 @echo "make package-compile"
727 @echo " The regular process uses rpmbuild --rebuild, that performs"
728 @echo " a compilation directory cleanup upon completion. If you need to investigate"
729 @echo " the intermediate compilation directory, use the -compile targets"
730 @echo "********** Cleaning examples"
732 @echo " removes the files made by make"
733 @echo "make distclean"
734 @echo " brute-force cleaning, removes entire directories - requires a new stage1"
735 @echo "make develclean"
736 @echo " rpm-uninstalls all devel packages installed during build"
738 @echo "make iptables-distclean"
739 @echo " deep clean for a given package"
740 @echo "make iptables-codeclean"
741 @echo " run this if you've made a change in the CODEBASES area for iptables"
743 @echo "make util-vserver-clean"
744 @echo " removes codebase, source, tarball, build, rpm and srpm for util-vserver"
745 @echo "make util-vserver-clean-codebase"
746 @echo " and so on for source, tarball, build, rpm and srpm"
748 @echo "********** Info examples"
750 @echo " Displays the value of a given variable (here ALL)"
751 @echo " with only a single plus sign only the value is displayed"
753 @echo " is equivalent to make packages modules branches"
754 @echo " provides various info on these objects"
755 @echo "make ulogd-pkginfo"
756 @echo " Displays know attributes of a package"
757 @echo "make kernel-devel-rpminfo"
758 @echo " Displays know attributes of an rpm"
759 @echo "make stage1=true PLDISTROTAGS=planetlab-tags-4.2.mk packages modules branches module-tools"
760 @echo " Lists mentioned items - module-tools is used in modules.update"
762 @echo "********** Known pakages are"
765 #################### convenience, for debugging only
766 # make +foo : prints the value of $(foo)
767 # make ++foo : idem but verbose, i.e. foo=$(foo)
768 ++%: varname=$(subst +,,$@)
770 @echo "$(varname)=$($(varname))"
771 +%: varname=$(subst +,,$@)
773 @echo "$($(varname))"