Diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Declare each phony target beside its rule
A list at the end of the file is easy to miss when a target is added or renamed.
Diffstat (limited to '')
-rw-r--r--Makefile16
-rw-r--r--source/cgit.mk3
-rw-r--r--tests/Makefile9
3 files changed, 19 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index ac07b26..9f8d0f4 100644
--- a/Makefile
+++ b/Makefile
@@ -67,6 +67,7 @@ INSTALL = install
export CGIT_VERSION CGIT_SCRIPT_NAME CGIT_SCRIPT_PATH
export CGIT_DATA_PATH CGIT_CONFIG CACHE_ROOT
+.PHONY: all
all: cgit
# NO_GETTEXT and NO_TCLTK leave out Git's translations and its Tcl tools, none
@@ -84,30 +85,36 @@ GIT_BUILD_FLAGS = NO_CURL=1 NO_GETTEXT=1 NO_OPENSSL=1 NO_RUST=1 NO_TCLTK=1 prefi
# two builds of the same sources would differ.
export ZERO_AR_DATE = 1
+.PHONY: cgit
cgit:
+@$(MAKE) -C $(GITDIR) -f $(CGIT_ROOT)/$(SRCDIR)/cgit.mk \
$(CGIT_ROOT)/$(BUILDDIR)/cgit $(EXTRA_GIT_TARGETS) $(GIT_BUILD_FLAGS)
# The same program without Lua, built beside the full one so a change cannot
# break that configuration unnoticed. The suite runs both.
+.PHONY: cgit-nolua
cgit-nolua:
+@$(MAKE) -C $(GITDIR) -f $(CGIT_ROOT)/$(SRCDIR)/cgit.mk \
$(CGIT_ROOT)/$(BUILDDIR)/nolua/cgit NO_LUA=1 BUILDDIR=$(BUILDDIR)/nolua $(GIT_BUILD_FLAGS)
+.PHONY: sparse
sparse:
+@$(MAKE) -C $(GITDIR) -f $(CGIT_ROOT)/$(SRCDIR)/cgit.mk $(GIT_BUILD_FLAGS) cgit-sparse
# The two builds share the Git tree, so they are made one after the other
# even under -j.
+.PHONY: test
test: cgit-with-git
+@$(MAKE) cgit-nolua
+@$(MAKE) -C tests all
# The test helpers link against a fully built Git tree, so this asks the sub
# make for Git's own all target alongside cgit.
+.PHONY: cgit-with-git
cgit-with-git:
+@$(MAKE) cgit EXTRA_GIT_TARGETS=all
+.PHONY: install
install: all
$(INSTALL) -m 0755 -d $(DESTDIR)$(CGIT_SCRIPT_PATH)
$(INSTALL) -m 0755 $(BUILDDIR)/cgit $(DESTDIR)$(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME)
@@ -116,6 +123,7 @@ install: all
$(INSTALL) -m 0755 -d $(DESTDIR)$(filterdir)
$(INSTALL) -m 0644 $(addprefix $(EXTDIR)/,$(FILTER_FILES)) $(DESTDIR)$(filterdir)
+.PHONY: uninstall
uninstall:
$(RM) $(DESTDIR)$(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME)
$(RM) $(addprefix $(DESTDIR)$(CGIT_DATA_PATH)/,$(ASSETS))
@@ -125,15 +133,18 @@ uninstall:
# cleaning removes both. The descent into tests is guarded because
# tests/Makefile includes git's config.mak.uname, which needs the submodule
# present.
+.PHONY: clean
clean:
$(RM) -r $(BUILDDIR)
@if test -e $(GITDIR)/config.mak.uname; then $(MAKE) -C tests clean; fi
+.PHONY: cleanall
cleanall: clean
@if test -e $(GITDIR)/Makefile; then $(MAKE) -C $(GITDIR) clean; fi
# The tarball is checked against its sum before anything is unpacked from it.
# An older macOS has no sha256sum, but its shasum reads the same format.
+.PHONY: get-git
get-git:
mkdir -p $(dir $(GITDIR))
curl -fL -o $(GIT_TARBALL) $(GIT_URL)
@@ -142,10 +153,7 @@ get-git:
tar -xJf $(GIT_TARBALL) && rm -rf $(GITDIR) && mv git-$(GIT_VERSION) $(GITDIR)
$(RM) $(GIT_TARBALL)
+.PHONY: tags
tags:
@mkdir -p $(BUILDDIR)
find $(SRCDIR) -name '*.[ch]' | xargs ctags -f $(BUILDDIR)/tags
-
-.PHONY: all cgit cgit-with-git cgit-nolua sparse test
-.PHONY: install uninstall
-.PHONY: clean cleanall get-git tags
diff --git a/source/cgit.mk b/source/cgit.mk
index 876e353..0786086 100644
--- a/source/cgit.mk
+++ b/source/cgit.mk
@@ -27,6 +27,7 @@ CGIT_BUILD = $(CGIT_ROOT)/$(BUILDDIR)
# rather than in the bundled git, and CGIT_VERSION stands in for a tarball or
# a clone with no tags. The file is left alone when its line is unchanged,
# since everything that includes it would otherwise rebuild.
+.PHONY: force-version
$(CGIT_BUILD)/VERSION: force-version
@mkdir -p $(CGIT_BUILD)/
@cd $(CGIT_ROOT) && version='$(CGIT_VERSION)' && \
@@ -39,7 +40,6 @@ $(CGIT_BUILD)/VERSION: force-version
echo "$$line" >$(BUILDDIR)/VERSION && echo "$$line"; \
fi
-include $(CGIT_BUILD)/VERSION
-.PHONY: force-version
# Pinned so a compiler moving its default, as GCC 15 did to gnu23, cannot
# change what the sources mean. The GNU dialect because git's headers use GNU
@@ -182,4 +182,5 @@ CGIT_SP_OBJS := $(patsubst %.o,%.sp,$(CGIT_OBJS))
$(CGIT_SP_OBJS): $(CGIT_BUILD)/%.sp: $(CGIT_SRC)/%.c GIT-CFLAGS $(CGIT_BUILD)/CGIT-CFLAGS FORCE
$(QUIET_SP)cgcc -no-compile $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $(SPARSE_FLAGS) $(CGIT_CFLAGS) $<
+.PHONY: cgit-sparse
cgit-sparse: $(CGIT_SP_OBJS)
diff --git a/tests/Makefile b/tests/Makefile
index a73ad86..3f2f83e 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -19,14 +19,15 @@ SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
TESTS = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
+.PHONY: all
all: $(TESTS)
+# Each test is named after a file that already exists, so without this make
+# would decide there is nothing to do and run none of them.
+.PHONY: $(TESTS)
$(TESTS):
@'$(SHELL_PATH_SQ)' $@ $(CGIT_TEST_OPTS)
+.PHONY: clean
clean:
$(RM) -r trash results
-
-# Each test is named after a file that already exists, so without this make
-# would decide there is nothing to do and run none of them.
-.PHONY: all $(TESTS) clean