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 # this is intended to denote local rpms, i.e. ones that are results of our own build
60 # stock rpms should be mentioned in config.planetlab/devel.pkgs
61 # (*) package-DEPEND-FILES
62 # a set of files that the package depends on - and that make needs to know about
63 # if this contains RPMS/yumgroups.xml, then the toplevel RPMS's index
64 # is refreshed with createrepo prior to running rpmbuild
65 # (*) package-RPMFLAGS: Miscellaneous RPM flags
66 # (*) package-RPMBUILD: If not rpmbuild - mostly used for sudo'ing rpmbuild
67 # (*) package-BUILD-FROM-SRPM: set this to any non-empty value, if your package is able to produce
68 # a source rpms by running 'make srpm'
69 # (*) package-RPMDATE: set this to any non-empty value to get the rpm package's release field hold the current date
70 # this is useful for container packages, like e.g. bootstrapfs or vserver, that contains much more than the
73 #################### modules
74 # Required information about the various modules (set this in e.g. planetlab-tags.mk)
77 # the complete path where this module lies;
78 # you can specify the trunk or a given tag with this variable
80 # OR if the module is managed under cvs (will be obsoleted)
85 #################### automatic variables
87 # the build defines some make variables that are extracted from spec files
89 # (*) $ make ulogd-pkginfo
90 # to see the list f variables attached to a given package
91 # (*) $ make kernel-devel-rpminfo
92 # to see the list of variables attached to a given rpm
96 # exported to spec files as plrelease
97 PLANETLAB_RELEASE = 4.2
102 # minimal compat with macos, just so this does not complain
103 HOSTARCH := $(shell uname -i 2> /dev/null || uname -m 2> /dev/null)
104 DISTRO := $(shell ./getdistro.sh)
105 RELEASE := $(shell ./getrelease.sh)
106 DISTRONAME := $(shell ./getdistroname.sh)
107 RPM-INSTALL-DEVEL := rpm --force -Uvh
108 # cannot force rpm -e
109 RPM-UNINSTALL-DEVEL := rpm -e
111 #################### Makefile
117 PLDISTRO := planetlab
119 export CVS_RSH := ssh
121 ########## pldistro.mk holds PLDISTRO - it is generated at stage1 (see below)
126 #################### include onelab.mk
127 # describes the set of components
128 PLDISTROCONTENTS := $(PLDISTRO).mk
129 include $(PLDISTROCONTENTS)
131 #################### include <pldistro>-tags.mk
132 # describes where to fetch components, and the related tags if using cvs
133 PLDISTROTAGS := $(PLDISTRO)-tags.mk
134 include $(PLDISTROTAGS)
136 # this used to be set in the -tags.mk files, but that turned out to require
137 # error-prone duplicate changes
138 # so now the nightly build script sets this to what it is currently using
139 # we set a default in case we run the build manually:
140 # if the local directory was svn checked out, then use the corresponding URL
141 svn-info-url-line := $(shell svn info 2> /dev/null | grep URL:)
142 default-build-SVNPATH := $(lastword $(svn-info-url-line))
143 # otherwise, use this hard-coded default
144 ifeq "$(default-build-SVNPATH)" ""
145 default-build-SVNPATH := http://svn.planet-lab.org/svn/build/trunk
147 # use default if necessary
148 build-SVNPATH ?= $(default-build-SVNPATH)
150 ########## stage1 and stage1iter
151 # extract specs and compute .mk files by running
153 # entering stage1, we compute all the spec files
154 # then we use stage1iter to compute the .mk iteratively,
155 # ensuring that the n-1 first makefiles are loaded when creating the n-th one
156 # when stage1iter is set, it is supposed to be an index (starting at 1) in $(ALL)
158 ALLMKS := $(foreach package, $(ALL), MAKE/$(package).mk)
160 ### stage1iter : need some arithmetic, see
161 # http://www.cmcrossroads.com/articles/ask-mr.-make/learning-gnu-make-functions-with-arithmetic.html
162 ifneq "$(stage1iter)" ""
163 # the first n packages
164 packages := $(wordlist 1,$(words $(stage1iter)),$(ALL))
166 package := $(word $(words $(packages)),$(packages))
167 # the n-1 first packages
168 stage1iter_1 := $(wordlist 2,$(words $(stage1iter)),$(stage1iter))
169 previous := $(wordlist 1,$(words $(stage1iter_1)),$(ALL))
170 previousmks := $(foreach package,$(previous),MAKE/$(package).mk)
171 include $(previousmks)
174 @echo "========== stage1iter : $(package)"
175 # @echo "stage1iter : included .mk files : $(previousmks)"
176 all: $($(package).specpath)
177 all: MAKE/$(package).mk
183 @echo "========== stage1"
186 # specs and makes are done sequentially by stage1iter
189 arg=""; for n in $(ALL) ; do arg="$$arg x"; $(MAKE) --no-print-directory stage1iter="$$arg"; done
192 ### once .mks are OK, you can run make normally
199 # mention $(ALL) here rather than rpms
200 # this is because the inter-package dependencies are expressed like
201 # util-vserver: util-python
207 ### yumgroups.xml : compute from all known .pkgs files
210 ./yumgroups.sh $(PLDISTRO) > $@
212 createrepo = createrepo --quiet -g yumgroups.xml RPMS/
214 repo: RPMS/yumgroups.xml
221 # * to make configuration easier, we always use the first module's
222 # definitions (CVSROOT,TAG, or SVNPATH) to extract the spec file
223 # * for the same reason, in case cvs is used, the first module name is added to
224 # $(package)-SPEC - otherwise the cvs modules have to define spec as
225 # <module>/<module>.spec while svn modules just define it as <module>.spec
227 define stage1_variables
228 $(1).spec = $(notdir $($(1)-SPEC))
229 $(1).specpath = SPECS/$(1).spec
230 $(1).module = $(firstword $($(1)-MODULES))
231 $(1)-SVNPATH = $(strip $($(1)-SVNPATH))
234 $(foreach package, $(ALL), $(eval $(call stage1_variables,$(package))))
237 # for each package, compute whether we need to set date
238 # the heuristic is that we mention the date as part of the rpm release flag if
239 # (*) the package has requested it by setting package-RPMDATE (container packages should do that)
240 # (*) or SVNPATH contains 'trunk' or 'branches'
242 define package_hasdate
243 $(1).has-date = $(if $($(1)-RPMDATE),yes, \
244 $(if $($($(1).module)-SVNPATH), \
245 $(if $(findstring /trunk,$($($(1).module)-SVNPATH)),yes, \
246 $(if $(findstring /branches,$($($(1).module)-SVNPATH)),yes,)), \
247 $(if $(findstring HEAD,$($($(1).module)-TAG)),yes,)))
250 $(foreach package, $(ALL), $(eval $(call package_hasdate,$(package))))
252 ### the common header for generated specfiles
253 # useful when trying new specfiles manually
255 (echo -n "# Generated by planetlab build from $($(1)-SPEC) on " ; date) > $@
256 echo "%define distro $(DISTRO)" >> $@
257 echo "%define distrorelease $(RELEASE)" >> $@
258 echo "%define distroname $(DISTRONAME)" >> $@
259 echo "%define pldistro $(PLDISTRO)" >> $@
260 echo "%define plrelease $(PLANETLAB_RELEASE)" >> $@
262 ### extract spec file from scm
264 $($(1).specpath): header.spec
266 cat header.spec > $($(1).specpath)
267 $(if $($(1).has-date),echo "%define date $(shell date +%Y.%m.%d)" >> $($(1).specpath),)
268 $(if $($(1)-SPECVARS), \
269 $(foreach line,$($(1)-SPECVARS), \
270 echo "%define" $(word 1,$(subst =, ,$(line))) "$(word 2,$(subst =, ,$(line)))" >> $($(1).specpath) ;))
271 echo "# included from $($(1)-SPEC)" >> $($(1).specpath)
272 $(if $($($(1).module)-SVNPATH),\
273 svn cat $($($(1).module)-SVNPATH)/$($(1)-SPEC) >> $($(1).specpath) || rm $($(1).specpath),\
274 cvs -d $($($(1).module)-CVSROOT) checkout \
275 -r $($($(1).module)-TAG) \
276 -p $($(1).module)/$($(1)-SPEC) >> $($(1).specpath))
279 $(foreach package,$(ALL),$(eval $(call target_spec,$(package))))
282 # Base rpmbuild in the current directory
283 # issues on fedora 8 : see the following posts
284 # http://forums.fedoraforum.org/showthread.php?t=39625 - and more specifically post#6
285 # https://www.redhat.com/archives/fedora-devel-list/2007-November/msg00171.html
287 FAKEROOT=/longbuildroot
288 PWD=$(shell /bin/pwd)
289 ifeq "$(PWD)" "$(REALROOT)"
290 export HOME := $(FAKEROOT)
292 export HOME := $(PWD)
295 ifeq "$(shell pwd)" "/build"
296 rm -f $(FAKEROOT) ; ln -s $(REALROOT) $(FAKEROOT)
299 echo "%_topdir $(HOME)" >> $@
300 echo "%_tmppath $(HOME)/tmp" >> $@
301 ./getrpmmacros.sh >> $@
303 ### this utility allows to extract various info from a spec file
304 ### and to define them in makefiles
305 spec2make: spec2make.c
306 $(CC) -g -Wall $< -o $@ -lrpm -lrpmbuild
308 ### run spec2make on the spec file and include the result
309 # usage: spec2make package
311 MAKE/$(1).mk: $($(1).specpath) spec2make .rpmmacros
313 ./spec2make $($(1)-RPMFLAGS) $($(1).specpath) $(1) > MAKE/$(1).mk || { rm MAKE/$(1).mk; exit 1; }
316 $(foreach package,$(ALL),$(eval $(call target_mk,$(package))))
318 # stores PLDISTRO in a file
319 # this is done at stage1. later run wont get confused
321 echo "PLDISTRO:=$(PLDISTRO)" > $@
322 echo "PLDISTROTAGS:=$(PLDISTROTAGS)" >> $@
324 savepldistro: pldistro.mk
327 # always refresh this
330 #################### regular make
332 define stage2_variables
333 ### devel dependencies
334 $(1).rpmbuild = $(if $($(1)-RPMBUILD),$($(1)-RPMBUILD),$(RPMBUILD)) $($(1)-RPMFLAGS)
335 $(1).all-devel-rpm-paths := $(foreach rpm,$($(1)-DEPEND-DEVEL-RPMS),$($(rpm).rpm-path))
336 $(1).depend-devel-packages := $(sort $(foreach rpm,$($(1)-DEPEND-DEVEL-RPMS),$($(rpm).package)))
337 ALL-DEVEL-RPMS += $($(1)-DEPEND-DEVEL-RPMS)
340 $(foreach package,$(ALL),$(eval $(call stage2_variables,$(package))))
341 ALL-DEVEL-RPMS := $(sort $(ALL-DEVEL-RPMS))
344 ### pack sources into tarballs
345 ALLTARBALLS:= $(foreach package, $(ALL), $($(package).tarballs))
346 tarballs: $(ALLTARBALLS)
347 @echo $(words $(ALLTARBALLS)) source tarballs OK
350 SOURCES/%.tar.bz2: SOURCES/%
351 tar chpjf $@ -C SOURCES $*
353 SOURCES/%.tar.gz: SOURCES/%
354 tar chpzf $@ -C SOURCES $*
356 SOURCES/%.tgz: SOURCES/%
357 tar chpzf $@ -C SOURCES $*
360 URLS/%: url=$(subst @colon@,:,$(subst @slash@,/,$(notdir $@)))
361 URLS/%: basename=$(notdir $(url))
363 echo curl $(url) -o SOURCES/$(basename)
366 ### the directory SOURCES/<package>-<version> is made
367 # with a copy -rl from CODEBASES/<package>
368 # the former is $(package.source) and the latter is $(package.codebase)
369 ALLSOURCES:=$(foreach package, $(ALL), $($(package).source))
370 # so that make does not use the rule below directly for creating the tarball files
371 .SECONDARY: $(ALLSOURCES)
373 sources: $(ALLSOURCES)
374 @echo $(words $(ALLSOURCES)) versioned source trees OK
377 define target_link_codebase_sources
378 $($(1).source): $($(1).codebase) ; mkdir -p SOURCES ; cp -rl $($(1).codebase) $($(1).source)
381 $(foreach package,$(ALL),$(eval $(call target_link_codebase_sources,$(package))))
383 ### codebase extraction
384 ALLCODEBASES:=$(foreach package, $(ALL), $($(package).codebase))
385 # so that make does not use the rule below directly for creating the tarball files
386 .SECONDARY: $(ALLCODEBASES)
388 codebases : $(ALLCODEBASES)
389 @echo $(words $(ALLCODEBASES)) codebase OK
393 # usage: extract_single_module package
394 define extract_single_module
396 $(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))
399 # usage: extract_multi_module package
400 define extract_multi_module
401 mkdir -p CODEBASES/$(1) && cd CODEBASES/$(1) && (\
402 $(foreach m,$($(1)-MODULES), $(if $($(m)-SVNPATH), svn export $($(m)-SVNPATH) $(m);, cvs -d $($(m)-CVSROOT) export -r $($(m)-TAG) $(m);)))
405 CODEBASES/%: package=$(notdir $@)
406 CODEBASES/%: multi_module=$(word 2,$($(package)-MODULES))
408 @(echo -n "XXXXXXXXXXXXXXX -- BEG CODEBASE $(package) : $@ " ; date)
409 $(if $(multi_module),\
410 $(call extract_multi_module,$(package)),\
411 $(call extract_single_module,$(package)))
412 @(echo -n "XXXXXXXXXXXXXXX -- END CODEBASE $(package) : $@ " ; date)
415 ALLSRPMS:=$(foreach package,$(ALL),$($(package).srpm))
417 @echo $(words $(ALLSRPMS)) source rpms OK
420 # usage: target_source_rpm package
421 # select upon the package name, whether it contains srpm or not
422 define target_source_rpm
423 ifeq "$($(1)-BUILD-FROM-SRPM)" ""
424 $($(1).srpm): $($(1).specpath) .rpmmacros $($(1).tarballs)
425 mkdir -p BUILD SRPMS tmp
426 @(echo -n "XXXXXXXXXXXXXXX -- BEG SRPM $(1) (using SOURCES) " ; date)
427 $(if $($(1).all-devel-rpm-paths), $(RPM-INSTALL-DEVEL) $($(1).all-devel-rpm-paths))
428 $($(1).rpmbuild) -bs $($(1).specpath)
429 $(if $($(1)-DEPEND-DEVEL-RPMS), $(RPM-UNINSTALL-DEVEL) $($(1)-DEPEND-DEVEL-RPMS))
430 @(echo -n "XXXXXXXXXXXXXXX -- END SRPM $(1) " ; date)
432 $($(1).srpm): $($(1).specpath) .rpmmacros $($(1).codebase)
433 mkdir -p BUILD SRPMS tmp
434 @(echo -n "XXXXXXXXXXXXXXX -- BEG SRPM $(1) (using make srpm) " ; date)
435 $(if $($(1).all-devel-rpm-paths), $(RPM-INSTALL-DEVEL) $($(1).all-devel-rpm-paths))
436 make -C $($(1).codebase) srpm SPECFILE=$(HOME)/$($(1).specpath) && \
437 rm -f SRPMS/$(notdir $($(1).srpm)) && \
438 ln $($(1).codebase)/$(notdir $($(1).srpm)) SRPMS/$(notdir $($(1).srpm))
439 $(if $($(1)-DEPEND-DEVEL-RPMS), $(RPM-UNINSTALL-DEVEL) $($(1)-DEPEND-DEVEL-RPMS))
440 @(echo -n "XXXXXXXXXXXXXXX -- END SRPM $(1) " ; date)
444 $(foreach package,$(ALL),$(eval $(call target_source_rpm,$(package))))
446 ### binary rpms are made from source rpm
447 ALLRPMS:=$(foreach package,$(ALL),$($(package).rpms))
448 # same as above, mention $(ALL) and not $(ALLRPMS)
450 @echo $(words $(ALLRPMS)) binary rpms OK
453 # use tmp dirs when building binary rpm so make remains idempotent
454 # otherwise SOURCES/ or SPEC gets touched again - which leads to rebuilding
455 RPM-USE-TMP-DIRS = --define "_sourcedir $(HOME)/tmp" --define "_specdir $(HOME)/tmp"
456 RPM-USE-COMPILE-DIRS = --define "_sourcedir $(HOME)/COMPILE" --define "_specdir $(HOME)/COMPILE"
458 # usage: build_binary_rpm package
459 # xxx hacky - invoke createrepo if DEPEND-FILES mentions RPMS/yumgroups.xml
460 define target_binary_rpm
461 $($(1).rpms): $($(1).srpm)
463 @(echo -n "XXXXXXXXXXXXXXX -- BEG RPM $(1) " ; date)
464 $(if $(findstring RPMS/yumgroups.xml,$($(1)-DEPEND-FILES)), $(createrepo) , )
465 $(if $($(1).all-devel-rpm-paths), $(RPM-INSTALL-DEVEL) $($(1).all-devel-rpm-paths))
466 $($(1).rpmbuild) --rebuild $(RPM-USE-TMP-DIRS) $($(1).srpm)
467 $(if $($(1)-DEPEND-DEVEL-RPMS), $(RPM-UNINSTALL-DEVEL) $($(1)-DEPEND-DEVEL-RPMS))
468 @(echo -n "XXXXXXXXXXXXXXX -- END RPM $(1) " ; date)
469 # for manual use only - in case we need to investigate the results of an rpmbuild
470 $(1)-compile: $($(1).srpm)
472 @(echo -n "XXXXXXXXXXXXXXX -- BEG compile $(1) " ; date)
473 $(if $(findstring RPMS/yumgroups.xml,$($(1)-DEPEND-FILES)), $(createrepo) , )
474 $(if $($(1).all-devel-rpm-paths), $(RPM-INSTALL-DEVEL) $($(1).all-devel-rpm-paths))
475 $($(1).rpmbuild) --recompile $(RPM-USE-TMP-DIRS) $($(1).srpm)
476 $(if $($(1)-DEPEND-DEVEL-RPMS), $(RPM-UNINSTALL-DEVEL) $($(1)-DEPEND-DEVEL-RPMS))
477 @(echo -n "XXXXXXXXXXXXXXX -- END compile $(1) " ; date)
481 $(foreach package,$(ALL),$(eval $(call target_binary_rpm,$(package))))
483 # e.g. make proper -> does propers rpms
484 # usage shorthand_target package
485 define target_shorthand
488 $(1)-spec: $($(1)-SPEC)
492 $(1)-tarball: $($(1).tarballs)
494 $(1)-codebase: $($(1).codebase)
496 $(1)-source: $($(1).source)
497 .PHONY: $(1)-codebase
498 $(1)-rpms: $($(1).rpms)
500 $(1)-srpm: $($(1).srpm)
504 $(foreach package,$(ALL),$(eval $(call target_shorthand,$(package))))
506 ### file dependencies
507 define package_depends_on_file
512 define target_dependfiles
513 $(foreach file,$($(1)-DEPEND-FILES),$(eval $(call package_depends_on_file,$(1),$(file))))
516 $(foreach package,$(ALL),$(eval $(call target_dependfiles,$(package))))
518 ### package dependencies
519 define package_depends_on_package
522 $($(1).srpm):$($(2).rpms)
525 define target_depends
526 $(foreach package,$($(1)-DEPEND-PACKAGES) $($(1).depend-devel-packages),$(eval $(call package_depends_on_package,$(1),$(package))))
529 $(foreach package,$(ALL),$(eval $(call target_depends,$(package))))
532 # usage: target_clean package
535 rm -rf $($(1).codebase)
536 .PHONY: $(1)-clean-codebase
537 CLEANS += $(1)-clean-codebase
539 rm -rf $($(1).source)
540 .PHONY: $(1)-clean-source
541 CLEANS += $(1)-clean-source
543 rm -rf $($(1).tarballs)
544 .PHONY: $(1)-clean-tarball
545 CLEANS += $(1)-clean-tarball
547 rm -rf BUILD/$(notdir $($(1).source))
548 CLEANS += $(1)-clean-build
551 .PHONY: $(1)-clean-rpms
552 CLEANS += $(1)-clean-rpms
555 .PHONY: $(1)-clean-srpm
556 CLEANS += $(1)-clean-srpm
557 $(1)-codeclean: $(1)-clean-source $(1)-clean-tarball $(1)-clean-build $(1)-clean-rpms $(1)-clean-srpm
558 $(1)-clean: $(1)-clean-codebase $(1)-codeclean
559 .PHONY: $(1)-codeclean $(1)-clean
561 rm -rf $($(1).specpath)
562 .PHONY: $(1)-clean-spec
565 .PHONY: $(1)-clean-make
566 $(1)-distclean: $(1)-distclean1 $(1)-distclean2
567 $(1)-distclean1: $(1)-clean-spec $(1)-clean-make
568 $(1)-distclean2: $(1)-clean
569 .PHONY: $(1)-distclean $(1)-distclean1 $(1)-distclean2
572 $(foreach package,$(ALL),$(eval $(call target_clean,$(package))))
580 @echo Available clean targets
583 ### brute force clean
585 rm -rf pldistro.mk .rpmmacros spec2make header.spec SPECS MAKE
587 rm -rf CODEBASES SOURCES BUILD RPMS SRPMS tmp
588 distclean: distclean1 distclean2
589 .PHONY: distclean1 distclean2 distclean
592 $(RPM-UNINSTALL-DEVEL) $(ALL-DEVEL-RPMS)
595 # gather build information for the 'About' page
596 # when run from crontab, INIT_CWD not properly set (says /root ..)
597 # so, the nightly build passes NIGHTLY_BASE here
598 # also store the nightly_base in .base for any post-processing purposes
600 @echo 'Creating myplc-release'
602 echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx build info" >> $@
603 $(MAKE) --no-print-directory version-build >> $@
604 echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx svn info" >> $@
605 $(MAKE) --no-print-directory version-svns >> $@
606 echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx rpm info" >> $@
607 $(MAKE) --no-print-directory version-rpms >> $@
608 @echo $(NIGHTLY_BASE) > .base
611 @echo -n 'Build build-date: ' ; date '+%Y.%m.%d'
612 @echo -n 'Build build-time: ' ; date '+%H:%M-%Z'
613 @echo -n 'Build build-hostname: ' ; hostname
614 @echo "Build build-base: $(NIGHTLY_BASE)"
615 @echo "Build planetlab-distro: $(PLDISTRO)"
616 @echo "Build planetlab-tags: $(PLDISTROTAGS)"
617 @echo -n 'Build planetlab-tagsid: ' ; fgrep '$$''Id' $(PLDISTROTAGS)
618 @echo "Build target-arch: $(HOSTARCH)"
619 @echo "Build target-distro: $(DISTRO)"
620 @echo "Build target-distroname: $(DISTRONAME)"
621 @echo "Build target-release: $(RELEASE)"
622 @echo "Build target-personality: $(NIGHTLY_PERSONALITY)"
626 VFORMAT="%30s := %s\n"
627 define svn_version_target
629 @$(if $($(1)-SVNPATH),\
630 printf $(VFORMAT) $(1)-SVNPATH "$($(1)-SVNPATH)",\
631 printf $(VFORMAT) $(1)-CVSROOT "$($(1)-CVSROOT)" ; printf $(VFORMAT) $(1)-TAG "$($(1)-TAG)")
634 # compute all modules
636 $(foreach package,$(ALL), $(eval ALL-MODULES+=$($(package)-MODULES)))
637 ALL-MODULES:=$(sort $(ALL-MODULES))
639 $(foreach module,$(ALL-MODULES), $(eval $(call svn_version_target,$(module))))
641 version-svns: $(foreach module, $(ALL-MODULES), $(module)-version-svn)
643 RFORMAT="%20s :: version=%s release=%s\n"
644 define rpm_version_target
646 @printf $(RFORMAT) $($(1).rpm-name) $($(1).rpm-version) $($(1).rpm-release)
647 version-rpms: $(1)-version-rpm
650 $(foreach package,$(sort $(ALL)), $(eval $(call rpm_version_target,$(package))))
652 versions: myplc-release version-build version-svns version-rpms
653 .PHONY: versions version-build version-rpms version-svns
655 #################### package info
656 PKGKEYS := tarballs source codebase srpm rpms rpmnames rpm-release rpm-name rpm-version rpm-subversion
657 %-pkginfo: package=$(subst -pkginfo,,$@)
659 @$(foreach key,$(PKGKEYS),echo "$(package).$(key)=$($(package).$(key))";)
661 RPMKEYS := rpm-path package
662 %-rpminfo: rpm=$(subst -rpminfo,,$@)
664 @$(foreach key,$(RPMKEYS),echo "$(rpm).$(key)=$($(rpm).$(key))";)
666 #################### various lists - designed to run with stage1=true
668 @$(foreach package,$(ALL), echo package=$(package) ref_module=$($(package).module) modules=$($(package)-MODULES) rpmnames=$($(package).rpmnames); )
671 @$(foreach module,$(ALL-MODULES), echo module=$(module) svnpath=$($(module)-SVNPATH); )
674 @$(foreach module,$(ALL-MODULES), \
675 $(if $($(module)-SVNBRANCH),echo module=$(module) branch=$($(module)-SVNBRANCH);))
678 @$(foreach module,$(ALL-MODULES), \
679 $(if $($(module)-SVNPATH), \
680 $(if $($(module)-SVNBRANCH), \
681 echo $(module):$($(module)-SVNBRANCH); , \
684 info: packages modules branches
686 .PHONY: info packages modules branches module-tools
690 @$(if $(TESTS_SVNPATH), echo $(TESTS_SVNPATH) > $@, \
691 echo "http://svn.planet-lab.org/svn/tests/trunk" > $@)
695 @echo "********** Run make in two stages:"
697 @echo "make stage1=true PLDISTRO=onelab"
698 @echo " -> extracts all spec files in SPECS/ and mk files in MAKE/"
699 @echo " as well as save PLDISTRO for subsequent runs"
701 @echo "********** Then you can use the following targets"
703 @echo " rebuilds everything"
704 @echo 'make util-vserver'
705 @echo " makes the RPMS related to util-vserver"
706 @echo " equivalent to 'make util-vserver-rpms'"
708 @echo "********** Or, vertically - step-by-step for a given package"
709 @echo 'make util-vserver-codebase'
710 @echo " performs codebase extraction in CODEBASES/util-vserver"
711 @echo 'make util-vserver-source'
712 @echo " creates source link in SOURCES/util-vserver-<version>"
713 @echo 'make util-vserver-tarball'
714 @echo " creates source tarball in SOURCES/util-vserver-<version>.<tarextension>"
715 @echo 'make util-vserver-srpm'
716 @echo " build source rpm in SRPMS/"
717 @echo 'make util-vserver-rpms'
718 @echo " build rpm(s) in RPMS/"
720 @echo "********** Or, horizontally, reach a step for all known packages"
721 @echo 'make codebases'
723 @echo 'make tarballs'
727 @echo "********** Manual targets"
728 @echo "make package-compile"
729 @echo " The regular process uses rpmbuild --rebuild, that performs"
730 @echo " a compilation directory cleanup upon completion. If you need to investigate"
731 @echo " the intermediate compilation directory, use the -compile targets"
732 @echo "********** Cleaning examples"
734 @echo " removes the files made by make"
735 @echo "make distclean"
736 @echo " brute-force cleaning, removes entire directories - requires a new stage1"
737 @echo "make develclean"
738 @echo " rpm-uninstalls all devel packages installed during build"
740 @echo "make iptables-distclean"
741 @echo " deep clean for a given package"
742 @echo "make iptables-codeclean"
743 @echo " run this if you've made a change in the CODEBASES area for iptables"
745 @echo "make util-vserver-clean"
746 @echo " removes codebase, source, tarball, build, rpm and srpm for util-vserver"
747 @echo "make util-vserver-clean-codebase"
748 @echo " and so on for source, tarball, build, rpm and srpm"
750 @echo "********** Info examples"
752 @echo " Displays the value of a given variable (here ALL)"
753 @echo " with only a single plus sign only the value is displayed"
755 @echo " is equivalent to make packages modules branches"
756 @echo " provides various info on these objects"
757 @echo "make ulogd-pkginfo"
758 @echo " Displays know attributes of a package"
759 @echo "make kernel-devel-rpminfo"
760 @echo " Displays know attributes of an rpm"
761 @echo "make stage1=true PLDISTROTAGS=planetlab-tags-4.2.mk packages modules branches module-tools"
762 @echo " Lists mentioned items - module-tools is used in modules.update"
764 @echo "********** Known pakages are"
767 #################### convenience, for debugging only
768 # make +foo : prints the value of $(foo)
769 # make ++foo : idem but verbose, i.e. foo=$(foo)
770 ++%: varname=$(subst +,,$@)
772 @echo "$(varname)=$($(varname))"
773 +%: varname=$(subst +,,$@)
775 @echo "$($(varname))"