aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile28
1 files changed, 18 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 09de95d..b96aaa9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,20 +1,28 @@
CC=gcc
-CFLAGS=-Wall -Wextra -Wpedantic -ggdb -fsanitize=address -std=c11
-LIBS=
-OBJECTS=lib.o parser.o main.o
OUT=obf.out
+LIBS=
ARGS=
-%.o: %.c
- $(CC) $(CFLAGS) -c $^ -o $@ $(LIBS)
+RELEASE=0
+GFLAGS=-Wall -Wextra -Werror -Wswitch-enum -std=c11
+DFLAGS=-ggdb -fsanitize=address -fsanitize=undefined -DDEBUG
+RFLAGS=-O3
+ifeq ($(RELEASE), 1)
+CFLAGS=$(GFLAGS) $(RFLAGS)
+else
+CFLAGS=$(GFLAGS) $(DFLAGS)
+endif
-$(OUT): $(OBJECTS)
- $(CC) $(CFLAGS) $^ -o $@ $(LIBS)
+.PHONY: all
+all: $(OUT)
-.PHONY:
-clean:
- rm -rfv $(OUT) $(OBJECTS)
+$(OUT): lib.c parser.c main.c
+ $(CC) $(CFLAGS) $^ -o $@ $(LIBS)
.PHONY: run
run: $(OUT)
./$^ $(ARGS)
+
+.PHONY:
+clean:
+ rm -v $(OUT)