1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-05 00:36:16 +02:00

dsf-gdb tests: Improve tests Makefile

This changes the Makefile that builds test apps so that it uses the
proper Makefile structures, rather than a single shell command.

Also, this will compile .c files with gcc and .cc files with g++,
allowing to have both.

Also, I changed the .exe extension justification from "so that CVS does
not include it when making a patch" to "so that files are named the same
way in Linux and Windows". It seems more reasonable.

Change-Id: I4414b1dc5c31a9eaa7edaed30e53363b9a76dd8f
Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca>
Reviewed-on: https://git.eclipse.org/r/36488
Tested-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Tested-by: Hudson CI
Reviewed-by: Marc Khouzam <marc.khouzam@ericsson.com>
Tested-by: Marc Khouzam <marc.khouzam@ericsson.com>
This commit is contained in:
Simon Marchi 2014-11-14 10:57:29 -05:00 committed by Marc Khouzam
parent 0b1f59dc76
commit 084aa63172
2 changed files with 38 additions and 17 deletions

View file

@ -1,17 +1,38 @@
src = $(wildcard *.cc *.c)
destDir = ../bin
GCCFLAGS = -gdwarf-2 -pthread
BINDIR = ../bin
SRC_C = $(wildcard *.c)
SRC_CXX = $(wildcard *.cc)
all:
@mkdir -p $(destDir)
# Name the target with an .exe extension so that CVS does not
# include it when making a patch
@for file in $(src) ; \
do \
target=`basename $$file .c` ; \
target=`basename $$target .cc` ; \
g++ $(GCCFLAGS) $$file -o $(destDir)/$$target.exe ; \
done
# Now generate the core file that we need for the post-mortem core-file tests
@gdb --nx --batch -ex "b testLocals" -ex run -ex "next 16" -ex "gcore ../bin/core" \
../bin/ExpressionTestApp.exe > /dev/null
# Use .exe extension so that files are named the same way in Linux and Windows.
BINS = $(patsubst %.c,$(BINDIR)/%.exe,$(SRC_C)) $(patsubst %.cc,$(BINDIR)/%.exe,$(SRC_CXX))
COREFILE = $(BINDIR)/core
CC = gcc
CFLAGS = -gdwarf-2 -pthread
CXX = g++
CXXFLAGS = -gdwarf-2 -pthread
MKDIR = mkdir -p
RM = rm -f
RMDIR = rmdir
.PHONY: all clean
all: $(BINS) $(COREFILE)
$(BINDIR):
$(MKDIR) $@
$(BINDIR)/%.exe: %.c | $(BINDIR)
$(CC) $(CFLAGS) -o $@ $<
$(BINDIR)/%.exe: %.cc | $(BINDIR)
$(CXX) $(CXXFLAGS) -o $@ $<
# Generate a core file that is needed for post-morted core-file tests
$(COREFILE): $(BINDIR)/ExpressionTestApp.exe | $(BINDIR)
gdb -nx --batch -ex 'b testLocals' -ex 'run' --ex 'next 16' \
-ex 'gcore ../bin/core' $(BINDIR)/ExpressionTestApp.exe > /dev/null
clean:
$(RM) -r $(BINDIR)

View file

@ -21,7 +21,7 @@ void firstBreakpoint(long id)
#ifdef __MINGW32__
unsigned int __stdcall PrintHello(void *threadid)
unsigned int __stdcall PrintHello(void *threadId)
#else
void *PrintHello(void *threadId)
#endif