diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce 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/cgit.mk (renamed from cgit.mk) | 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 35 insertions, 26 deletions
@@ -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) |
