diff --git a/Makefile b/Makefile index 1b97747..322fea8 100755 --- a/Makefile +++ b/Makefile @@ -4,6 +4,9 @@ #******************************************************************************# include Makefile.vars Makefile.msg +# Check if we're a git repository + ISGIT := $(shell test -e .git && echo y) + #******************************************************************************# # General targets # #******************************************************************************# @@ -35,8 +38,34 @@ uninstall: uninstall-bins uninstall-doc # Reinstall it all reinstall: uninstall install +# Make dist +dist: mrproper $(if $(ISGIT),reinit-gitmodules) + $(call bcmd,tarball,$(NAME)-$(VERSION),\ + tar czf $(NAME)-$(VERSION).tar.gz \ + --exclude .git --transform "s/^/$(NAME)-$(VERSION)\//" *) + .PHONY: all mostlyclean mclean clean fclean mrproper re -.PHONY: install uninstall reinstall +.PHONY: dist install uninstall reinstall +#******************************************************************************# +# Git submodules # +#******************************************************************************# +# Main rule. + reinit-gitmodules: + @git submodule deinit --all + @git submodule update --init --recursive + +# Initialize one module +ifeq ($(ISGIT),y) +define check-gitmodule +-$(call qcmd,git submodule update --init --quiet $1) +endef +else +define check-gitmodule +@true +endef +endif + +.PHONY: reinit-gitmodules #******************************************************************************# # Configuration (version) checking dependencies # #******************************************************************************# @@ -93,10 +122,12 @@ ifeq ($(shell test -f $(SRCDIR)/$1/$2.c && echo y),y) else # - Out of an update.exe project $(SRCDIR)/$1/$2.exe/$2.exe.bin:| $(SRCDIR)/$1/$2.exe - -$(call qcmd,test -e .git && ! test -e $(SRCDIR)/$1/$2.exe/.git && \ - git submodule update --init $(SRCDIR)/$1/$2.exe) - $(call qcmd,cd $$| && ./configure) - $(call bcmd,make,$2.exe,$(MAKE) $$| $2.exe.bin | sed -e 's/^/ /') + $(call check-gitmodule,$(SRCDIR)/$1/$2.exe) + $(if $(shell test -f $(SRCDIR)/$1/$2.exe/configure \ + && test -x $(SRCDIR)/$1/$2.exe/configure && echo y), \ + $(call qcmd,cd $(SRCDIR)/$1/$2.exe && ./configure 1>/dev/null)) + $(call bcmd,make,$2.exe,$(MAKE) -C $(SRCDIR)/$1/$2.exe $2.exe.bin \ + | sed -e 's/^/ /') $(OBJDIR)/$1/$2.o: $(SRCDIR)/$1/$2.exe/$2.exe.bin | $(OBJDIR)/$1 $(call bcmd,ld -r,$$@,cd $(SRCDIR)/$1/$2.exe && \ diff --git a/Makefile.vars b/Makefile.vars index c3d2066..fc0bfee 100755 --- a/Makefile.vars +++ b/Makefile.vars @@ -80,7 +80,7 @@ LDR := $(TARGET)ld -r # Maker - MAKE := make -C + MAKE := make --no-print-directory # Directory maker MD := mkdir -p # File remover