123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- # Makefile for win32 platforms with mingw
- TARGET = sdlpal.exe
- TEST_TARGET = ./sdlpal-tests
- HOST =
- CFILES = $(wildcard ../adplug/*.c) $(wildcard ../libmad/*.c) $(wildcard ../liboggvorbis/src/*.c) $(wildcard ../*.c) ../native_midi/native_midi_win32.c ../native_midi/native_midi_common.c
- CFILES := $(filter-out ../main.c, $(CFILES))
- CPPFILES = $(wildcard ../adplug/*.cpp) $(wildcard ../*.cpp) $(wildcard ./*.cpp)
- OBJFILES = $(CFILES:.c=.o) $(CPPFILES:.cpp=.o) sdlpal.o
- TEST_CPPFILES = $(wildcard ../tests/*.cpp)
- TEST_OBJFILES = $(TEST_CPPFILES:.cpp=.o)
- GTEST_DIR = ../3rd/googletest/googletest
- GTEST_HEADERS = $(GTEST_DIR)/include/gtest/*.h \
- $(GTEST_DIR)/include/gtest/internal/*.h
- GTEST_SRCS_ = $(GTEST_DIR)/src/*.cc $(GTEST_DIR)/src/*.h $(GTEST_HEADERS)
- TEST_CPPFLAGS += -isystem $(GTEST_DIR)/include
- TEST_CXXFLAGS += -g -Wall -Wextra -pthread
- override CCFLAGS += `sdl2-config --cflags` -msse -Wall -O2 -fno-strict-aliasing -I. -I../ -I../liboggvorbis/include -I../liboggvorbis/src -DPAL_HAS_PLATFORM_SPECIFIC_UTILS -I$(GTEST_DIR)
- CXXFLAGS = $(CCFLAGS) -std=c++11 $(TEST_CPPFLAGS) $(TEST_CXXFLAGS)
- CFLAGS = $(CCFLAGS) -std=gnu99
- LDFLAGS = `sdl2-config --libs` -lm -lwinmm -lole32 -loleaut32 -limm32 -lcomctl32 -luuid -ldxguid -lversion -static -static-libgcc -static-libstdc++
- TEST_LDFLAGS = -L/mingw32/lib -lSDL2 -mconsole -lm -lgdi32 -lwinmm -lole32 -loleaut32 -limm32 -lcomctl32 -luuid -ldxguid -lversion -static -static-libgcc -static-libstdc++
- all: $(TARGET)
- gtest-all.o : $(GTEST_SRCS_)
- $(CXX) $(CXXFLAGS) -c \
- $(GTEST_DIR)/src/gtest-all.cc
- $(TARGET): $(OBJFILES) ../main.o
- $(HOST)g++ $^ -o $@ $(LDFLAGS)
- $(TEST_TARGET): $(OBJFILES) $(TEST_OBJFILES) main-test.o gtest-all.o
- $(HOST)g++ $^ -o $@ $(TEST_LDFLAGS)
- %.o: %.c
- $(HOST)gcc $(CFLAGS) -c $< -o $@
- %.o: %.cpp
- $(HOST)g++ $(CXXFLAGS) -c $< -o $@
-
- main-test.o: ../main.c
- $(HOST)gcc $(CFLAGS) -DUNIT_TEST=1 -c $< -o $@
- %.o: %.rc
- windres -i $< -o $@
- clean:
- -rm -f $(TARGET) $(TEST_TARGET) *.o ../*.o ../adplug/*.o ../libmad/*.o ../liboggvorbis/src/*.o
- check: $(TEST_TARGET)
- chmod +x $(TEST_TARGET)
- exec $(TEST_TARGET)
|