RELEASE and DEBUG builds have differing build flags, triggered by setting RELEASE variable. No longer doing object based compilation because: + gcc is fast enough without it + stale code compilation bugs are annoying + having one output binary to clean-up is just easier when switching build-types
29 lines
411 B
Makefile
29 lines
411 B
Makefile
CC=gcc
|
|
OUT=obf.out
|
|
LIBS=
|
|
ARGS=
|
|
|
|
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
|
|
|
|
.PHONY: all
|
|
all: $(OUT)
|
|
|
|
$(OUT): lib.c parser.c main.c
|
|
$(CC) $(CFLAGS) $^ -o $@ $(LIBS)
|
|
|
|
.PHONY: run
|
|
run: $(OUT)
|
|
./$^ $(ARGS)
|
|
|
|
.PHONY:
|
|
clean:
|
|
rm -v $(OUT)
|