[med-svn] [bart] 13/14: rework main dispatch
Martin Uecker
uecker-guest at moszumanska.debian.org
Sun Dec 6 23:10:36 UTC 2015
This is an automated email from the git hooks/post-receive script.
uecker-guest pushed a commit to annotated tag v0.2.09d
in repository bart.
commit d689d04667b04f7cf52791a562bc86897fb6a4c3
Author: Martin Uecker <muecker at gwdg.de>
Date: Sun Dec 6 22:10:18 2015 +0100
rework main dispatch
---
Makefile | 14 ++++++++------
rules/box.mk | 2 --
src/bart.c | 10 +++-------
src/bbox.c | 1 +
src/main.c | 8 ++++++++
src/main.h | 12 ++++++++++++
6 files changed, 32 insertions(+), 15 deletions(-)
diff --git a/Makefile b/Makefile
index 6c46f2e..829e8d6 100644
--- a/Makefile
+++ b/Makefile
@@ -53,8 +53,7 @@ export TOOLBOX_PATH=$(root)
DEPFILE = $(*D)/.$(*F).d
DEPFLAG = -MMD -MF $(DEPFILE)
-#ALLDEPS = $(shell find $(srcdir) -name ".*.d")
-ALLDEPS = $(shell find $(root) -name ".*.d")
+ALLDEPS = $(shell find $(srcdir) -name ".*.d")
# Compilation flags
@@ -332,9 +331,12 @@ all: .gitignore $(TARGETS)
# special targets
-bbox: CPPFLAGS += -DMAIN_LIST="$(BTARGETS:%=%,) ()"
+$(XTARGETS): CPPFLAGS += -DMAIN_LIST="$(XTARGETS:%=%,) ()" -include src/main.h
-bart: CPPFLAGS += -DMAIN_LIST="$(YTARGETS:%=%,) ()"
+
+bbox: CPPFLAGS += -DMAIN_LIST="$(BTARGETS:%=%,) ()" -include src/main.h
+
+bart: CPPFLAGS += -DMAIN_LIST="$(YTARGETS:%=%,) ()" -include src/main.h
ismrmrd: $(srcdir)/ismrmrd.c -lismrm -lnum -lmisc
@@ -370,8 +372,8 @@ $(BTARGETS): bbox
.SECONDEXPANSION:
-$(ZTARGETS): % : $(srcdir)/%.c $$(MODULES_%) $(MODULES)
- $(CC) $(LDFLAGS) $(CPPFLAGS) $(CFLAGS) -Dmain_$@=main -o $@ $+ $(FFTW_L) $(CUDA_L) $(BLAS_L) $(GSL_L) $(PNG_L) -lm
+$(ZTARGETS): % : src/main.c $(srcdir)/%.o $$(MODULES_%) $(MODULES)
+ $(CC) $(LDFLAGS) $(CFLAGS) -Dmain_real=main_$@ -o $@ $+ $(FFTW_L) $(CUDA_L) $(BLAS_L) $(GSL_L) $(PNG_L) -lm
# rm $(srcdir)/$@.o
diff --git a/rules/box.mk b/rules/box.mk
index 2dac213..a093a30 100644
--- a/rules/box.mk
+++ b/rules/box.mk
@@ -7,7 +7,6 @@ boxobjs := $(boxsrcs:.c=.o)
.INTERMEDIATE: $(boxobjs)
lib/libbox.a: libbox.a($(boxobjs))
-lib/libbox.a: CFLAGS += -Wno-missing-prototypes
box2srcs := $(XTARGETS:%=src/%.c)
@@ -16,7 +15,6 @@ box2objs := $(box2srcs:.c=.o)
.INTERMEDIATE: $(box2objs)
lib/libbox2.a: libbox2.a($(box2objs))
-lib/libbox2.a: CFLAGS += -Wno-missing-prototypes
diff --git a/src/bart.c b/src/bart.c
index 870ad09..2ff1fa9 100644
--- a/src/bart.c
+++ b/src/bart.c
@@ -15,11 +15,7 @@
#include "misc/misc.h"
#include "misc/cppmap.h"
-
-#define DECLMAIN(x) \
-extern int main_ ## x(int argc, char* argv[]);
-MAP(DECLMAIN, MAIN_LIST)
-#undef DECLMAIN
+#include "main.h"
struct {
@@ -49,7 +45,7 @@ static void usage(void)
printf("\n");
}
-int main(int argc, char* argv[])
+int main_bart(int argc, char* argv[])
{
char* bn = basename(argv[0]);
@@ -61,7 +57,7 @@ int main(int argc, char* argv[])
exit(1);
}
- return main(argc - 1, argv + 1);
+ return main_bart(argc - 1, argv + 1);
}
for (int i = 0; NULL != dispatch_table[i].name; i++) {
diff --git a/src/bbox.c b/src/bbox.c
index 8d19df0..1eb0c2e 100644
--- a/src/bbox.c
+++ b/src/bbox.c
@@ -1,3 +1,4 @@
+#define main_bart main_bbox
#include "bart.c"
diff --git a/src/main.c b/src/main.c
new file mode 100644
index 0000000..ed0b846
--- /dev/null
+++ b/src/main.c
@@ -0,0 +1,8 @@
+
+extern int main_real(int argc, char** argv);
+
+int main(int argc, char** argv)
+{
+ return main_real(argc, argv);
+}
+
diff --git a/src/main.h b/src/main.h
new file mode 100644
index 0000000..7bd05d1
--- /dev/null
+++ b/src/main.h
@@ -0,0 +1,12 @@
+
+#include "misc/cppmap.h"
+
+
+#define DECLMAIN(x) \
+extern int main_ ## x(int argc, char* argv[]);
+MAP(DECLMAIN, MAIN_LIST)
+#undef DECLMAIN
+
+extern int main_bart(int argc, char* argv[]);
+extern int main_bbox(int argc, char* argv[]);
+
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/bart.git
More information about the debian-med-commit
mailing list