diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-12-03 00:22:14 +0000 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-12-03 03:17:44 +0000 |
commit | 9fcd22a03b9fe3aa5659d4b544fc3ccc59730031 (patch) | |
tree | 5110126c919673ee80d4c69d785b9982b1fa3810 /Makefile | |
parent | 82eec8b529f2113f19b443446545bad66d3a1547 (diff) | |
download | obf-9fcd22a03b9fe3aa5659d4b544fc3ccc59730031.tar.gz obf-9fcd22a03b9fe3aa5659d4b544fc3ccc59730031.tar.bz2 obf-9fcd22a03b9fe3aa5659d4b544fc3ccc59730031.zip |
Simplify build system
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
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 28 |
1 files changed, 18 insertions, 10 deletions
@@ -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) |