Add Makefile for building and running tests.
This expands and replaces the Travis-specific makefile by adding more options and correctly tracking header dependencies. Also add wchar_t mode test to Travis configuration. git-svn-id: http://pugixml.googlecode.com/svn/trunk@971 99668b35-9821-0410-8761-19e4c4f06640
This commit is contained in:
parent
7b41dce85e
commit
543fa8268d
@ -2,4 +2,7 @@ language: cpp
|
|||||||
compiler:
|
compiler:
|
||||||
- clang
|
- clang
|
||||||
- gcc
|
- gcc
|
||||||
script: make -f tests/Makefile.travis test
|
env:
|
||||||
|
- DEFINES=standard
|
||||||
|
- DEFINES=PUGIXML_WCHAR_MODE
|
||||||
|
script: make test defines=$(DEFINES) -j2
|
||||||
40
Makefile
Normal file
40
Makefile
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
config=debug
|
||||||
|
defines=standard
|
||||||
|
|
||||||
|
BUILD=build/make-$(CXX)-$(config)-$(defines)
|
||||||
|
|
||||||
|
SOURCES=src/pugixml.cpp $(wildcard tests/*.cpp)
|
||||||
|
EXECUTABLE=$(BUILD)/test
|
||||||
|
|
||||||
|
CXXFLAGS=-c -g -Wall -Wextra -Werror -pedantic
|
||||||
|
LDFLAGS=
|
||||||
|
|
||||||
|
ifeq ($(config),release)
|
||||||
|
CXXFLAGS+=-O3 -DNDEBUG
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(defines),standard)
|
||||||
|
COMMA=,
|
||||||
|
CXXFLAGS+=-D $(subst $(COMMA), -D ,$(defines))
|
||||||
|
endif
|
||||||
|
|
||||||
|
OBJECTS=$(SOURCES:%=$(BUILD)/%.o)
|
||||||
|
|
||||||
|
all: $(EXECUTABLE)
|
||||||
|
|
||||||
|
test: $(EXECUTABLE)
|
||||||
|
./$(EXECUTABLE)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf $(BUILD)
|
||||||
|
|
||||||
|
$(EXECUTABLE): $(OBJECTS)
|
||||||
|
$(CXX) $(OBJECTS) $(LDFLAGS) -o $@
|
||||||
|
|
||||||
|
$(BUILD)/%.o: %
|
||||||
|
@mkdir -p $(dir $@)
|
||||||
|
$(CXX) $< $(CXXFLAGS) -MMD -MP -o $@
|
||||||
|
|
||||||
|
-include $(OBJECTS:.o=.d)
|
||||||
|
|
||||||
|
.PHONY: all test clean
|
||||||
@ -1,24 +0,0 @@
|
|||||||
CXXFLAGS=-c -Wall -Wextra -Werror -pedantic
|
|
||||||
|
|
||||||
BUILD=build/travis
|
|
||||||
|
|
||||||
SOURCES=src/pugixml.cpp $(wildcard tests/*.cpp)
|
|
||||||
OBJECTS=$(SOURCES:%=$(BUILD)/%.o)
|
|
||||||
EXECUTABLE=$(BUILD)/test
|
|
||||||
|
|
||||||
all: $(EXECUTABLE)
|
|
||||||
|
|
||||||
test: $(EXECUTABLE)
|
|
||||||
./$(EXECUTABLE)
|
|
||||||
|
|
||||||
$(EXECUTABLE): $(OBJECTS)
|
|
||||||
$(CXX) $(OBJECTS) $(LDFLAGS) -o $@
|
|
||||||
|
|
||||||
$(BUILD)/%.cpp.o: %.cpp
|
|
||||||
mkdir -p $(dir $@)
|
|
||||||
$(CXX) $(CXXFLAGS) $< -o $@
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -rf $(BUILD)
|
|
||||||
|
|
||||||
.PHONY: all test clean
|
|
||||||
Loading…
Reference in New Issue
Block a user