summaryrefslogtreecommitdiff
path: root/lib/make
diff options
context:
space:
mode:
authorgoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>2001-05-09 21:06:20 +0000
committergoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>2001-05-09 21:06:20 +0000
commit6039777605881b19b6bb3821a8e97d370336ed67 (patch)
treee0d3490c83615f55599daa5128393f2fc2847403 /lib/make
parentaae8e43a8b249fc9ec8a51ec93af8e8ea6c7350a (diff)
Changed so that make.subdir is used for building all user-supplied files.
Optimised a bit so libs and executable are only rebuilt if a source file/header has really changed. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@2158 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/make')
-rw-r--r--lib/make/make.configuration33
-rw-r--r--lib/make/make.post2
-rw-r--r--lib/make/make.subdir4
-rw-r--r--lib/make/make.thornlib18
4 files changed, 35 insertions, 22 deletions
diff --git a/lib/make/make.configuration b/lib/make/make.configuration
index ab69f9d7..8ff1a120 100644
--- a/lib/make/make.configuration
+++ b/lib/make/make.configuration
@@ -74,16 +74,23 @@ endif
UTIL_DIR=$(EXEDIR)$(DIRSEP)$(CONFIG_NAME)
+
+# Use a phony main target to make sure we print a nice ending message 8-)
+.PHONY: main
+
+main: $(EXEDIR)$(DIRSEP)$(EXE)
+ @echo All done !
+ @echo $(DIVIDER)
+
# Build the executable
-$(EXEDIR)$(DIRSEP)$(EXE): $(CONFIG)/make.thornlist $(CONFIG)/cctki_version.h $(patsubst %,$(CCTK_LIBDIR)/$(LIBNAME_PREFIX)%$(LIBNAME_SUFFIX),$(notdir $(THORNS) $(CACTUSLIBS)))
+
+$(EXEDIR)$(DIRSEP)$(EXE): $(CONFIG)/make.thornlist $(CONFIG)/cctki_version.h $(patsubst %,$(CCTK_LIBDIR)/$(LIBNAME_PREFIX)%$(LIBNAME_SUFFIX),$(notdir $(THORNS) $(CACTUSLIBS)))
@echo $(DIVIDER)
@echo Creating $(EXE) in $(EXEDIR) from $(THORNS)
$(CC) $(OPTIMISE_C) $(DEBUG_C) $(CFLAGS) $(CCOMPILEONLY)$(OPTIONSEP)$(TOP)$(DIRSEP)datestamp.o -I$(subst /,$(DIRSEP),$(CCTK_HOME)/src/include) -I$(CONFIG) $(subst /,$(DIRSEP),$(DATESTAMP))
if [ ! -d $(EXEDIR) ]; then $(MKDIR) $(MKDIRFLAGS) $(EXEDIR) ; fi
$(LD) $(CREATEEXE)$(OPTIONSEP)$(subst /,$(DIRSEP),$@) $(DEBUG_LD) $(LDFLAGS) $(EXTRAFLAGS) $(subst /,$(DIRSEP), $(TOP)/datestamp.o) $(CACTUSLIBLINKLINE) $(GENERAL_LIBRARIES)
@echo $(DIVIDER)
- @echo All done !
- @echo $(DIVIDER)
# Version file
$(CONFIG)/cctki_version.h: $(CCTK_HOME)/Makefile
@@ -162,9 +169,21 @@ ifneq ($(strip $(THORNS)),)
-include $(THORNS:%=$(PACKAGE_DIR)/%/src/make.configuration.deps)
endif
+# Catch the special case of a thorn being removed from the disk entirely.
+$(foreach lib, $(CCTK_HOME)/src $(THORNS:%=$(PACKAGE_DIR)/%), $(lib)/param.ccl $(lib)/interface.ccl $(lib)/schedule.ccl) $(CONFIG_THORNS:%=$(PACKAGE_DIR)/%/configuration.ccl):
+ @echo "Missing file $@"
+ @echo "Possibly from a thorn deleted from an arrangement"
+ @echo "Deleting make.thornlist"
+ rm $(CONFIG)/make.thornlist
+ @echo "Please try building again"
+ exit 1
+
+
# Phony targets.
.PHONY:update editthorns clean cleandeps cleanobjs realclean
+
+# This phony target forces an update.
update:
editthorns:
@@ -186,14 +205,6 @@ editthorns:
done
@echo $(DIVIDER)
-$(foreach lib, $(CCTK_HOME)/src $(THORNS:%=$(PACKAGE_DIR)/%), $(lib)/param.ccl $(lib)/interface.ccl $(lib)/schedule.ccl) $(CONFIG_THORNS:%=$(PACKAGE_DIR)/%/configuration.ccl):
- @echo "Missing file $@"
- @echo "Possibly from a thorn deleted from an arrangement"
- @echo "Deleting make.thornlist"
- rm $(CONFIG)/make.thornlist
- @echo "Please try building again"
- exit 1
-
clean:
@echo Deleting all object and dependency files in $(TOP)
find $(TOP) \( -name '*.[od]' -o -name '*.a' \) -exec rm {} \;
diff --git a/lib/make/make.post b/lib/make/make.post
index 32d64bed..9b7481af 100644
--- a/lib/make/make.post
+++ b/lib/make/make.post
@@ -11,4 +11,4 @@
# This is a simply expanded variable (i.e. :=, rather than =)
# and is used to track all source files
-CCTK_SRCS += $(addprefix $(CCTK_THIS_SUBDIR)/, $(SRCS))
+CCTK_SRCS += $(subst /./,/,$(addprefix $(CCTK_THIS_SUBDIR)/, $(SRCS)))
diff --git a/lib/make/make.subdir b/lib/make/make.subdir
index 570f8f9f..c70ea2df 100644
--- a/lib/make/make.subdir
+++ b/lib/make/make.subdir
@@ -26,9 +26,9 @@ include $(SRCDIR)/make.code.defn
OBJS = $(SRCS:%=%.o)
# Build all the object files
-.PHONY:all
-all: $(OBJS)
+make.checked: $(OBJS)
+ touch make.checked
# Rules to make the object files
include $(CONFIG)/make.config.rules
diff --git a/lib/make/make.thornlib b/lib/make/make.thornlib
index 5f5c9d26..843a7e5d 100644
--- a/lib/make/make.thornlib
+++ b/lib/make/make.thornlib
@@ -39,8 +39,10 @@ include $(SRCDIR)/make.code.defn
CCTK_SRCS += $(SRCS)
# Protect the value of SRCS and SUBDIRS of this directory
-LOCAL_SRCS := $(SRCS)
-LOCAL_SUBDIRS := $(SUBDIRS)
+#LOCAL_SRCS := $(SRCS)
+LOCAL_SUBDIRS := . $(SUBDIRS)
+
+SRCS =
# Include all the make.code.defn files for the subdirectories
# These have to be wrapped to allow us to concatanate all the
@@ -59,9 +61,9 @@ SUBDIRS = $(LOCAL_SUBDIRS)
OBJS = $(SRCS:%=%.o)
# Turn local source file names into object file names
-LOCAL_OBJS = $(LOCAL_SRCS:%=%.o)
+#LOCAL_OBJS = $(LOCAL_SRCS:%=%.o)
-$(NAME): $(addsuffix .check, $(SUBDIRS)) $(LOCAL_OBJS) $(SRCDIR)/make.code.defn $(foreach DIR,$(SUBDIRS), $(SRCDIR)/$(DIR)/make.code.defn)
+$(NAME): $(addsuffix /make.checked, $(SUBDIRS)) $(LOCAL_OBJS) $(foreach DIR,. $(SUBDIRS), $(SRCDIR)/$(DIR)/make.code.defn)
@echo $(DIVIDER)
if [ -r $(NAME) ] ; then echo Updating $(NAME) ; else echo Creating $(NAME) ; fi
if [ -r $@ ] ; then rm $@ ; fi
@@ -79,11 +81,11 @@ include $(CONFIG)/make.config.rules
# Extra stuff for allowing make to recurse into directories
# This one makes the object files in the subdirectory
-.PHONY: $(addsuffix .check, $(SUBDIRS))
+.PHONY: FORCE
-$(addsuffix .check, $(SUBDIRS)) :
- if [ ! -d $(basename $@) ] ; then $(MKDIR) $(MKDIRFLAGS) $(basename $@) ; fi
- cd $(basename $@) ; $(MAKE) TOP=$(TOP) CONFIG=$(CONFIG) SRCDIR=$(SRCDIR)/$(basename $@) THORN=$(THORN) -f $(MAKE_DIR)/make.subdir
+$(addsuffix /make.checked, $(SUBDIRS)) : FORCE
+ if [ ! -d $(dir $@) ] ; then $(MKDIR) $(MKDIRFLAGS) $(dir $@) ; fi
+ cd $(dir $@) ; $(MAKE) TOP=$(TOP) CONFIG=$(CONFIG) SRCDIR=$(subst /./,,$(SRCDIR)/$(dir $@)) THORN=$(THORN) -f $(MAKE_DIR)/make.subdir
# This one puts a file containing identity info into the build subdirectory
$(addsuffix /make.identity, $(SUBDIRS)):