1 files changed, 18 insertions(+), 10 deletions(-)
M Makefile
M Makefile => Makefile +18 -10
@@ 1,15 1,23 @@
-CFILES = $(wildcard src/*.c)
-OBJFILES = $(CFILES:.c=.o)
-OUT = main
-VPATH = src
+DEBUG ?= FALSE
-CC = gcc
-CFLAGS = -Wall -std=c99 -I./include/ -g
-LDFLAGS = -L./lib/
-LDLIBS = -l:libraylib.a -lm
+SOURCES = $(wildcard src/*.c)
+OBJECTS = $(SOURCES:.c=.o)
+OUT = main
+VPATH = src
-$(OUT): $(OBJFILES)
+CC = gcc
+CFLAGS = -Wall -std=c99 -I./include/
+LDFLAGS = -L./lib/
+LDLIBS = -l:libraylib.a -lm
+
+ifeq ($(DEBUG), TRUE)
+ CFLAGS += -g -O0
+else
+ CFLAGS += -s -O1
+endif
+
+$(OUT): $(OBJECTS)
.PHONY: clean
clean:
- rm -f $(OBJFILES) $(OUT)
+ rm -f $(OBJECTS) $(OUT)