diff --git a/Makefile b/Makefile index 8357c63f1..8c9d35261 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,7 @@ CC := clang CFLAGS += -Werror -Wall -std=gnu11 -ICore -D_GNU_SOURCE SDL_LDFLAGS := -lSDL LDFLAGS += -lc -lm +CONF ?= debug ifeq ($(shell uname -s),Darwin) CFLAGS += -F/Library/Frameworks @@ -20,6 +21,14 @@ LDFLAGS += -framework AppKit SDL_LDFLAGS := -framework SDL endif +ifeq ($(CONF),debug) +CFLAGS += -g +else ifeq ($(CONF), release) +CFLAGS += -O3 +else +$(error Invalid value for CONF: $(CONF). Use "debug" or "release") +endif + cocoa: $(BIN)/Sameboy.app sdl: $(BIN)/sdl/sameboy $(BIN)/sdl/dmg_boot.bin $(BIN)/sdl/cgb_boot.bin bootroms: $(BIN)/BootROMs/cgb_boot.bin $(BIN)/BootROMs/dmg_boot.bin