CXX = g++ ifeq (Darwin, $(shell uname)) INCLUDEDIRS = -I/opt/local/include/UnitTest++ UNITTESTLIB = /opt/local/lib/libUnitTest++.a endif ifeq (Linux, $(shell uname)) INCLUDEDIRS = -I/usr/include/unittest++ UNITTESTLIB = /usr/lib/libUnitTest++.a endif CPPFLAGS = -O3 -Wall -Wextra -ansi $(INCLUDEDIRS) #.SUFFIXES: .o .cpp app = wordlist2hunspell test = testwordlist2hunspell src = stringparser.cpp \ wordlistparser.cpp \ wordlistparsernocompound.cpp \ wordlistparserall.cpp \ setoptimizer.cpp \ hunspellprinternocompounding.cpp \ hunspellprintercompounding.cpp test_src = tests/testhelpers.cpp \ tests/teststringparser.cpp \ tests/testwordlistparsernocompound.cpp \ tests/testwordlistparserall.cpp \ tests/testsetoptimizer.cpp \ tests/testhunspellprinternocompounding.cpp \ tests/testhunspellprintercompounding.cpp headers = $(patsubst %.cpp, %.h, $(src)) objects = $(patsubst %.cpp, %.o, $(src)) test_objects = $(patsubst %.cpp, %.o, $(test_src)) all: $(test) $(app) $(app): $(headers) $(objects) main.o @echo Linking $(app) ... @$(CXX) $(LDFLAGS) -o $(app) main.o $(objects) $(test): $(headers) $(test_objects) $(objects) tests/main.o @echo Linking $(test) ... @$(CXX) $(LDFLAGS) -o $(test) tests/main.o $(test_objects) $(objects) $(UNITTESTLIB) @echo Running unit tests... @./$(test) clean: -@rm -f $(objects) $(test_objects) $(test) $(lib) main.o tests/main.o *~ tests/*~ 2> /dev/null