Index: Makefile.in ================================================================== --- Makefile.in +++ Makefile.in @@ -9,12 +9,13 @@ clean: clean-th1ish distclean: distclean-th1ish include @top_srcdir@/shakenmake.make AUTOCONFIG_H := @srcdir@/include/fossil-scm/autoconfig.h -SRCD := @top_srcdir@/src -FSL.SRC := $(addprefix $(SRCD)/,\ +#SRCDIR := @top_srcdir@/src +SRCDIR := @srcdir@/src +FSL.SRC.BASENAMES := \ fsl.c \ fsl_appendf.c \ fsl_bag.c \ fsl_buffer.c \ fsl_content.c \ @@ -26,15 +27,38 @@ fsl_md5.c \ fsl_mf.c \ fsl_pq.c \ fsl_sha1.c \ fsl_tag.c \ - fsl_utf8.c) + fsl_utf8.c +FSL.SRC := $(addprefix $(SRCDIR)/,$(FSL.SRC.BASENAMES)) + +######################################################################## +# Set up building the main objects the $(OBJDIR). +OBJDIR := obj +$(OBJDIR): + mkdir $@ +DISTCLEAN_FILES += -r $(OBJDIR) +# Reminder to self: the fact that rm(1) on my system accepts -r +# in the middle of the file list somewhat surprises me, but it may +# be non-portable. -FSL.OBJ := $(subst .c,.o,$(FSL.SRC)) +define ADD_C_TO_OBJ_DIR +# Set up rules for building dir/foo.c to $(OBJDIR)/foo.o +# $1 = input file. Must not be more than 1 subdir level +# deep (that would break these rules). +$(1).OBJ := $(OBJDIR)/$(basename $(notdir $(1))).o +$$($(1).OBJ): $(1) + $(COMPILE.c) $(COMPILE.c.OPTIONS) -o $$($(1).OBJ) $(1) +FSL.OBJ += $$($(1).OBJ) +endef +$(foreach cfile,$(FSL.SRC),$(eval $(call ADD_C_TO_OBJ_DIR,$(cfile)))) +CLEAN_FILES += $(FSL.OBJ) +$(FSL.OBJ): $(OBJDIR) -CLEAN_FILES += $(SRCD)/*.o +# End $(OBJDIR) bits. +######################################################################## EXTRA_LIBS := -lz -lsqlite3 test.BIN.LDFLAGS := -L. -lfossil @SH_LINKFLAGS@ libfossil.DLL.OBJECTS := $(FSL.OBJ) libfossil.DLL.LDFLAGS := @SH_LDFLAGS@ $(EXTRA_LIBS) Index: auto.def ================================================================== --- auto.def +++ auto.def @@ -141,11 +141,11 @@ if {[opt-bool no-debug]} { msg-result "Non-debug build." set cFlags "$cFlags -O2" } else { - msg-result "Debug build enabled." + msg-result "Debug build enabled. Use --no-debug to build in non-debug mode." set cFlags "$cFlags -g" } define CFLAGS $cFlags Index: th1ish/Makefile.in ================================================================== --- th1ish/Makefile.in +++ th1ish/Makefile.in @@ -4,12 +4,15 @@ #CPPFLAGS += -I$(TOP_INCDIR) CPPFLAGS += -I$(TOP_DIR)/include #INCLUDES_PATH ?= $(HOME)/include /usr/local/include /usr/include FOSSIL.LIB := ../libfossil.a + +ifeq (,$(strip $(filter distclean clean,$(MAKECMDGOALS)))) $(FOSSIL.LIB): $(MAKE) -C .. +endif ######################################################################## # INC_SEARCH: $(call)able function. $(1) should be the the name of # a C header file to search for under $(INCLUDES_PATH). define INC_SEARCH