Skip to content
Snippets Groups Projects
Commit 543fa826 authored by Arseny Kapoulkine's avatar Arseny Kapoulkine
Browse files

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
parent 7b41dce8
No related branches found
No related tags found
No related merge requests found
......@@ -2,4 +2,7 @@ language: cpp
compiler:
- clang
- gcc
script: make -f tests/Makefile.travis test
\ No newline at end of file
env:
- DEFINES=standard
- DEFINES=PUGIXML_WCHAR_MODE
script: make test defines=$(DEFINES) -j2
\ No newline at end of file
CXXFLAGS=-c -Wall -Wextra -Werror -pedantic
config=debug
defines=standard
BUILD=build/travis
BUILD=build/make-$(CXX)-$(config)-$(defines)
SOURCES=src/pugixml.cpp $(wildcard tests/*.cpp)
OBJECTS=$(SOURCES:%=$(BUILD)/%.o)
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)/%.cpp.o: %.cpp
mkdir -p $(dir $@)
$(CXX) $(CXXFLAGS) $< -o $@
$(BUILD)/%.o: %
@mkdir -p $(dir $@)
$(CXX) $< $(CXXFLAGS) -MMD -MP -o $@
clean:
rm -rf $(BUILD)
-include $(OBJECTS:.o=.d)
.PHONY: all test clean
\ No newline at end of file
.PHONY: all test clean
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment