I have compiled tarball'd software releases that include output from several different projects. These archives themselves are considered a release. Released tarball includes a specification (material specification), which lists all the projects in it and the associated SHA1 (git) signatures.
To make it easy to re-create these tarballs, I put together a make system that parses the BOM one by one, cloning the repository into a subdirectory, checking the specified version, and then building. Say the line in my specification:
prog-a b5286f27d65ef20eb4508f76de5a1c57d8b21d85 git+ssh:// git-user@localhost /~/prog-a
the repository, if it has not already been cloned, will be placed in repos/prog-a , then check ( cd repos/prog-a; git checkout b5286f27d6 ) and finally make ( make -C repos/prog-a ) will be performed.
I did not understand how to let gnu decide if the verified version of the code already has the binary that I built. Currently, each individual subproject is forced to check and restore.
How can I introduce git repo SHA1 in GNU make so that it can decide if the project is outdated and needs to be updated (by doing a git checkout )?
[EDIT] This is my template file:
REPO_DIR=materials BOM=$(shell sed -r 's/([^ ]+).+/\1/' bom) BOM_DIR=$(shell sed -r 's_([^ ]+).+_$(REPO_DIR)/\1_' bom) BOM_BLD=$(shell sed -r 's_([^ ]+).+_$(REPO_DIR)/\1/\1_' bom) .PHONY: clean dist-clean all: $(BOM) clean: @rm $(BOM) $(BOM_BLD) -rf dist-clean: clean @rm $(REPO_DIR) .SECONDEXPANSION: $(BOM): % : $(REPO_DIR)/$$*/$$* @echo " CP $< $@ " @cp $< $@ $(BOM_BLD): % : $$(*D) @echo " GIT CHECKOUT" @cd $<; git checkout -q $(shell sed -rn '/$(shell echo $@ | sed -r 's_.+/__')/ s/.+ (.+) .+ .+ .+/\1/p' bom) @echo " MAKE $@ " @make -w -C $< $(@F) $(BOM_DIR): | materials @echo " GIT CLONE $@ " @cd $(REPO_DIR); git clone $(shell sed -rn '/$(shell echo $@ | sed -r 's_.+/__')/ s/.+ (.+) .+ .+/\1/p' bom) materials: @echo " MKDIR $@ " @mkdir $@
source share