test/Makefile
changeset 48 9ff5d2dfa75a
parent 46 7471e31bb278
child 50 e713c3e6faf1
     1.1 --- a/test/Makefile	Mon Jan 26 13:11:40 2015 +0100
     1.2 +++ b/test/Makefile	Sun Feb 08 11:33:04 2015 -0500
     1.3 @@ -1,55 +1,26 @@
     1.4  include ../Makefile.conf
     1.5  
     1.6 -ifeq ($(BUILD_FOR),Windoze)
     1.7 -CXX=i686-w64-mingw32-g++
     1.8 -LD=i686-w64-mingw32-c++
     1.9 -LDFLAGS=-lstdc++
    1.10 -else ifeq ($(BUILD_FOR),MINGW32_NT-6.1)
    1.11 -CXX=g++ -std=gnu++11 -DWIN32 -pthread
    1.12 -LD=g++
    1.13 -LDFLAGS=-L../src -lpEpEngine -lstdc++
    1.14 -else
    1.15  CC=g++ -std=gnu++11 -pthread
    1.16  CXX=g++ -std=gnu++11 -pthread
    1.17 -LD=g++
    1.18 +LD=$(CXX)
    1.19  LDFLAGS=-L$(HOME)/lib -lpEpEngine -lstdc++
    1.20 -endif
    1.21  CXXFLAGS=-g -O0 -I../src
    1.22  # CXXFLAGS=-O3 -DNDEBUG
    1.23  
    1.24  TARGET=pEpEngineTest
    1.25  
    1.26 -ifeq ($(BUILD_FOR),Windoze)
    1.27 -all: $(TARGET).exe
    1.28 +UNIT_TEST_SOURCE=$(wildcard *_test.cc)
    1.29 +UNIT_TESTS=$(subst .cc,,$(UNIT_TEST_SOURCE))
    1.30  
    1.31 -$(TARGET).exe: $(TARGET).o ../src/libpEpEngine.a
    1.32 -	$(CXX) $(LDFLAGS) -o $(TARGET).exe $(TARGET).o ../src/libpEpEngine.a
    1.33 -else ifeq ($(BUILD_FOR),MINGW32_NT-6.1)
    1.34 -all: $(TARGET).exe pEpEngine.dll
    1.35 -
    1.36 -$(TARGET).exe: $(TARGET).o ../src/libpEpEngine.a
    1.37 -	$(CXX) $(LDFLAGS) -o $(TARGET).exe $(TARGET).o ../src/libpEpEngine.a
    1.38 -else
    1.39 -all: $(TARGET)
    1.40 -
    1.41 -$(TARGET): $(TARGET).o
    1.42 -	$(CXX) $(LDFLAGS) -o $(TARGET) $(TARGET).o
    1.43 -endif
    1.44 -
    1.45 -%.o: %.cc ../pEpEngine.h
    1.46 -	$(CXX) $(CXXFLAGS) -c -o $@ $<
    1.47 -
    1.48 -pEpEngine.dll: ../src/pEpEngine.dll
    1.49 -	cp $< $@
    1.50 +all: $(TARGET) $(UNIT_TESTS)
    1.51  
    1.52  .PHONY: clean
    1.53  
    1.54  clean:
    1.55 -	rm -f *.o $(TARGET) *.exe *.a *~ pEpEngine.dll message_api_test
    1.56 +	rm -f *.o $(TARGET) *.a *~ $(UNIT_TESTS)
    1.57  
    1.58 -test: all
    1.59 +test: pEpEngineTest
    1.60  	LD_LIBRARY_PATH=~/lib:../src ./pEpEngineTest
    1.61  
    1.62 -message_api_test: message_api_test.o
    1.63 -	$(LD) $(LDFLAGS) -o message_api_test message_api_test.o
    1.64 -
    1.65 +unit_tests: $(UNIT_TESTS)
    1.66 +	LD_LIBRARY_PATH=~/lib:../src ./unit_tests