diff options
-rw-r--r-- | .travis.yml | 5 | ||||
-rw-r--r-- | Makefile | 40 | ||||
-rw-r--r-- | tests/Makefile.travis | 24 |
3 files changed, 44 insertions, 25 deletions
diff --git a/.travis.yml b/.travis.yml index 95fa3e6..0f508bd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..eddd4f2 --- /dev/null +++ b/Makefile @@ -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
\ No newline at end of file diff --git a/tests/Makefile.travis b/tests/Makefile.travis deleted file mode 100644 index 02f22e7..0000000 --- a/tests/Makefile.travis +++ /dev/null @@ -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
\ No newline at end of file |