-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
53 lines (43 loc) · 976 Bytes
/
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
52
53
APP_NAME=snake-cli
PATH_OUT=build
CC=clang
CFLAGS=-Wall -Wno-multichar -Werror
LDFLAGS=-lcurses
CH_INC=-I src/lib/
CSRC=src/lib/*.c src/main.c
CH_INC_TEST=-I test/include -I src/lib/
CSRC_TEST=\
src/lib/*.c \
test/include/unity.c \
test/main.test.c
CSRC_TEST=test/include/*.c src/lib/*.c test/main.test.c
.DEFAULT_GOAL := usage
.PHONY: build run test
usage:
@echo "*********"
@echo "* USAGE *"
@echo "*********"
@echo ""
clean:
@echo "[CLEAN]"
@echo "Cleaning '${PATH_OUT}' directory..."
rm -rf build/
@echo ""
build:
@echo "[BUILD]"
if [ ! -d ${PATH_OUT} ]; then mkdir ${PATH_OUT}; fi
@echo "Building ${APP_NAME} tests..."
$(CC) ${CFLAGS} $(CH_INC_TEST) $(CSRC_TEST) -o ${PATH_OUT}/test
@echo ""
@echo "Building ${APP_NAME}..."
$(CC) $(CFLAGS) ${LDFLAGS} $(CH_INC) $(CSRC) -o $(PATH_OUT)/$(APP_NAME)
@echo ""
run:
@echo "[RUN]"
@echo "Running ${APP_NAME}..."
${PATH_OUT}/${APP_NAME}
@echo ""
test:
@echo "[TEST]"
${PATH_OUT}/test
@echo ""