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 # (*) the default distribution is called 'planetlab'
25 # (*) you may define an alternative distribution, e.g. onelab
26 # in this case you need to
27 # (*) create onelab.mk that defines your *packages* (see below)
28 # (*) create onelab-tags.mk that defines where to fetch your *modules*
29 # (*) create your main yumgroups.xml as groups/<distro>.xml
30 # (*) there are also various places where a set of modules are defined.
31 # check for .lst files in the various modules that build root images
32 # and mimic what's done for planetlab
33 # (*) then you need to run
34 # make stage1=true PLDISTRO=onelab
37 # This build deals with 3 kinds of objects
39 # (*) packages are named upon the RPM name; they are mostly lowercase
40 # Add a package to ALL if you want it built as part of the default set.
41 # (*) modules are named after the subversion tree; as of this writing their names
42 # are mostly mixed case like MyPLC or VserverReference
43 # (*) rpms are named in the spec files. A package typically defines several rpms;
44 # rpms are used for defining DEPEND-DEVEL-RPMS. See also package.rpmnames
46 #################### packages
47 # basics: how to build a package - you need/may define the following variables
50 # a package needs one or several modules to build.
53 # the package's specfile; this is relative to the FIRST module in package-MODULES
54 # see 'codebase' below
58 # (*) package-SPECVARS
59 # space-separated list of spec variable definitions, where you can reference make variable that relate to
60 # packages defined BEFORE the current one (note: you should use = - as opposed to := - to define these)
61 # e.g. mydriver-SPECVARS = foo=$(kernel-rpm-release)
62 # would let you use the %release from the kernel's package when rpmbuild'ing mydriver - see automatic below
63 # (*) package-DEPEND-PACKAGES
64 # a set of *packages* that this package depends on
65 # (*) package-DEPEND-DEVEL-RPMS
66 # a set of *rpms* that the build will rpm-install before building <package>
67 # (*) package-DEPEND-FILES
68 # a set of files that the package depends on - and that make needs to know about
69 # if this contains RPMS/yumgroups.xml, then the toplevel RPMS's index
70 # is refreshed with createrepo prior to running rpmbuild
71 # (*) package-RPMFLAGS: Miscellaneous RPM flags
72 # (*) package-RPMBUILD: If not rpmbuild - mostly used for sudo'ing rpmbuild
74 #################### modules
75 # Required information about the various modules (set this in e.g. planetlab-tags.mk)
78 # the complete path where this module lies;
79 # you can specify the trunk or a given tag with this variable
81 # OR if the module is managed under cvs (will be obsoleted)
86 #################### automatic variables
88 # the build defines some make variables that are extracted from spec files
90 # (*) $ make ulogd.pkginfo
91 # to see the list f variables attached to a given package
92 # (*) $ make kernel-devel.rpminfo
93 # to see the list f variables attached to a given rpm
100 HOSTARCH := $(shell uname -i)
101 DISTRO := $(shell ./getdistro.sh)
102 RELEASE := $(shell ./getrelease.sh)
103 RPM-INSTALL-DEVEL := rpm --force -Uvh
104 # cannot force rpm -e
105 RPM-UNINSTALL-DEVEL := rpm -e
107 #################### Makefile
113 PLDISTRO := planetlab
115 export CVS_RSH := ssh
117 ########## pldistro.mk holds PLDISTRO - it is generated at stage1 (see below)
122 #################### include onelab.mk
123 # describes the set of components
124 PLDISTROCONTENTS := $(PLDISTRO).mk
125 include $(PLDISTROCONTENTS)
127 #################### include <pldistro>-tags.mk
128 # describes where to fetch components, and the related tags if using cvs
129 PLDISTROTAGS := $(PLDISTRO)-tags.mk
130 include $(PLDISTROTAGS)
132 ########## stage1 and stage1iter
133 # extract specs and compute .mk files by running
135 # entering stage1, we compute all the spec files
136 # then we use stage1iter to compute the .mk iteratively,
137 # ensuring that the n-1 first makefiles are loaded when creating the n-th one
138 # when stage1iter is set, it is supposed to be an index (starting at 1) in $(ALL)
140 ALLMKS := $(foreach package, $(ALL), MAKE/$(package).mk)
142 ### stage1iter : need some arithmetic, see
143 # http://www.cmcrossroads.com/articles/ask-mr.-make/learning-gnu-make-functions-with-arithmetic.html
144 ifneq "$(stage1iter)" ""
145 # the first n packages
146 packages := $(wordlist 1,$(words $(stage1iter)),$(ALL))
148 package := $(word $(words $(packages)),$(packages))
149 # the n-1 first packages
150 stage1iter_1 := $(wordlist 2,$(words $(stage1iter)),$(stage1iter))
151 previous := $(wordlist 1,$(words $(stage1iter_1)),$(ALL))
152 previousmks := $(foreach package,$(previous),MAKE/$(package).mk)
153 include $(previousmks)
156 @echo "========== stage1iter : $(package)"
157 # @echo "stage1iter : included .mk files : $(previousmks)"
158 all: $($(package).specpath)
159 all: MAKE/$(package).mk
165 @echo "========== stage1"
168 # specs and makes are done sequentially by stage1iter
171 arg=""; for n in $(ALL) ; do arg="$$arg x"; $(MAKE) --no-print-directory stage1iter="$$arg"; done
174 ### once .mks are OK, you can run make normally
181 # mention $(ALL) here rather than rpms
182 # this is because the inter-package dependencies are expressed like
183 # util-vserver: util-python
190 # gather build information for the 'About' page
192 @echo 'Creating myplc-release'
194 (echo -n 'Build bdate: ' ; date '+%Y.%m.%d') >> $@
195 (echo -n 'Build btime: ' ; date '+%H:%M') >> $@
196 (echo -n 'Build hostname: ' ; hostname) >> $@
197 (echo -n 'Build location: ' ; pwd) >> $@
198 (echo -n 'Build tags file: ' ; fgrep '$$''Id' $(PLDISTROTAGS)) >> $@
199 echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx modules versions info" >> $@
200 $(MAKE) --no-print-directory versions >> $@
205 YUMGROUPS := groups/$(PLDISTRO).xml
208 RPMS/yumgroups.xml: $(YUMGROUPS)
210 install -D -m 644 $(YUMGROUPS) $@
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/$(notdir $($(1)-SPEC))
230 $(1).module = $(firstword $($(1)-MODULES))
233 $(foreach package, $(ALL), $(eval $(call stage1_variables,$(package))))
236 # for each package, compute whether we need to set date (i.e. whether we use the trunk)
237 # the myplc package is forced to have a date, because it is more convenient
238 # (we cannot bump its number everytime something changes in the system)
239 # myplc-native does not need this trick
241 define package_hasdate
242 $(1).has-date = $(if $(subst myplc,,$(1)), \
243 $(if $($(1)-SVNPATH),\
244 $(if $(findstring /trunk,$($(1)-SVNPATH)),yes,),\
245 $(if $(findstring HEAD,$($(1)-TAG)),yes,)), \
249 $(foreach package, $(ALL), $(eval $(call package_hasdate,$(package))))
251 ### extract spec file from scm
255 (echo -n "# Generated by planetlab build from $($(1)-SPEC) on " ; date) > $($(1).specpath)
256 echo "%define distroname $(DISTRO)" >> $($(1).specpath)
257 echo "%define distrorelease $(RELEASE)" >> $($(1).specpath)
258 echo "%define pldistro $(PLDISTRO)" >> $($(1).specpath)
259 $(if $($(1).has-date),echo "%define date $(shell date +%Y.%m.%d)" >> $($(1).specpath),)
260 $(if $($(1)-SPECVARS), \
261 $(foreach line,$($(1)-SPECVARS), \
262 echo "%define" $(word 1,$(subst =, ,$(line))) "$(word 2,$(subst =, ,$(line)))" >> $($(1).specpath) ;))
263 echo "# included from codebase specfile" >> $($(1).specpath)
264 $(if $($($(1).module)-SVNPATH),\
265 svn cat $($($(1).module)-SVNPATH)/$($(1)-SPEC) >> $($(1).specpath) || rm $($(1).specpath),\
266 cvs -d $($($(1).module)-CVSROOT) checkout \
267 -r $($($(1).module)-TAG) \
268 -p $($(1).module)/$($(1)-SPEC) >> $($(1).specpath))
271 $(foreach package,$(ALL),$(eval $(call target_spec,$(package))))
274 # Base rpmbuild in the current directory
275 # issues on fedora 8 : see the following posts
276 # http://forums.fedoraforum.org/showthread.php?t=39625 - and more specifically post#6
277 # https://www.redhat.com/archives/fedora-devel-list/2007-November/msg00171.html
279 FAKEROOT=/longbuildroot
280 PWD=$(shell /bin/pwd)
281 ifeq "$(PWD)" "$(REALROOT)"
282 export HOME := $(FAKEROOT)
284 export HOME := $(PWD)
287 ifeq "$(shell pwd)" "/build"
288 rm -f $(FAKEROOT) ; ln -s $(REALROOT) $(FAKEROOT)
291 echo "%_topdir $(HOME)" >> $@
292 echo "%_tmppath $(HOME)/tmp" >> $@
293 echo "%_netsharedpath /proc:/dev/pts" >> $@
294 echo "%_install_langs C:de:en:es:fr" >> $@
295 echo "%_excludedocs yes" >> $@
297 ### this utility allows to extract various info from a spec file
298 ### and to define them in makefiles
299 spec2make: spec2make.c
300 $(CC) -g -Wall $< -o $@ -lrpm -lrpmbuild
302 ### run spec2make on the spec file and include the result
303 # usage: spec2make package
305 MAKE/$(1).mk: $($(1).specpath) spec2make .rpmmacros
307 ./spec2make $($(1)-RPMFLAGS) $($(1).specpath) $(1) > MAKE/$(1).mk
308 @if [ -z MAKE/$(1).mk ] ; then rm MAKE/$(1).mk ; exit 1 ; fi
311 $(foreach package,$(ALL),$(eval $(call target_mk,$(package))))
313 # stores PLDISTRO in a file
314 # this is done at stage1. later run wont get confused
316 echo "PLDISTRO:=$(PLDISTRO)" > $@
317 echo "PLDISTROTAGS:=$(PLDISTROTAGS)" >> $@
319 savepldistro: pldistro.mk
322 # always refresh this
325 #################### regular make
327 define stage2_variables
328 ### devel dependencies
329 $(1).rpmbuild = $(if $($(1)-RPMBUILD),$($(1)-RPMBUILD),$(RPMBUILD)) $($(1)-RPMFLAGS)
330 $(1).all-devel-rpm-paths := $(foreach rpm,$($(1)-DEPEND-DEVEL-RPMS),$($(rpm).rpm-path))
331 $(1).depend-devel-packages := $(sort $(foreach rpm,$($(1)-DEPEND-DEVEL-RPMS),$($(rpm).package)))
332 ALL-DEVEL-RPMS += $($(1)-DEPEND-DEVEL-RPMS)
335 $(foreach package,$(ALL),$(eval $(call stage2_variables,$(package))))
336 ALL-DEVEL-RPMS := $(sort $(ALL-DEVEL-RPMS))
339 ### pack sources into tarballs
340 ALLTARBALLS:= $(foreach package, $(ALL), $($(package).tarballs))
341 tarballs: $(ALLTARBALLS)
342 @echo $(words $(ALLTARBALLS)) source tarballs OK
345 SOURCES/%.tar.bz2: SOURCES/%
346 tar chpjf $@ -C SOURCES $*
348 SOURCES/%.tar.gz: SOURCES/%
349 tar chpzf $@ -C SOURCES $*
351 SOURCES/%.tgz: SOURCES/%
352 tar chpzf $@ -C SOURCES $*
355 URLS/%: url=$(subst @colon@,:,$(subst @slash@,/,$(notdir $@)))
356 URLS/%: basename=$(notdir $(url))
358 echo curl $(url) -o SOURCES/$(basename)
361 ### the directory SOURCES/<package>-<version> is made
362 # with a copy -rl from CODEBASES/<package>
363 # the former is $(package.source) and the latter is $(package.codebase)
364 ALLSOURCES:=$(foreach package, $(ALL), $($(package).source))
365 # so that make does not use the rule below directly for creating the tarball files
366 .SECONDARY: $(ALLSOURCES)
368 sources: $(ALLSOURCES)
369 @echo $(words $(ALLSOURCES)) versioned source trees OK
372 define target_link_codebase_sources
373 $($(1).source): $($(1).codebase) ; mkdir -p SOURCES ; cp -rl $($(1).codebase) $($(1).source)
376 $(foreach package,$(ALL),$(eval $(call target_link_codebase_sources,$(package))))
378 ### codebase extraction
379 ALLCODEBASES:=$(foreach package, $(ALL), $($(package).codebase))
380 # so that make does not use the rule below directly for creating the tarball files
381 .SECONDARY: $(ALLCODEBASES)
383 codebases : $(ALLCODEBASES)
384 @echo $(words $(ALLCODEBASES)) codebase OK
388 # usage: extract_single_module package
389 define extract_single_module
391 $(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))
394 # usage: extract_multi_module package
395 define extract_multi_module
396 mkdir -p CODEBASES/$(1) && cd CODEBASES/$(1) && (\
397 $(foreach m,$($(1)-MODULES), $(if $($(m)-SVNPATH), svn export $($(m)-SVNPATH) $(m);, cvs -d $($(m)-CVSROOT) export -r $($(m)-TAG) $(m);)))
400 CODEBASES/%: package=$(notdir $@)
401 CODEBASES/%: multi_module=$(word 2,$($(package)-MODULES))
403 @(echo -n "XXXXXXXXXXXXXXX -- BEG CODEBASE $(package) : $@ " ; date)
404 $(if $(multi_module),\
405 $(call extract_multi_module,$(package)),\
406 $(call extract_single_module,$(package)))
407 @(echo -n "XXXXXXXXXXXXXXX -- END CODEBASE $(package) : $@ " ; date)
410 ALLSRPMS:=$(foreach package,$(ALL),$($(package).srpm))
412 @echo $(words $(ALLSRPMS)) source rpms OK
415 # usage: target_source_rpm package
416 # select upon the package name, whether it contains srpm or not
417 define target_source_rpm
418 ifeq "$(subst srpm,,$(1))" "$(1)"
419 $($(1).srpm): $($(1).specpath) .rpmmacros $($(1).tarballs)
420 mkdir -p BUILD SRPMS tmp
421 @(echo -n "XXXXXXXXXXXXXXX -- BEG SRPM $(1) (using SOURCES) " ; date)
422 $(if $($(1).all-devel-rpm-paths), $(RPM-INSTALL-DEVEL) $($(1).all-devel-rpm-paths))
423 $($(1).rpmbuild) -bs $($(1).specpath)
424 $(if $($(1)-DEPEND-DEVEL-RPMS), $(RPM-UNINSTALL-DEVEL) $($(1)-DEPEND-DEVEL-RPMS))
425 @(echo -n "XXXXXXXXXXXXXXX -- END SRPM $(1) " ; date)
427 $($(1).srpm): $($(1).specpath) .rpmmacros $($(1).codebase)
428 mkdir -p BUILD SRPMS tmp
429 @(echo -n "XXXXXXXXXXXXXXX -- BEG SRPM $(1) (using make srpm) " ; date)
430 $(if $($(1).all-devel-rpm-paths), $(RPM-INSTALL-DEVEL) $($(1).all-devel-rpm-paths))
431 make -C $($(1).codebase) srpm && \
432 rm -f SRPMS/$(notdir $($(1).srpm)) && \
433 ln $($(1).codebase)/$(notdir $($(1).srpm)) SRPMS/$(notdir $($(1).srpm))
434 $(if $($(1)-DEPEND-DEVEL-RPMS), $(RPM-UNINSTALL-DEVEL) $($(1)-DEPEND-DEVEL-RPMS))
435 @(echo -n "XXXXXXXXXXXXXXX -- END SRPM $(1) " ; date)
439 $(foreach package,$(ALL),$(eval $(call target_source_rpm,$(package))))
441 ### binary rpms are made from source rpm
442 ALLRPMS:=$(foreach package,$(ALL),$($(package).rpms))
443 # same as above, mention $(ALL) and not $(ALLRPMS)
445 @echo $(words $(ALLRPMS)) binary rpms OK
448 # use tmp dirs when building binary rpm so make remains idempotent
449 # otherwise SOURCES/ or SPEC gets touched again - which leads to rebuilding
450 RPM-USE-TMP-DIRS = --define "_sourcedir $(HOME)/tmp" --define "_specdir $(HOME)/tmp"
452 # usage: build_binary_rpm package
453 # xxx hacky - invoke createrepo if DEPEND-FILES mentions RPMS/yumgroups.xml
454 define target_binary_rpm
455 $($(1).rpms): $($(1).srpm)
456 mkdir -p BUILD RPMS tmp
457 @(echo -n "XXXXXXXXXXXXXXX -- BEG RPM $(1) " ; date)
458 $(if $(findstring RPMS/yumgroups.xml,$($(1)-DEPEND-FILES)), $(createrepo) , )
459 $(if $($(1).all-devel-rpm-paths), $(RPM-INSTALL-DEVEL) $($(1).all-devel-rpm-paths))
460 $($(1).rpmbuild) --rebuild $(RPM-USE-TMP-DIRS) $($(1).srpm)
461 $(if $($(1)-DEPEND-DEVEL-RPMS), $(RPM-UNINSTALL-DEVEL) $($(1)-DEPEND-DEVEL-RPMS))
462 @(echo -n "XXXXXXXXXXXXXXX -- END RPM $(1) " ; date)
465 $(foreach package,$(ALL),$(eval $(call target_binary_rpm,$(package))))
468 # e.g. make proper -> does propers rpms
469 # usage shorthand_target package
470 define target_shorthand
471 $(1): $($(package).rpms)
473 $(1)-spec: $($(package)-SPEC)
475 $(1)-mk: $($(package)-MK)
477 $(1)-tarball: $($(package).tarballs)
479 $(1)-codebase: $($(package).codebase)
481 $(1)-source: $($(package).source)
482 .PHONY: $(1)-codebase
483 $(1)-rpms: $($(package).rpms)
485 $(1)-srpm: $($(package).srpm)
489 $(foreach package,$(ALL),$(eval $(call target_shorthand,$(package))))
491 ### file dependencies
492 define package_depends_on_file
497 define target_dependfiles
498 $(foreach file,$($(1)-DEPEND-FILES),$(eval $(call package_depends_on_file,$(1),$(file))))
501 $(foreach package,$(ALL),$(eval $(call target_dependfiles,$(package))))
503 ### package dependencies
504 define package_depends_on_package
507 $($(1).srpm):$($(2).rpms)
510 define target_depends
511 $(foreach package,$($(1)-DEPEND-PACKAGES) $($(1).depend-devel-packages),$(eval $(call package_depends_on_package,$(1),$(package))))
514 $(foreach package,$(ALL),$(eval $(call target_depends,$(package))))
517 # usage: target_clean package
520 rm -rf $($(1).codebase)
521 .PHONY: $(1)-clean-codebase
522 CLEANS += $(1)-clean-codebase
524 rm -rf $($(1).source)
525 .PHONY: $(1)-clean-source
526 CLEANS += $(1)-clean-source
528 rm -rf $($(1).tarballs)
529 .PHONY: $(1)-clean-tarball
530 CLEANS += $(1)-clean-tarball
532 rm -rf BUILD/$(notdir $($(1).source))
533 CLEANS += $(1)-clean-build
536 .PHONY: $(1)-clean-rpms
537 CLEANS += $(1)-clean-rpms
540 .PHONY: $(1)-clean-srpm
541 CLEANS += $(1)-clean-srpm
542 $(1)-codeclean: $(1)-clean-source $(1)-clean-tarball $(1)-clean-build $(1)-clean-rpms $(1)-clean-srpm
543 $(1)-clean: $(1)-clean-codebase $(1)-codeclean
544 .PHONY: $(1)-codeclean $(1)-clean
546 rm -rf $($(1).specpath)
547 .PHONY: $(1)-clean-spec
550 .PHONY: $(1)-clean-make
551 $(1)-distclean: $(1)-distclean1 $(1)-distclean2
552 $(1)-distclean1: $(1)-clean-spec $(1)-clean-make
553 $(1)-distclean2: $(1)-clean
554 .PHONY: $(1)-distclean $(1)-distclean1 $(1)-distclean2
557 $(foreach package,$(ALL),$(eval $(call target_clean,$(package))))
565 @echo Available clean targets
568 ### brute force clean
570 rm -rf pldistro.mk .rpmmacros spec2make SPECS MAKE
572 rm -rf CODEBASES SOURCES BUILD RPMS SRPMS tmp
573 distclean: distclean1 distclean2
574 .PHONY: distclean1 distclean2 distclean
577 $(RPM-UNINSTALL-DEVEL) $(ALL-DEVEL-RPMS)
579 # xxx tmp - I cannot use this on my mac for local testing
580 ISMACOS=$(findstring Darwin,$(shell uname))
581 ifneq "$(ISMACOS)" ""
582 #################### produce reliable version information
584 VFORMAT="%30s := %s\n"
587 @$(if $($(1)-SVNPATH),\
588 printf $(VFORMAT) $(1)-SVNPATH "$($(1)-SVNPATH)",\
589 printf $(VFORMAT) $(1)-CVSROOT "$($(1)-CVSROOT)" ; printf $(VFORMAT) $(1)-TAG "$($(1)-TAG)")
592 # compute all modules
594 $(foreach package,$(ALL), $(eval ALL-MODULES+=$($(package)-MODULES)))
595 ALL-MODULES:=$(sort $(ALL-MODULES))
597 $(foreach module,$(ALL-MODULES), $(eval $(call print_version,$(module))))
599 versions: $(foreach module, $(ALL-MODULES), $(module)-version)
602 @echo "warning : the 'versions' target is not supported on macos"
605 #################### include install Makefile
606 # the default is to use the distro-dependent install file
607 # however the main distro file can redefine PLDISTROINSTALL
608 ifndef PLDISTROINSTALL
609 PLDISTROINSTALL := $(PLDISTRO)-install.mk
612 -include $(PLDISTROINSTALL)
616 @echo "********** Run make in two stages:"
618 @echo "make stage1=true PLDISTRO=onelab"
619 @echo " -> extracts all spec files in SPECS/ and mk files in MAKE/"
620 @echo " as well as save PLDISTRO for subsequent runs"
622 @echo "********** Then you can use the following targets"
624 @echo " rebuilds everything"
625 @echo 'make util-vserver'
626 @echo " makes the RPMS related to util-vserver"
627 @echo " equivalent to 'make util-vserver-rpms'"
629 @echo "********** Or, vertically - step-by-step for a given package"
630 @echo 'make util-vserver-codebase'
631 @echo " performs codebase extraction in CODEBASES/util-vserver"
632 @echo 'make util-vserver-source'
633 @echo " creates source link in SOURCES/util-vserver-<version>"
634 @echo 'make util-vserver-tarball'
635 @echo " creates source tarball in SOURCES/util-vserver-<version>.<tarextension>"
636 @echo 'make util-vserver-srpm'
637 @echo " build source rpm in SRPMS/"
638 @echo 'make util-vserver-rpms'
639 @echo " build rpm(s) in RPMS/"
641 @echo "********** Or, horizontally, reach a step for all known packages"
642 @echo 'make codebases'
644 @echo 'make tarballs'
648 @echo "********** Cleaning examples"
650 @echo " removes the files made by make"
651 @echo "make distclean"
652 @echo " brute-force cleaning, removes entire directories - requires a new stage1"
653 @echo "make develclean"
654 @echo " rpm-uninstalls all devel packages installed during build"
656 @echo "make iptables-distclean"
657 @echo " deep clean for a given package"
658 @echo "make iptables-codeclean"
659 @echo " run this if you've made a change in the CODEBASES area for iptables"
661 @echo "make util-vserver-clean"
662 @echo " removes codebase, source, tarball, build, rpm and srpm for util-vserver"
663 @echo "make util-vserver-clean-codebase"
664 @echo " and so on for source, tarball, build, rpm and srpm"
666 @echo "********** Info examples"
668 @echo " Displays the value of a given variable (here ALL)"
669 @echo " with only a single plus sign only the value is displayed"
670 @echo "make ulogd.pkginfo"
671 @echo " Displays know attributes of a package"
672 @echo "make kernel-devel.rpminfo"
673 @echo " Displays know attributes of an rpm"
675 @echo "********** Known pakages are"
678 #################### convenience, for debugging only
679 # make +foo : prints the value of $(foo)
680 # make ++foo : idem but verbose, i.e. foo=$(foo)
681 ++%: varname=$(subst +,,$@)
683 @echo "$(varname)=$($(varname))"
684 +%: varname=$(subst +,,$@)
686 @echo "$($(varname))"
688 PKGKEYS := tarballs source codebase srpm rpms rpmnames rpm-release rpm-name rpm-version rpm-subversion
689 %.pkginfo: package=$(subst .pkginfo,,$@)
691 @$(foreach key,$(PKGKEYS),echo "$(package).$(key)=$($(package).$(key))";)
693 RPMKEYS := rpm-path package
694 %.rpminfo: rpm=$(subst .rpminfo,,$@)
696 @$(foreach key,$(RPMKEYS),echo "$(rpm).$(key)=$($(rpm).$(key))";)