Reuse c_compile rule in C unit test suite makefile

No real changes, just reuse the commands defined in the C section of the top
level Examples/Makefile instead of (imperfectly, i.e. CFLAGS was forgotten
here) duplicating them in Examples/test-suite/c/Makefile.
This commit is contained in:
Vadim Zeitlin 2016-04-20 17:09:52 +02:00
commit 87d4a0da71
2 changed files with 8 additions and 5 deletions

View file

@ -1749,7 +1749,7 @@ c_cpp: $(SRCDIR_SRCS)
$(SYNTAX_CHECK) -I$(SRCDIR)$(INTERFACEDIR) $(IWRAP:.i=.h)
c_compile: $(SRCDIR)$(RUNME).c
$(COMPILETOOL) $(CC) $(CFLAGS) -o $(RUNME) -I. $< -L. -l$(TARGET)
$(COMPILETOOL) $(CC) $(CFLAGS) -o $(RUNME) -I. -I.. $< -L. -l$(TARGET)
# -----------------------------------------------------------------
# Run C example

View file

@ -229,10 +229,13 @@ setup = \
# 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.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then (\
cd $* && $(COMPILETOOL) $(CC) ../$(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) -I.. -L. -l$* -o $*_runme && \
env LD_LIBRARY_PATH=".:$$LD_LIBRARY_PATH" PATH=".:$$PATH" SHLIB_PATH=".:$$SHLIB_PATH" DYLD_LIBRARY_PATH=".:$$DYLD_LIBRARY_PATH" $(RUNTOOL) ./$*_runme;) \
fi;
+if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
cd $* && $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \
SRCDIR='$(SRCDIR)' \
RUNME=$*_runme \
TARGET='$*' \
c_run; \
fi
# Clean: remove testcase directories
%.clean: