CPPFLAGS=-Wall -Wno-misleading-indentation -Werror --std=c++1z LDFLAGS= INCLUDES=-Iinclude -Ipge/include ifeq ($(OS),Windows_NT) LIBRARIES=-luser32 -lgdi32 -lopengl32 -lgdiplus -lwinmm EXECUTABLE=debuggers.exe PACKER=packer/packer.exe ifneq ($(DEBUG),1) LDFLAGS+=--machine=windows endif CPP=i686-w64-mingw32-g++ CC=i686-w64-mingw32-gcc MAKE=mingw32-make else LIBRARIES=-lX11 -lGL -lpthread -lpng -lasound EXECUTABLE=debuggers PACKER=packer/packer CC=gcc CPP=g++ endif ifeq ($(DEBUG),1) CPPFLAGS+=-g -O0 -D_DEBUG 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=.pgs) RESOURCES=$(SPRITES) $(wildcard res/*.wav) src/programmer.cpp PACK=debuggers.pgp all: $(SOURCES) $(PACK) $(EXECUTABLE) clean: $(RM) $(OBJECTS) $(SPRITES) $(PACK) $(EXECUTABLE) $(EXECUTABLE): $(OBJECTS) $(CPP) $(LDFLAGS) $(OBJECTS) -o $@ $(LIBRARIES) .cpp.o: $(CPP) $(INCLUDES) -c $(CPPFLAGS) $< -o $@ %.pgs: %.png $(PACKER) $(PACKER) --convert $< $@ $(PACK): $(RESOURCES) $(PACKER) $(PACKER) --add $(PACK) $(RESOURCES) run: $(PACK) $(EXECUTABLE) ./$(EXECUTABLE) $(PACKER): $(MAKE) -C packer