diff options
context:
space:
mode:
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Reorganize into source, assets and libraries
The C sources move to source/, the served files to assets/, the bundled Git submodule to libraries/git and the filter scripts to extensions/. Everything the build generates now lands in build/, so a clean is a single remove and the tree stays clean.
Diffstat (limited to '')
-rw-r--r--source/cache.c (renamed from cache.c)0
-rw-r--r--source/cache.h (renamed from cache.h)0
-rw-r--r--source/cgit.c (renamed from cgit.c)0
-rw-r--r--source/cgit.h (renamed from cgit.h)0
-rw-r--r--source/cgit.mk (renamed from cgit.mk)61
-rw-r--r--source/cmd.c (renamed from cmd.c)0
-rw-r--r--source/cmd.h (renamed from cmd.h)0
-rw-r--r--source/configfile.c (renamed from configfile.c)0
-rw-r--r--source/configfile.h (renamed from configfile.h)0
-rw-r--r--source/filter.c (renamed from filter.c)0
-rwxr-xr-xsource/gen-version.sh25
-rw-r--r--source/html.c (renamed from html.c)0
-rw-r--r--source/html.h (renamed from html.h)0
-rw-r--r--source/parsing.c (renamed from parsing.c)0
-rw-r--r--source/scan-tree.c (renamed from scan-tree.c)0
-rw-r--r--source/scan-tree.h (renamed from scan-tree.h)0
-rw-r--r--source/shared.c (renamed from shared.c)0
-rw-r--r--source/ui-atom.c (renamed from ui-atom.c)0
-rw-r--r--source/ui-atom.h (renamed from ui-atom.h)0
-rw-r--r--source/ui-blame.c (renamed from ui-blame.c)0
-rw-r--r--source/ui-blame.h (renamed from ui-blame.h)0
-rw-r--r--source/ui-blob.c (renamed from ui-blob.c)0
-rw-r--r--source/ui-blob.h (renamed from ui-blob.h)0
-rw-r--r--source/ui-clone.c (renamed from ui-clone.c)0
-rw-r--r--source/ui-clone.h (renamed from ui-clone.h)0
-rw-r--r--source/ui-commit.c (renamed from ui-commit.c)0
-rw-r--r--source/ui-commit.h (renamed from ui-commit.h)0
-rw-r--r--source/ui-diff.c (renamed from ui-diff.c)0
-rw-r--r--source/ui-diff.h (renamed from ui-diff.h)0
-rw-r--r--source/ui-log.c (renamed from ui-log.c)0
-rw-r--r--source/ui-log.h (renamed from ui-log.h)0
-rw-r--r--source/ui-patch.c (renamed from ui-patch.c)0
-rw-r--r--source/ui-patch.h (renamed from ui-patch.h)0
-rw-r--r--source/ui-plain.c (renamed from ui-plain.c)0
-rw-r--r--source/ui-plain.h (renamed from ui-plain.h)0
-rw-r--r--source/ui-refs.c (renamed from ui-refs.c)0
-rw-r--r--source/ui-refs.h (renamed from ui-refs.h)0
-rw-r--r--source/ui-repolist.c (renamed from ui-repolist.c)0
-rw-r--r--source/ui-repolist.h (renamed from ui-repolist.h)0
-rw-r--r--source/ui-shared.c (renamed from ui-shared.c)0
-rw-r--r--source/ui-shared.h (renamed from ui-shared.h)0
-rw-r--r--source/ui-snapshot.c (renamed from ui-snapshot.c)0
-rw-r--r--source/ui-snapshot.h (renamed from ui-snapshot.h)0
-rw-r--r--source/ui-ssdiff.c (renamed from ui-ssdiff.c)0
-rw-r--r--source/ui-ssdiff.h (renamed from ui-ssdiff.h)0
-rw-r--r--source/ui-stats.c (renamed from ui-stats.c)0
-rw-r--r--source/ui-stats.h (renamed from ui-stats.h)0
-rw-r--r--source/ui-summary.c (renamed from ui-summary.c)0
-rw-r--r--source/ui-summary.h (renamed from ui-summary.h)0
-rw-r--r--source/ui-tag.c (renamed from ui-tag.c)0
-rw-r--r--source/ui-tag.h (renamed from ui-tag.h)0
-rw-r--r--source/ui-tree.c (renamed from ui-tree.c)0
-rw-r--r--source/ui-tree.h (renamed from ui-tree.h)0
53 files changed, 60 insertions, 26 deletions
diff --git a/cache.c b/source/cache.c
index e70af13..e70af13 100644
--- a/cache.c
+++ b/source/cache.c
diff --git a/cache.h b/source/cache.h
index 470da4f..470da4f 100644
--- a/cache.h
+++ b/source/cache.h
diff --git a/cgit.c b/source/cgit.c
index ca318e8..ca318e8 100644
--- a/cgit.c
+++ b/source/cgit.c
diff --git a/cgit.h b/source/cgit.h
index 7d7ece7..7d7ece7 100644
--- a/cgit.h
+++ b/source/cgit.h
diff --git a/cgit.mk b/source/cgit.mk
index 3fcc1ca..d012349 100644
--- a/cgit.mk
+++ b/source/cgit.mk
@@ -1,22 +1,30 @@
-# This Makefile is run in the "git" directory in order to re-use Git's
-# build variables and operating system detection. Hence all files in
-# CGit's directory must be prefixed with "../".
+# This Makefile runs inside the bundled Git tree (libraries/git) so that it
+# can reuse Git's build variables and platform detection. The top-level
+# Makefile invokes it as:
+#
+# make -C libraries/git -f ../../source/cgit.mk ../../build/cgit
+#
+# so every path back into the project is prefixed with "../../": sources come
+# from ../../source and all build output goes to ../../build.
include Makefile
-CGIT_PREFIX = ../
+# Locations relative to libraries/git, where this file is run.
+CGIT_PREFIX = ../../
+CGIT_SRC = $(CGIT_PREFIX)source/
+CGIT_BUILD = $(CGIT_PREFIX)build/
-include $(CGIT_PREFIX)cgit.conf
-# The CGIT_* variables are inherited when this file is called from the
-# main Makefile - they are defined there.
+# The CGIT_* variables are inherited from the top-level Makefile.
-$(CGIT_PREFIX)VERSION: force-version
- @cd $(CGIT_PREFIX) && '$(SHELL_PATH_SQ)' ./gen-version.sh "$(CGIT_VERSION)"
--include $(CGIT_PREFIX)VERSION
+$(CGIT_BUILD)VERSION: force-version
+ @mkdir -p $(CGIT_BUILD)
+ @cd $(CGIT_PREFIX) && '$(SHELL_PATH_SQ)' source/gen-version.sh "$(CGIT_VERSION)" build/VERSION
+-include $(CGIT_BUILD)VERSION
.PHONY: force-version
-# CGIT_CFLAGS is a separate variable so that we can track it separately
-# and avoid rebuilding all of Git when these variables change.
+# CGIT_CFLAGS is tracked separately so that changing it does not force a
+# rebuild of Git itself.
CGIT_CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"'
CGIT_CFLAGS += -DCGIT_SCRIPT_NAME='"$(CGIT_SCRIPT_NAME)"'
CGIT_CFLAGS += -DCGIT_CACHE_ROOT='"$(CACHE_ROOT)"'
@@ -95,16 +103,16 @@ CGIT_OBJ_NAMES += ui-summary.o
CGIT_OBJ_NAMES += ui-tag.o
CGIT_OBJ_NAMES += ui-tree.o
-CGIT_OBJS := $(addprefix $(CGIT_PREFIX),$(CGIT_OBJ_NAMES))
+CGIT_OBJS := $(addprefix $(CGIT_BUILD),$(CGIT_OBJ_NAMES))
-# Only cgit.c reference CGIT_VERSION so we only rebuild its objects when the
+# Only cgit.c references CGIT_VERSION, so only its objects rebuild when the
# version changes.
-CGIT_VERSION_OBJS := $(addprefix $(CGIT_PREFIX),cgit.o cgit.sp)
-$(CGIT_VERSION_OBJS): $(CGIT_PREFIX)VERSION
+CGIT_VERSION_OBJS := $(addprefix $(CGIT_BUILD),cgit.o cgit.sp)
+$(CGIT_VERSION_OBJS): $(CGIT_BUILD)VERSION
$(CGIT_VERSION_OBJS): EXTRA_CPPFLAGS = \
-DCGIT_VERSION='"$(CGIT_VERSION)"'
-# Git handles dependencies using ":=" so dependencies in CGIT_OBJ are not
+# Git handles dependencies using ":=" so dependencies in CGIT_OBJS are not
# handled by that and we must handle them ourselves.
cgit_dep_files := $(foreach f,$(CGIT_OBJS),$(dir $f).depend/$(notdir $f).d)
cgit_dep_files_present := $(wildcard $(cgit_dep_files))
@@ -112,30 +120,31 @@ ifneq ($(cgit_dep_files_present),)
include $(cgit_dep_files_present)
endif
-ifeq ($(wildcard $(CGIT_PREFIX).depend),)
-missing_dep_dirs += $(CGIT_PREFIX).depend
+ifeq ($(wildcard $(CGIT_BUILD).depend),)
+missing_dep_dirs += $(CGIT_BUILD).depend
endif
-$(CGIT_PREFIX).depend:
+$(CGIT_BUILD).depend:
@mkdir -p $@
-$(CGIT_PREFIX)CGIT-CFLAGS: FORCE
+$(CGIT_BUILD)CGIT-CFLAGS: FORCE
+ @mkdir -p $(CGIT_BUILD)
@FLAGS='$(subst ','\'',$(CGIT_CFLAGS))'; \
- if test x"$$FLAGS" != x"`cat ../CGIT-CFLAGS 2>/dev/null`" ; then \
+ if test x"$$FLAGS" != x"`cat $(CGIT_BUILD)CGIT-CFLAGS 2>/dev/null`" ; then \
echo 1>&2 " * new CGit build flags"; \
- echo "$$FLAGS" >$(CGIT_PREFIX)CGIT-CFLAGS; \
+ echo "$$FLAGS" >$(CGIT_BUILD)CGIT-CFLAGS; \
fi
-$(CGIT_OBJS): %.o: %.c GIT-CFLAGS $(CGIT_PREFIX)CGIT-CFLAGS $(missing_dep_dirs)
- $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $(CGIT_CFLAGS) $<
+$(CGIT_OBJS): $(CGIT_BUILD)%.o: $(CGIT_SRC)%.c GIT-CFLAGS $(CGIT_BUILD)CGIT-CFLAGS $(missing_dep_dirs)
+ $(QUIET_CC)$(CC) -o $@ -c $(dep_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $(CGIT_CFLAGS) $<
-$(CGIT_PREFIX)cgit: $(CGIT_OBJS) GIT-LDFLAGS $(GITLIBS)
+$(CGIT_BUILD)cgit: $(CGIT_OBJS) GIT-LDFLAGS $(GITLIBS)
@echo 1>&1 " * $(LUA_MESSAGE)"
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) $(CGIT_LIBS)
CGIT_SP_OBJS := $(patsubst %.o,%.sp,$(CGIT_OBJS))
-$(CGIT_SP_OBJS): %.sp: %.c GIT-CFLAGS $(CGIT_PREFIX)CGIT-CFLAGS FORCE
+$(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) $(CGIT_CFLAGS) $(SPARSE_FLAGS) $<
cgit-sparse: $(CGIT_SP_OBJS)
diff --git a/cmd.c b/source/cmd.c
index 0eb75b1..0eb75b1 100644
--- a/cmd.c
+++ b/source/cmd.c
diff --git a/cmd.h b/source/cmd.h
index 6249b1d..6249b1d 100644
--- a/cmd.h
+++ b/source/cmd.h
diff --git a/configfile.c b/source/configfile.c
index e039109..e039109 100644
--- a/configfile.c
+++ b/source/configfile.c
diff --git a/configfile.h b/source/configfile.h
index af7ca19..af7ca19 100644
--- a/configfile.h
+++ b/source/configfile.h
diff --git a/filter.c b/source/filter.c
index c778d05..c778d05 100644
--- a/filter.c
+++ b/source/filter.c
diff --git a/source/gen-version.sh b/source/gen-version.sh
new file mode 100755
index 0000000..23d0d0b
--- /dev/null
+++ b/source/gen-version.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# Writes a "CGIT_VERSION = ..." line to the output file (default: VERSION),
+# for the build to include. Run from the project root so `git describe` acts
+# on cgit rather than the bundled Git submodule.
+#
+# Usage: gen-version.sh <fallback-version> [output-file]
+
+V=$1
+OUT=${2:-VERSION}
+
+# Prefer `git describe` when run at the top of the cgit working tree.
+if test "$(git rev-parse --git-dir 2>/dev/null)" = '.git'
+then
+ V=$(git describe --abbrev=4 HEAD 2>/dev/null)
+fi
+
+new="CGIT_VERSION = $V"
+old=$(cat "$OUT" 2>/dev/null)
+
+# Exit if the version is already up to date.
+test "$old" = "$new" && exit 0
+
+echo "$new" > "$OUT"
+cat "$OUT"
diff --git a/html.c b/source/html.c
index 0bac34b..0bac34b 100644
--- a/html.c
+++ b/source/html.c
diff --git a/html.h b/source/html.h
index fa4de77..fa4de77 100644
--- a/html.h
+++ b/source/html.h
diff --git a/parsing.c b/source/parsing.c
index bdaed25..bdaed25 100644
--- a/parsing.c
+++ b/source/parsing.c
diff --git a/scan-tree.c b/source/scan-tree.c
index c120efe..c120efe 100644
--- a/scan-tree.c
+++ b/source/scan-tree.c
diff --git a/scan-tree.h b/source/scan-tree.h
index def0a7a..def0a7a 100644
--- a/scan-tree.h
+++ b/source/scan-tree.h
diff --git a/shared.c b/source/shared.c
index a39394d..a39394d 100644
--- a/shared.c
+++ b/source/shared.c
diff --git a/ui-atom.c b/source/ui-atom.c
index 0659e96..0659e96 100644
--- a/ui-atom.c
+++ b/source/ui-atom.c
diff --git a/ui-atom.h b/source/ui-atom.h
index dda953b..dda953b 100644
--- a/ui-atom.h
+++ b/source/ui-atom.h
diff --git a/ui-blame.c b/source/ui-blame.c
index 5c6f36e..5c6f36e 100644
--- a/ui-blame.c
+++ b/source/ui-blame.c
diff --git a/ui-blame.h b/source/ui-blame.h
index 5b97e03..5b97e03 100644
--- a/ui-blame.h
+++ b/source/ui-blame.h
diff --git a/ui-blob.c b/source/ui-blob.c
index bc91656..bc91656 100644
--- a/ui-blob.c
+++ b/source/ui-blob.c
diff --git a/ui-blob.h b/source/ui-blob.h
index 16847b2..16847b2 100644
--- a/ui-blob.h
+++ b/source/ui-blob.h
diff --git a/ui-clone.c b/source/ui-clone.c
index e11f496..e11f496 100644
--- a/ui-clone.c
+++ b/source/ui-clone.c
diff --git a/ui-clone.h b/source/ui-clone.h
index 3e460a3..3e460a3 100644
--- a/ui-clone.h
+++ b/source/ui-clone.h
diff --git a/ui-commit.c b/source/ui-commit.c
index 972e9bc..972e9bc 100644
--- a/ui-commit.c
+++ b/source/ui-commit.c
diff --git a/ui-commit.h b/source/ui-commit.h
index 8198b4b..8198b4b 100644
--- a/ui-commit.h
+++ b/source/ui-commit.h
diff --git a/ui-diff.c b/source/ui-diff.c
index 6cfa697..6cfa697 100644
--- a/ui-diff.c
+++ b/source/ui-diff.c
diff --git a/ui-diff.h b/source/ui-diff.h
index 39264a1..39264a1 100644
--- a/ui-diff.h
+++ b/source/ui-diff.h
diff --git a/ui-log.c b/source/ui-log.c
index 9906bbc..9906bbc 100644
--- a/ui-log.c
+++ b/source/ui-log.c
diff --git a/ui-log.h b/source/ui-log.h
index 325607c..325607c 100644
--- a/ui-log.h
+++ b/source/ui-log.h
diff --git a/ui-patch.c b/source/ui-patch.c
index f9d2eeb..f9d2eeb 100644
--- a/ui-patch.c
+++ b/source/ui-patch.c
diff --git a/ui-patch.h b/source/ui-patch.h
index 7a6cacd..7a6cacd 100644
--- a/ui-patch.h
+++ b/source/ui-patch.h
diff --git a/ui-plain.c b/source/ui-plain.c
index a2a4087..a2a4087 100644
--- a/ui-plain.c
+++ b/source/ui-plain.c
diff --git a/ui-plain.h b/source/ui-plain.h
index 5bff07b..5bff07b 100644
--- a/ui-plain.h
+++ b/source/ui-plain.h
diff --git a/ui-refs.c b/source/ui-refs.c
index 11fb9fc..11fb9fc 100644
--- a/ui-refs.c
+++ b/source/ui-refs.c
diff --git a/ui-refs.h b/source/ui-refs.h
index 1d4a54a..1d4a54a 100644
--- a/ui-refs.h
+++ b/source/ui-refs.h
diff --git a/ui-repolist.c b/source/ui-repolist.c
index 1b224cf..1b224cf 100644
--- a/ui-repolist.c
+++ b/source/ui-repolist.c
diff --git a/ui-repolist.h b/source/ui-repolist.h
index 1b6b322..1b6b322 100644
--- a/ui-repolist.h
+++ b/source/ui-repolist.h
diff --git a/ui-shared.c b/source/ui-shared.c
index df52a9b..df52a9b 100644
--- a/ui-shared.c
+++ b/source/ui-shared.c
diff --git a/ui-shared.h b/source/ui-shared.h
index 2a3a7f5..2a3a7f5 100644
--- a/ui-shared.h
+++ b/source/ui-shared.h
diff --git a/ui-snapshot.c b/source/ui-snapshot.c
index d157222..d157222 100644
--- a/ui-snapshot.c
+++ b/source/ui-snapshot.c
diff --git a/ui-snapshot.h b/source/ui-snapshot.h
index a8deec3..a8deec3 100644
--- a/ui-snapshot.h
+++ b/source/ui-snapshot.h
diff --git a/ui-ssdiff.c b/source/ui-ssdiff.c
index af8bc9e..af8bc9e 100644
--- a/ui-ssdiff.c
+++ b/source/ui-ssdiff.c
diff --git a/ui-ssdiff.h b/source/ui-ssdiff.h
index 11f2714..11f2714 100644
--- a/ui-ssdiff.h
+++ b/source/ui-ssdiff.h
diff --git a/ui-stats.c b/source/ui-stats.c
index 02c60ef..02c60ef 100644
--- a/ui-stats.c
+++ b/source/ui-stats.c
diff --git a/ui-stats.h b/source/ui-stats.h
index 0e61b03..0e61b03 100644
--- a/ui-stats.h
+++ b/source/ui-stats.h
diff --git a/ui-summary.c b/source/ui-summary.c
index 947812a..947812a 100644
--- a/ui-summary.c
+++ b/source/ui-summary.c
diff --git a/ui-summary.h b/source/ui-summary.h
index cba696a..cba696a 100644
--- a/ui-summary.h
+++ b/source/ui-summary.h
diff --git a/ui-tag.c b/source/ui-tag.c
index 8f58f14..8f58f14 100644
--- a/ui-tag.c
+++ b/source/ui-tag.c
diff --git a/ui-tag.h b/source/ui-tag.h
index d295cdc..d295cdc 100644
--- a/ui-tag.h
+++ b/source/ui-tag.h
diff --git a/ui-tree.c b/source/ui-tree.c
index 5ac8c9a..5ac8c9a 100644
--- a/ui-tree.c
+++ b/source/ui-tree.c
diff --git a/ui-tree.h b/source/ui-tree.h
index bbd34e3..bbd34e3 100644
--- a/ui-tree.h
+++ b/source/ui-tree.h