12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- # Makefile for win32 platforms with mingw under win32
- TARGET = sdlpal-mingw.exe
- TEST_TARGET = sdlpal-mingw-tests.exe
- INTER=.mingw
- HOST =
- TEST_CCFLAGS =
- GENERATED = -DPAL_HAS_GIT_REVISION $(shell ..\scripts\gengitrev.bat)
- DEPFLAGS = -MT $@ -MMD -MP -MF $*$(INTER).Td
- GTEST_DIR = ../3rd/googletest/googletest
- CFILES = $(wildcard ../adplug/*.c) $(wildcard ../libmad/*.c) $(wildcard ../liboggvorbis/src/*.c) $(wildcard ../*.c) $(wildcard ../native_midi/*.c) $(wildcard ../win32/*.c)
- CPPFILES = $(wildcard ../adplug/*.cpp) $(wildcard ../*.cpp) $(wildcard ./*.cpp)
- RCFILES = $(wildcard ./sdlpal.rc)
- OBJFILES = $(CFILES:.c=$(INTER).o) $(CPPFILES:.cpp=$(INTER).o) $(RCFILES:.rc=$(INTER).o)
- DEPFILES = $(CFILES:.c=$(INTER).d) $(CPPFILES:.cpp=$(INTER).d)
- TEST_CPPFILES = $(wildcard ../tests/*.cpp)
- TEST_OBJFILES = $(TEST_CPPFILES:.cpp=.o)
- override CCFLAGS += -g -msse2 -Wall -O2 -fno-strict-aliasing -I../3rd/mingw-std-threads -I../3rd/SDL/include -I. -I../ -I../liboggvorbis/include -I../liboggvorbis/src -DPAL_HAS_PLATFORM_SPECIFIC_UTILS $(TEST_CCFLAGS) $(GENERATED)
- CXXFLAGS = $(CCFLAGS) -std=c++11
- CFLAGS = $(CCFLAGS) -std=gnu99
- LDFLAGS = -lmingw32 -lSDL2main -lSDL2 -mwindows -lm -lwinmm -lole32 -loleaut32 -limm32 -lcomctl32 -luuid -ldxguid -lversion -static -static-libgcc -static-libstdc++
- TEST_CXXFLAGS += -isystem $(GTEST_DIR)/include -I $(GTEST_DIR) -g -Wall -Wextra -pthread
- POSTCOMPILE = @move /Y $(subst /,\,$*)$(INTER).Td $(subst /,\,$*)$(INTER).d > NUL 2>&1 && type NUL >> $(subst /,\,$@)
- .PHONY : all clean check
- all: $(TARGET)
- $(TARGET): $(OBJFILES)
- @echo [LD] $@
- @$(HOST)g++ $^ -o $@ $(LDFLAGS)
- gtest-all.o : $(GTEST_DIR)/src/gtest-all.cc %.d
- @echo [CC] $<
- @$(HOST)g++ $(DEPFLAGS) $(TEST_CXXFLAGS) -c $< -o $@
- $(POSTCOMPILE)
- %$(INTER).o: %.c %$(INTER).d
- @echo [CC] $<
- @$(HOST)gcc $(DEPFLAGS) $(CFLAGS) -c $< -o $@
- $(POSTCOMPILE)
- %$(INTER).o: %.cpp %$(INTER).d
- @echo [CC] $<
- @$(HOST)g++ $(DEPFLAGS) $(CXXFLAGS) -c $< -o $@
- $(POSTCOMPILE)
- %$(INTER).o: %.rc
- @echo [RES] $^
- @$(HOST)windres -i $^ -o $@
- $(TEST_TARGET): $(OBJFILES) $(TEST_OBJFILES) gtest-all.o
- @echo [LD] $@
- @$(HOST)g++ $^ -o $@ $(LDFLAGS) -pthread
- clean:
- -del /Q $(subst /,\,$(TARGET)) $(subst /,\,$(TEST_TARGET)) $(subst /,\,$(OBJFILES)) $(subst /,\,$(TEST_OBJFILES)) $(subst /,\,$(DEPFILES)) 2> NUL
- %.d: ;
- .PRECIOUS: %.d
- -include $(DEPFILES)
- check: TEST_CCFLAGS = -DUNIT_TEST=1 -isystem $(GTEST_DIR)/include
- check: $(TEST_TARGET)
- @echo [EXEC] $(TEST_TARGET)
- @chmod +x $(TEST_TARGET)
- @exec $(TEST_TARGET)
|