diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 16 |
1 files changed, 14 insertions, 2 deletions
| @@ -1,13 +1,25 @@ | |||
| 1 | BIN = build/engine | 1 | BIN = build/engine |
| 2 | SRC = source/tb_db.c | 2 | SRC = source/tb_db.c |
| 3 | |||
| 4 | # CC = gcc | ||
| 3 | CC = clang | 5 | CC = clang |
| 4 | CFLAGS = -Wall -Wextra -Wpedantic -Wno-unused-function -g -Werror | 6 | |
| 7 | COMPILER := $(shell $(CC) --version | grep -o "gcc\|clang" | head -1) | ||
| 8 | |||
| 9 | # check for compile optimizations per compiler | ||
| 10 | ifeq ($(COMPILER),gcc) | ||
| 11 | CFLAGS = -Wall -Wextra -Wpedantic -Wno-unused-function -g -Werror -O0 | ||
| 12 | else ifeq ($(COMPILER),clang) | ||
| 13 | CFLAGS = -Wall -Wextra -Wpedantic -Wno-unused-function -g -O0 | ||
| 14 | else | ||
| 15 | CFLAGS = -Wall -Wextra -Wpedantic -Wno-unused-function -g -O0 | ||
| 16 | endif | ||
| 5 | 17 | ||
| 6 | $(BIN): $(SRC) | 18 | $(BIN): $(SRC) |
| 7 | mkdir -p build | 19 | mkdir -p build |
| 8 | $(CC) $(CFLAGS) $< -o $@ | 20 | $(CC) $(CFLAGS) $< -o $@ |
| 9 | 21 | ||
| 10 | run: | 22 | run: $(BIN) |
| 11 | $(BIN) | 23 | $(BIN) |
| 12 | 24 | ||
| 13 | .PHONY: clean | 25 | .PHONY: clean |
