mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 17:26:01 +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:
parent
0b1f59dc76
commit
084aa63172
2 changed files with 38 additions and 17 deletions
|
@ -1,17 +1,38 @@
|
||||||
src = $(wildcard *.cc *.c)
|
BINDIR = ../bin
|
||||||
destDir = ../bin
|
SRC_C = $(wildcard *.c)
|
||||||
GCCFLAGS = -gdwarf-2 -pthread
|
SRC_CXX = $(wildcard *.cc)
|
||||||
|
|
||||||
all:
|
# Use .exe extension so that files are named the same way in Linux and Windows.
|
||||||
@mkdir -p $(destDir)
|
BINS = $(patsubst %.c,$(BINDIR)/%.exe,$(SRC_C)) $(patsubst %.cc,$(BINDIR)/%.exe,$(SRC_CXX))
|
||||||
# Name the target with an .exe extension so that CVS does not
|
COREFILE = $(BINDIR)/core
|
||||||
# include it when making a patch
|
|
||||||
@for file in $(src) ; \
|
CC = gcc
|
||||||
do \
|
CFLAGS = -gdwarf-2 -pthread
|
||||||
target=`basename $$file .c` ; \
|
|
||||||
target=`basename $$target .cc` ; \
|
CXX = g++
|
||||||
g++ $(GCCFLAGS) $$file -o $(destDir)/$$target.exe ; \
|
CXXFLAGS = -gdwarf-2 -pthread
|
||||||
done
|
|
||||||
# Now generate the core file that we need for the post-mortem core-file tests
|
MKDIR = mkdir -p
|
||||||
@gdb --nx --batch -ex "b testLocals" -ex run -ex "next 16" -ex "gcore ../bin/core" \
|
RM = rm -f
|
||||||
../bin/ExpressionTestApp.exe > /dev/null
|
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)
|
||||||
|
|
|
@ -21,7 +21,7 @@ void firstBreakpoint(long id)
|
||||||
|
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
unsigned int __stdcall PrintHello(void *threadid)
|
unsigned int __stdcall PrintHello(void *threadId)
|
||||||
#else
|
#else
|
||||||
void *PrintHello(void *threadId)
|
void *PrintHello(void *threadId)
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue