-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
46 lines (32 loc) · 1 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
rootdir = $(realpath .)
CC = gcc
CFLAGS = -std=c11 -g -D_GNU_SOURCE -ggdb3 -Wall -Werror
HEADERS = -I$(rootdir)/headers
MINIAUDIO_HEADERS = -I$(rootdir)/dependencies/miniaudio/include
FILES = $(wildcard src/*.c)
LMINI = -L. -lminiaudio -lm
#colors
COLOUR_GREEN ='\033[0;32m'
COLOUR_RED ='\033[0;31m'
COLOUR_BLUE ='\033[0;34m'
END_COLOUR = '\033[0m'
define NEWLINE
endef
compile: $(FILES)
ifeq ($(shell test -e libminiaudio.a && echo -n yes),yes)
@echo -e $(COLOUR_GREEN)Static lib exists.$(END_COLOUR)
else
make_scripts/init_miniaudio.sh
@echo -e $(COLOUR_BLUE) Static lib initalized.$(END_COLOUR)
endif
@echo Proceeding to compile.
@echo -e $(NEWLINE)
$(CC) $(CFLAGS) $(MINIAUDIO_HEADERS) $(HEADERS) $(FILES) -o ./bin/apc $(LMINI)
@echo -e $(NEWLINE)
@echo -e $(COLOUR_GREEN)Binary generated in ./bin/apc$(END_COLOUR)
lines:
@echo $(shell git ls-files | xargs wc -l)
tidy:
@echo $(shell clang-tidy $(FILES) -- $(HEADERS) $(MINIAUDIO_HEADERS))
compile_miniaudio:
make_scripts/init_miniaudio.sh