From 552abbcda3b950a6aad048ba2c161d84970c984f Mon Sep 17 00:00:00 2001 From: goodale Date: Fri, 22 Jan 1999 11:31:58 +0000 Subject: Now preprocesses c files into the appropriate build directory, then changes directory to $(TOP)/scratch and builds the file there, putting the object file in the appropriate build directory. When this is done for F90 it should mkae sure that all module files end up in one place and are available for the F90 compiler. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@107 17b73243-c579-4c4c-a9d2-2d5706c11dac --- lib/make/make.config.rules.in | 23 ++++++++++++++++++++++- lib/make/make.configuration | 9 +++++++-- lib/make/make.thornlib | 5 +++++ 3 files changed, 34 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/make/make.config.rules.in b/lib/make/make.config.rules.in index b8437a74..07c37d9e 100644 --- a/lib/make/make.config.rules.in +++ b/lib/make/make.config.rules.in @@ -12,8 +12,29 @@ # @enddesc # @@*/ +# Dividers to make the screen output slightly nicer +DIVEL = __________________ +DIVIDER = $(DIVEL)$(DIVEL)$(DIVEL)$(DIVEL) + +define PREPROCESS_C +cat $< | $(PERL) $(CCTK_HOME)/lib/sbin/c_file_processor.pl $(CONFIG) > $(notdir $<) +endef + +define COMPILE_C +current_wd=`pwd` ; cd $(SCRATCH_BUILD) ; $(CC) $(CFLAGS) -c -o $$current_wd/$@ $$current_wd/$(notdir $<) $(INC_DIRS:%=-I%) $(EXTRA_DEFINES:%=-D%) -DCCODE +endef + +define POSTPROCESS_C +endef + %.o: $(SRCDIR)/%.c - $(CC) $(CFLAGS) -c -o $@ $< $(INC_DIRS:%=-I%) $(EXTRA_DEFINES:%=-D%) -DCCODE + @echo $(DIVIDER) + @echo Preprocessing $< + $(PREPROCESS_C) + @echo Compiling $< + $(COMPILE_C) + @echo Postprocessing $< + $(POSTPROCESS_C) %.d: $(SRCDIR)/%.c $(CPP) -M $(CFLAGS) $< $(INC_DIRS:%=-I%) $(EXTRA_DEFINES:%=-D%) -DCCODE > $@ diff --git a/lib/make/make.configuration b/lib/make/make.configuration index 113f4c7e..2bdfde45 100644 --- a/lib/make/make.configuration +++ b/lib/make/make.configuration @@ -9,12 +9,15 @@ # @@*/ # Silence all but designated output -.SILENT: +#.SILENT: # Some configuration variables CONFIG = $(TOP)/config-data BINDINGS_DIR = $(TOP)/bindings +# Scratch build area - need this to make sure F90 module files end up all +# in one directory. +export SCRATCH_BUILD=$(TOP)/scratch DATESTAMP = $(CCTK_HOME)/src/datestamp.c export MAKE_DIR = $(CCTK_HOME)/lib/make @@ -55,6 +58,7 @@ $(EXE): $(CONFIG)/make.thornlist $(patsubst %,$(CCTK_LIBDIR)/lib%.a,$(notdir $(T $(CCTK_LIBDIR)/lib%.a: update @echo $(DIVIDER) @echo Checking status of $(notdir $@) + if [ ! -d $(SCRATCH_BUILD) ]; then $(MKDIR) $(SCRATCH_BUILD) ; fi if [ ! -d $(BUILD_DIR) ]; then $(MKDIR) $(BUILD_DIR) ; fi thorn_name=$(@:$(CCTK_LIBDIR)/lib%.a=%); \ if [ "$$thorn_name" = "Cactus" ] ; then src_dir=$(CCTK_HOME)/src ; \ @@ -106,4 +110,5 @@ $(TOP)/ActiveThorns: update: clean: - find $(TOP) -name '*.o' -o -name '*.a' -exec rm {} \; + @echo Deleting all object files in $(TOP) + find $(TOP) \( -name '*.o' -o -name '*.a' \) -exec rm {} \; diff --git a/lib/make/make.thornlib b/lib/make/make.thornlib index d0ae1667..79d427ca 100644 --- a/lib/make/make.thornlib +++ b/lib/make/make.thornlib @@ -11,6 +11,10 @@ # Silence all but designated output #.SILENT: +# Dividers to make the screen output slightly nicer +DIVEL = __________________ +DIVIDER = $(DIVEL)$(DIVEL)$(DIVEL)$(DIVEL) + # Include the main make definitions for this configuration include $(CONFIG)/make.config.defn @@ -48,6 +52,7 @@ SRCS = $(CCTK_SRCS) OBJS = $(patsubst %,%.o,$(basename $(SRCS))) $(NAME): $(addsuffix .check, $(SUBDIRS)) $(OBJS) $(SRCDIR)/make.code.defn $(foreach DIR,$(SUBDIRS), $(SRCDIR)/$(DIR)/make.code.defn) + @echo $(DIVIDER) if [ -r $(NAME) ] ; then echo Updating $(NAME) ; else echo Creating $(NAME) ; fi $(AR) $(ARFLAGS) $@ $(OBJS) # $(RANLIB) $@ -- cgit v1.2.3