Only syntax check generated header when not using run test
There is no need to syntax check the header if it's going to be really used, so this is a small optimization. It also separates building of the wrappers from testing them better.
This commit is contained in:
parent
87d4a0da71
commit
4d774887cc
2 changed files with 34 additions and 10 deletions
|
|
@ -1740,17 +1740,21 @@ c: $(SRCDIR_SRCS)
|
|||
$(SWIG) -c $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
|
||||
$(CC) -c $(CCSHARED) -I$(SRCDIR) $(CFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES)
|
||||
$(C_LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(CLIBPREFIX)$(TARGET)$(C_SO)
|
||||
$(SYNTAX_CHECK) -I$(SRCDIR)$(INTERFACEDIR) $(IWRAP:.i=.h)
|
||||
|
||||
c_cpp: $(SRCDIR_SRCS)
|
||||
$(SWIG) -c++ -c $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
|
||||
$(CXX) -c $(CCSHARED) -I$(SRCDIR) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_CXXSRCS) $(INCLUDES)
|
||||
$(CXX_LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(CLIBPREFIX)$(TARGET)$(C_SO)
|
||||
$(SYNTAX_CHECK) -I$(SRCDIR)$(INTERFACEDIR) $(IWRAP:.i=.h)
|
||||
|
||||
c_compile: $(SRCDIR)$(RUNME).c
|
||||
$(COMPILETOOL) $(CC) $(CFLAGS) -o $(RUNME) -I. -I.. $< -L. -l$(TARGET)
|
||||
|
||||
# This target is used for the unit tests: if we don't have any test code to
|
||||
# run, we at least can check that the generated header can be included without
|
||||
# giving any syntax errors.
|
||||
c_syntax_check:
|
||||
$(SYNTAX_CHECK) -I$(SRCDIR)$(INTERFACEDIR) $(C_HEADER)
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Run C example
|
||||
# -----------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -213,7 +213,13 @@ SRCDIR = ../$(srcdir)/
|
|||
%.multicpptest:
|
||||
$(setup)
|
||||
+(cd $* && $(swig_and_compile_multi_cpp))
|
||||
$(run_testcase)
|
||||
+if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
|
||||
$(do_run_testcase); \
|
||||
else \
|
||||
cd $* && for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list`; do \
|
||||
$(call syntax_check_testcase,$${f}) || exit 1; \
|
||||
done; \
|
||||
fi
|
||||
|
||||
# Makes a directory for the testcase if it does not exist
|
||||
setup = \
|
||||
|
|
@ -226,15 +232,29 @@ setup = \
|
|||
mkdir $*; \
|
||||
fi;
|
||||
|
||||
# Compiles C files then runs the testcase. A testcase is only run if
|
||||
# a file is found which has _runme.c appended after the testcase name.
|
||||
# Checks the header syntax if there is no runnable testcase for it.
|
||||
syntax_check_testcase = \
|
||||
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \
|
||||
SRCDIR='$(SRCDIR)' \
|
||||
INTERFACEDIR='$(INTERFACEDIR)' \
|
||||
C_HEADER=$1_wrap.h \
|
||||
c_syntax_check
|
||||
|
||||
# Compiles C files then runs the testcase unconditionally.
|
||||
do_run_testcase = \
|
||||
cd $* && $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \
|
||||
SRCDIR='$(SRCDIR)' \
|
||||
RUNME=$*_runme \
|
||||
TARGET='$*' \
|
||||
c_run
|
||||
|
||||
# Only compile and run testcase if a file with _rume.c appended to the testcase
|
||||
# name is found, otherwise only check the syntax of the generated files.
|
||||
run_testcase = \
|
||||
+if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
|
||||
cd $* && $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \
|
||||
SRCDIR='$(SRCDIR)' \
|
||||
RUNME=$*_runme \
|
||||
TARGET='$*' \
|
||||
c_run; \
|
||||
$(do_run_testcase); \
|
||||
else \
|
||||
cd $* && $(call syntax_check_testcase,$*); \
|
||||
fi
|
||||
|
||||
# Clean: remove testcase directories
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue