Practicing my algorithms chops by implementing the STL algorithms library in C.
1
2.POSIX:
3
4.PHONY: run build
5
6SRC = ./src/main.c ./src/mystl.c
7CC = clang
8CFLAGS = -Wconversion -Wall -Wswitch-enum -Wextra -pedantic --std=c11
9DEBUG = ./build/debug/debug
10RELEASE = ./build/release/release
11
12all: options build
13
14options:
15 @echo mystl build options:
16 @echo "CC = $(CC)"
17 @echo "CFLAGS = $(CFLAGS)"
18
19run: build
20 $(DEBUG)
21
22build:
23 $(CC) $(CFLAGS) -Os $(SRC) -o $(DEBUG)
24
25debug: check
26 $(CC) $(CFLAGS) -Og -ggdb $(SRC) -o $(DEBUG)
27
28release:
29 $(CC) $(CFLAGS) -O3 $(SRC) -o $(RELEASE)
30
31format:
32 clang-format -i $(SRC) --style="{BasedOnStyle: GNU, ColumnLimit: 100}"
33
34check:
35 clang-tidy -extra-arg=-std=c11 $(SRC)