1 | # Preamble >> Make config |
2 | SHELL := bash |
3 | .ONESHELL: |
4 | .SHELLFLAGS := -eu -o pipefail -c |
5 | .DELETE_ON_ERROR: |
6 | MAKEFLAGS += --warn-undefined-variables |
7 | MAKEFLAGS += --no-builtin-rules |
8 |
|
9 | ifeq ($(origin .RECIPEPREFIX), undefined) |
10 | $(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later) |
11 | endif |
12 | .RECIPEPREFIX = > |
13 |
|
14 | all: bin/main |
15 |
|
16 |
|
17 | # Compiler settings |
18 | CC := gcc -std=c11 |
19 | CFLAGS := -O3 |
20 | CWARNINGS := -Werror -Wall -Wextra -pedantic |
21 | CINCLUDES := -Isrc/ |
22 | CLIBS := -lncurses |
23 | CLINT := --syntax-only |
24 |
|
25 |
|
26 | # File dependencies |
27 | bin/main.o: src/main.c |
28 | > @echo Compiling $@ from $< |
29 | > $(CC) -o $@ -c $(CFLAGS) $(CWARNINGS) $< $(CINCLUDES) |
30 |
|
31 |
|
32 | # Binary dependencies |
33 | bin/main: bin/main.o |
34 | > @echo Compiling $@ from $^ |
35 | > $(CC) -o $@ $^ $(CLIBS) |
36 | > @echo Done! |
37 |
|