BLFS/Makefile: Don't run git checkout if {B,}LFS-BRANCH is empty

Fix also the order of checkout trunk and checkout $(...-BRANCH)
This commit is contained in:
Pierre Labastie 2022-03-30 22:33:08 +02:00
parent 3e82b0bd81
commit 1242857a75

View file

@ -191,31 +191,38 @@ all: update $(BOOK_XML)
# trunk before updating, and switch back to the branch/tag afterwards # trunk before updating, and switch back to the branch/tag afterwards
update: $(BLFS_XML) $(LFS_XML) update: $(BLFS_XML) $(LFS_XML)
@echo Updating the book sources @echo Updating the book sources
ifneq (,$(LFS-BRANCH))
$(Q)cd $(LFS_XML) && \ $(Q)cd $(LFS_XML) && \
if [ $(LFS-BRANCH) != trunk ]; then git switch -; fi && \ git checkout trunk && \
git pull && \ git pull && \
git checkout $(LFS-BRANCH) if [ $(LFS-BRANCH) != trunk ]; then git checkout $(LFS-BRANCH); fi
endif
ifneq (,$(BLFS-BRANCH))
$(Q)cd $(BLFS_XML) && \ $(Q)cd $(BLFS_XML) && \
if [ $(BLFS-BRANCH) != trunk ]; then git switch -; fi && \ git checkout trunk && \
git pull && \ git pull && \
git checkout $(BLFS-BRANCH) if [ $(BLFS-BRANCH) != trunk ]; then git checkout $(BLFS-BRANCH); fi
endif
$(LFS_XML): $(LFS_XML):
@echo Getting the LFS book sources... @echo Getting the LFS book sources...
$(Q)git clone $(LFS-GIT) $@ $(Q)git clone $(LFS-GIT) $@
ifneq (,$(LFS-BRANCH))
if [ $(LFS-BRANCH) != trunk ]; then \ if [ $(LFS-BRANCH) != trunk ]; then \
cd $@ && \ cd $@ && \
git checkout $(LFS-BRANCH); \ git checkout $(LFS-BRANCH); \
fi fi
endif
$(BLFS_XML): $(BLFS_XML):
@echo Getting the BLFS book sources... @echo Getting the BLFS book sources...
$(Q)git clone $(GIT) $@ $(Q)git clone $(GIT) $@
ifneq (,$(BLFS-BRANCH))
$(Q)if [ $(BLFS-BRANCH) != trunk ]; then \ $(Q)if [ $(BLFS-BRANCH) != trunk ]; then \
cd $@ && \ cd $@ && \
git checkout $(BLFS-BRANCH); \ git checkout $(BLFS-BRANCH); \
fi fi
endif
# Clean up # Clean up
clean: clean: