# make.configuration.deps file for thorn Formaline -*-Makefile-*- # $Header$ # Some configury magic TAR = $(shell gtar > /dev/null 2> /dev/null && echo gtar || echo tar) # Create a tarball of the source code whenever this thorn is linked # into an executable TARBALL_DIR = $(SCRATCH_BUILD) #CACTUSLIBLINKLINE += $(CCTK_LIBDIR)/$(LIBNAME_PREFIX)$(CCTK_LIBNAME_PREFIX)Formaline-cactus-source$(LIBNAME_SUFFIX) CACTUSLIBLINKLINE += -l$(CCTK_LIBNAME_PREFIX)Formaline-cactus-source $(EXEDIR)$(DIRSEP)$(EXE): $(CCTK_LIBDIR)/$(LIBNAME_PREFIX)$(CCTK_LIBNAME_PREFIX)Formaline-cactus-source$(LIBNAME_SUFFIX) $(CCTK_LIBDIR)/$(LIBNAME_PREFIX)$(CCTK_LIBNAME_PREFIX)Formaline-cactus-source$(LIBNAME_SUFFIX): $(TARBALL_DIR)/cactus-meta-source.o $(TARBALL_DIR)/build-id.o $(TARBALL_DIR)/cactus-flesh-source.o $(patsubst %,$(TARBALL_DIR)/cactus-thorn-source-%.o,$(notdir $(THORNS))) $(AR) $(ARFLAGS) $@ $^ if test "x$(USE_RANLIB)" = "xyes" ; then $(RANLIB) $(RANLIBFLAGS) $@ ; fi @echo $(DIVIDER) .PRECIOUS: $(CCTK_LIBDIR)/$(LIBNAME_PREFIX)$(CCTK_LIBNAME_PREFIX)Formaline-cactus-source$(LIBNAME_SUFFIX) ## Cache optimisation: ## Build the thorns' tarballs already while the thorns are compiled ## (does not work) # #$(CCTK_LIBDIR)/$(LIBNAME_PREFIX)$(CCTK_LIBNAME_PREFIX)%$(LIBNAME_SUFFIX): $(TARBALL_DIR)/cactus-thorn-source-%.o # Unique ID for the build $(TARBALL_DIR)/build-id.o: $(TARBALL_DIR)/build-id.c $(CC) $(CFLAGS) -c -o $@ $^ # (force a new ID to be created every time) .PHONY: $(TARBALL_DIR)/build-id.c $(TARBALL_DIR)/build-id.c: { \ echo '/* This is an auto-generated file -- do not edit */'; \ hostname=`hostname`; \ user="$$USER"; \ timestamp=`date +%Y%m%d-%H%M%S`; \ pid="$$$$"; \ id="build-$$hostname-$$user-$$timestamp-$$pid"; \ echo 'char const build_id[] = "'$$id'";'; \ } > $@ .PRECIOUS: $(TARBALL_DIR)/build-id.c $(TARBALL_DIR)/build-id.o # Meta information $(TARBALL_DIR)/cactus-meta-source.o: $(TARBALL_DIR)/cactus-meta-source.c $(CC) $(CFLAGS) -c -o $@ $^ $(TARBALL_DIR)/cactus-meta-source.c: $(TARBALL_DIR)/cactus-flesh-source.c $(patsubst %,$(TARBALL_DIR)/cactus-thorn-source-%.c,$(notdir $(THORNS))) $(TARBALL_DIR)/makemetablob Cactus $(notdir $(THORNS)) > $@ .PRECIOUS: $(TARBALL_DIR)/cactus-meta-source.c $(TARBALL_DIR)/cactus-meta-source.o #cleandeps: # rm -rf $(TOP)/scratch/cactus-flesh-source.files $(TOP)/scratch/cactus-flesh-source.ccldeps $(TOP)/scratch/cactus-thorn-source-*.files $(TOP)/scratch/cactus-thorn-source-*.ccldeps ############################################################################### # Flesh ############################################################################### $(TARBALL_DIR)/cactus-flesh-source.o: $(TARBALL_DIR)/cactus-flesh-source.c @echo "Creating tarball for the flesh" $(CC) $(CFLAGS) -c -o $@ $^ $(TARBALL_DIR)/cactus-flesh-source.c: $(TARBALL_DIR)/cactus-flesh-source.tar.gz $(CCTK_HOME)/arrangements/AEIThorns/Formaline/src/util/VERSION $(TARBALL_DIR)/makeblob '' Cactus $(@:%.c=%) < $< > $@ $(TARBALL_DIR)/cactus-flesh-source.tar.gz: $(TARBALL_DIR)/cactus-flesh-source.files cd $(CCTK_HOME) && \ $(TAR) czf $@ -T $< # This dependency means that the tarball for a thorn is only updated # if the thorn is actually recompiled. This does not catch changes to # files that do not influence the executable. $(TARBALL_DIR)/cactus-flesh-source.files: $(CCTK_LIBDIR)/$(LIBNAME_PREFIX)$(CCTK_LIBNAME_PREFIX)$(FLESHLIB)$(LIBNAME_SUFFIX) $(TARBALL_DIR)/cactus-flesh-source.ccldeps cd $(CCTK_HOME) && \ find CONTRIBUTORS COPYRIGHT Makefile lib src \ configs/$(notdir $(TOP))/ThornList \ configs/$(notdir $(TOP))/config-data \ configs/$(notdir $(TOP))/config-info \ -name '.*' -prune -o \ -name '*~' -prune -o \ -not -type d \ -print > $@ -include $(TARBALL_DIR)/cactus-flesh-source.ccldeps # Make aborts if these dependencies vanish. Therefore mention only files # here that cannot go away. $(TARBALL_DIR)/cactus-flesh-source.ccldeps: { \ echo "$(@:%.ccldeps=%.files) \\"; \ echo "$@: \\"; \ echo " $(CCTK_HOME)/src/interface.ccl \\"; \ echo " $(CCTK_HOME)/src/param.ccl \\"; \ echo " $(CCTK_HOME)/src/schedule.ccl"; \ } > $@ .PRECIOUS: $(TARBALL_DIR)/cactus-flesh-source.ccldeps $(TARBALL_DIR)/cactus-flesh-source.files $(TARBALL_DIR)/cactus-flesh-source.tar.gz $(TARBALL_DIR)/cactus-flesh-source.c $(TARBALL_DIR)/cactus-flesh-source.o ############################################################################### # Thorns ############################################################################### $(TARBALL_DIR)/cactus-thorn-source-%.o: $(TARBALL_DIR)/cactus-thorn-source-%.c @echo "Creating tarball for thorn $(@:$(TARBALL_DIR)/cactus-thorn-source-%.o=%)" $(CC) $(CFLAGS) -c -o $@ $^ $(TARBALL_DIR)/cactus-thorn-source-%.c: $(TARBALL_DIR)/cactus-thorn-source-%.tar.gz $(CCTK_HOME)/arrangements/AEIThorns/Formaline/src/util/VERSION $(TARBALL_DIR)/makeblob $(patsubst %/,%,$(dir $(filter %/$(@:$(TARBALL_DIR)/cactus-thorn-source-%.c=%),$(THORNS)))) $(@:$(TARBALL_DIR)/cactus-thorn-source-%.c=%) $(@:%.c=%) < $< > $@ $(TARBALL_DIR)/cactus-thorn-source-%.tar.gz: $(TARBALL_DIR)/cactus-thorn-source-%.files cd $(CCTK_HOME) && \ $(TAR) czf $@ -T $< # This dependency means that the tarball for a thorn is only updated # if the thorn is actually recompiled. This does not catch changes to # files that do not influence the executable. $(TARBALL_DIR)/cactus-thorn-source-%.files: $(CCTK_LIBDIR)/$(LIBNAME_PREFIX)$(CCTK_LIBNAME_PREFIX)%$(LIBNAME_SUFFIX) $(TARBALL_DIR)/cactus-thorn-source-%.ccldeps cd $(CCTK_HOME) && \ find arrangements/$(filter %/$(@:$(TARBALL_DIR)/cactus-thorn-source-%.files=%),$(THORNS)) \ -path 'arrangements/*/*/doc' -prune -o \ -path 'arrangements/*/*/par' -prune -o \ -path 'arrangements/*/*/test' -prune -o \ -name '.*' -prune -o \ -name '*~' -prune -o \ -not -type d \ -print > $@ -include $(patsubst %,$(TARBALL_DIR)/cactus-thorn-source-%.ccldeps,$(notdir $(THORNS))) # Make aborts if these dependencies vanish. Therefore mention only files # here that cannot go away. $(TARBALL_DIR)/cactus-thorn-source-%.ccldeps: { \ echo "$(@:%.ccldeps=%.files) \\"; \ echo "$@: \\"; \ echo " $(CCTK_HOME)/arrangements/$(filter %/$(@:$(TARBALL_DIR)/cactus-thorn-source-%.ccldeps=%),$(THORNS))/interface.ccl \\"; \ echo " $(CCTK_HOME)/arrangements/$(filter %/$(@:$(TARBALL_DIR)/cactus-thorn-source-%.ccldeps=%),$(THORNS))/param.ccl \\"; \ echo " $(CCTK_HOME)/arrangements/$(filter %/$(@:$(TARBALL_DIR)/cactus-thorn-source-%.ccldeps=%),$(THORNS))/schedule.ccl"; \ } > $@ .PRECIOUS: $(TARBALL_DIR)/cactus-thorn-source-%.ccldeps $(TARBALL_DIR)/cactus-thorn-source-%.files $(TARBALL_DIR)/cactus-thorn-source-%.tar.gz $(TARBALL_DIR)/cactus-thorn-source-%.c $(TARBALL_DIR)/cactus-thorn-source-%.o