#
define stage1_variables
$(1)_spec = $(notdir $($(1)-SPEC))
-$(1)_specpath = CODESPECS/$(notdir $($(1)-SPEC))
+$(1)_specpath = SPECS/$(notdir $($(1)-SPEC))
$(1)_module = $(firstword $($(1)-MODULES))
endef
# cannot use variables in such rules, we need to inline everything, sigh
define target_spec
$($(1)_specpath):
- mkdir -p CODESPECS
+ mkdir -p SPECS
(echo -n "# Generated by planetlab build from $($(1)-SPEC) on " ; date) > $($(1)_specpath)
echo "%define distroname $(DISTRO)" >> $($(1)_specpath)
echo "%define distrorelease $(RELEASE)" >> $($(1)_specpath)
@echo $(words $(ALLRPMS)) binary rpms OK
.PHONY: rpms
+# use tmp dirs when building binary rpm so make remains idempotent
+# otherwise SOURCES/ or SPEC gets touched again - which leads to rebuilding
+rpm_use_tmp_dirs = --define "_sourcedir $(HOME)/tmp" --define "_specdir $(HOME)/tmp"
+
# usage: build_binary_rpm package
# xxx hacky - invoke createrepo if DEPENDFILES mentions RPMS/yumgroups.xml
define target_binary_rpm
$($(1)-RPMS): $($(1)-SRPM)
- mkdir -p BUILD RPMS SPECS tmp
+ mkdir -p BUILD RPMS tmp
@(echo -n "XXXXXXXXXXXXXXX -- BEG RPM $(1) " ; date)
$(if $(findstring RPMS/yumgroups.xml,$($(1)-DEPENDFILES)), $(createrepo) , )
$(if $($(1)-RPMBUILD),\
- $($(1)-RPMBUILD) $($(1)-RPMFLAGS) --rebuild --define "_sourcedir $(HOME)/tmp" $($(1)-SRPM), \
- $(RPMBUILD) $($(1)-RPMFLAGS) --rebuild --define "_sourcedir $(HOME)/tmp" $($(1)-SRPM))
+ $($(1)-RPMBUILD) $($(1)-RPMFLAGS) --rebuild $(rpm_use_tmp_dirs) $($(1)-SRPM), \
+ $(RPMBUILD) $($(1)-RPMFLAGS) --rebuild $(rpm_use_tmp_dirs) $($(1)-SRPM))
@(echo -n "XXXXXXXXXXXXXXX -- END RPM $(1) " ; date)
endef
### brute force clean
distclean1:
- rm -rf pldistro.mk .rpmmacros spec2make CODESPECS MAKE
+ rm -rf pldistro.mk .rpmmacros spec2make SPECS MAKE
distclean2:
- rm -rf CODEBASES SOURCES BUILD RPMS SRPMS SPECS tmp
+ rm -rf CODEBASES SOURCES BUILD RPMS SRPMS tmp
distclean: distclean1 distclean2
.PHONY: distclean1 distclean2 distclean
@echo "Run make in two stages:"
@echo ""
@echo "make stage1=true PLDISTRO=onelab"
- @echo " -> extracts all spec files in CODESPECS/ and mk files in MAKE/"
+ @echo " -> extracts all spec files in SPECS/ and mk files in MAKE/"
@echo " as well as save PLDISTRO for subsequent runs"
@echo ""
@echo "Then you can use the following targets"