blob: cc429483927e11439fb7fd41e03bb7430990c20b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
# make.configuration.deps file for thorn Formaline -*-Makefile-*-
# $Header$
# 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)
## 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 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'";'; \
} > $@
# 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)) > $@
# 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
$(TARBALL_DIR)/makeblob '' Cactus < $< > $@
$(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, but that is okay.
$(TARBALL_DIR)/cactus-flesh-source.files: $(CCTK_LIBDIR)/$(LIBNAME_PREFIX)$(CCTK_LIBNAME_PREFIX)Cactus$(LIBNAME_SUFFIX)
cd $(CCTK_HOME) && \
find CONTRIBUTORS COPYRIGHT Makefile lib src \
configs/$(notdir $(TOP))/config-info \
configs/$(notdir $(TOP))/ThornList \
-name '.*' -prune -o \
-name '*~' -prune -o \
-not -type d \
-print > $@
# 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
$(TARBALL_DIR)/makeblob $(patsubst %/,%,$(dir $(filter %/$(@:$(TARBALL_DIR)/cactus-thorn-source-%.c=%),$(THORNS)))) $(@:$(TARBALL_DIR)/cactus-thorn-source-%.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, but that is okay.
$(TARBALL_DIR)/cactus-thorn-source-%.files: $(CCTK_LIBDIR)/$(LIBNAME_PREFIX)$(CCTK_LIBNAME_PREFIX)%$(LIBNAME_SUFFIX)
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 > $@
|