-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·51 lines (36 loc) · 1.15 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
CC = gcc
CFLAGS = -std=c99 -Wall -Wextra -Wpedantic -Wshadow -Wno-unused-parameter
LDFLAGS = $(SDL_LDFLAGS) -lm
SDL_CFLAGS := $(shell sdl2-config --cflags)
SDL_LDFLAGS := $(shell sdl2-config --libs)
override CFLAGS += $(SDL_CFLAGS)
SRC_FILES = platform_sdl.c sim.c star.c barnes_hut.c
SRC = $(addprefix src/, $(SRC_FILES))
EXE = star-garden
DBGDIR = debug
DBGEXE = $(DBGDIR)/$(EXE)
DBGCFLAGS = -g -Og -Werror
RELDIR = release
RELEXE = $(RELDIR)/$(EXE)
RELCFLAGS = -O2 -Os
.PHONY: all clean compile_debug compile_release debug memcheck prep run todo
all: compile_debug compile_release
clean:
rm -f $(RELDIR)/* $(DBGDIR)/*
compile_debug: prep
$(CC) $(CFLAGS) $(DBGCFLAGS) $(SRC) -o $(DBGEXE) $(LDFLAGS)
compile_release: prep
$(CC) $(CFLAGS) $(RELCFLAGS) $(SRC) -o $(RELEXE) $(LDFLAGS)
debug: compile_debug
gdb $(DBGEXE)
memcheck: compile_debug
valgrind --track-origins=yes ./$(DBGEXE)
prep:
@mkdir -p $(DBGDIR) $(RELDIR)
run: compile_release
./$(DBGEXE)
todo:
@grep -FIR --colour=never --ignore-case --line-number todo src/ \
| sed -re 's/^([^:]+):[[:space:]]*(.*)/\1\x01\2/' \
| sed -re 's/^([^:]+):[[:space:]]*(.*)/\1\x01\2/' \
| column -s $$'\x01' -t