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
update: $(BLFS_XML) $(LFS_XML)
@echo Updating the book sources
ifneq (,$(LFS-BRANCH))
$(Q)cd $(LFS_XML) && \
if [ $(LFS-BRANCH) != trunk ]; then git switch -; fi && \
git checkout trunk && \
git pull && \
git checkout $(LFS-BRANCH)
if [ $(LFS-BRANCH) != trunk ]; then git checkout $(LFS-BRANCH); fi
endif
ifneq (,$(BLFS-BRANCH))
$(Q)cd $(BLFS_XML) && \
if [ $(BLFS-BRANCH) != trunk ]; then git switch -; fi && \
git checkout trunk && \
git pull && \
git checkout $(BLFS-BRANCH)
if [ $(BLFS-BRANCH) != trunk ]; then git checkout $(BLFS-BRANCH); fi
endif
$(LFS_XML):
@echo Getting the LFS book sources...
$(Q)git clone $(LFS-GIT) $@
ifneq (,$(LFS-BRANCH))
if [ $(LFS-BRANCH) != trunk ]; then \
cd $@ && \
git checkout $(LFS-BRANCH); \
fi
endif
$(BLFS_XML):
@echo Getting the BLFS book sources...
$(Q)git clone $(GIT) $@
ifneq (,$(BLFS-BRANCH))
$(Q)if [ $(BLFS-BRANCH) != trunk ]; then \
cd $@ && \
git checkout $(BLFS-BRANCH); \
fi
endif
# Clean up
clean: