# To compile this you will need MinGW with MSYS installed in PATH CPPFLAGS=-Wall -Wno-misleading-indentation -Werror --std=c++1z LDFLAGS= INCLUDES=-Ipge/include EXECUTABLE=awoorwae PACKER=packer/packer ifeq ($(OS),Windows_NT) LIBRARIES=-luser32 -lgdi32 -lopengl32 -lgdiplus -lwinmm EXECUTABLE+=.exe PACKER+=.exe LDFLAGS+=--machine=windows CPP=i686-w64-mingw32-g++ CC=i686-w64-mingw32-gcc else LIBRARIES=-lX11 -lGL -lpthread -lpng -lasound CC=gcc CPP=g++ endif ifeq ($(DEBUG),1) CPPFLAGS+=-g -Og else CPPFLAGS+=-flto -O3 endif SOURCES=$(wildcard src/*.cpp) $(wildcard src/**/*.cpp) $(wildcard pge/src/*.cpp) IMAGES=$(wildcard res/*.png) OBJECTS=$(SOURCES:.cpp=.o) SPRITES=$(IMAGES:.png=.spr) all: $(SOURCES) $(SPRITES) $(EXECUTABLE) clean: $(RM) $(OBJECTS) $(SPRITES) $(EXECUTABLE) $(EXECUTABLE): $(OBJECTS) $(CPP) $(LDFLAGS) $(OBJECTS) -o $@ $(LIBRARIES) .cpp.o: $(CPP) $(INCLUDES) -c $(CPPFLAGS) $< -o $@ %.spr: %.png $(PACKER) $(PACKER) --convert $< $@ run: $(SPRITES) $(EXECUTABLE) ./$(EXECUTABLE) $(PACKER): $(MAKE) -C packer