-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
68 lines (41 loc) · 1.21 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
BIN = ./binary
SOURCEDIR = ./tests
SOURCES =
SES_SOURCES = $(SOURCEDIR)/ses_tests.c \
$(SOURCEDIR)/Unity/unity.c
OUTPUT_LIB_DIR =
LIB_DIR = ./libs/raspberry
CC = /usr/bin/gcc
LIBS = -lrt -lsea -ldl
DEFINES = \
INCLUDE = \
-I./inc \
-I./tests/Unity
FLAGS = -std=c99 $(DEFINES)
ifeq ($(target),v1)
OUTPUT_LIB_DIR += $(LIB_DIR)/v1
SOURCES += $(SOURCEDIR)/v1_tests.c \
$(SOURCEDIR)/Unity/unity.c
else ifeq ($(target),v2)
INCLUDE += -I./tests/micro-ecc/include
LIBS += -lpthread
OUTPUT_LIB_DIR += $(LIB_DIR)/v2
SOURCES += $(SOURCEDIR)/v2_tests.c \
$(SOURCEDIR)/Unity/unity.c \
$(SOURCEDIR)/micro-ecc/src/uECC.c
else ifeq ($(target),v3)
OUTPUT_LIB_DIR += $(LIB_DIR)/v3
SOURCES += $(SOURCEDIR)/v3_tests.c \
$(SOURCEDIR)/Unity/unity.c
endif
.PHONY: all debug clean
$(target): $(SOURCEDIR)/$(target)_tests.c $(LIB_DIR)/$(target)/libsea.a $(BIN)/ses
@mkdir -p $(BIN)
$(CC) $(FLAGS) $(SOURCES) $(INCLUDE) -L$(OUTPUT_LIB_DIR) $(LIBS) -o $(BIN)/$@
$(BIN)/ses: $(SOURCEDIR)/ses_tests.c
@mkdir -p $(BIN)
$(CC) $(FLAGS) $(SES_SOURCES) $(INCLUDE) -L$(OUTPUT_LIB_DIR) $(LIBS) -o $@
debug:
@echo "\n Sources are" $(SOURCES) "\n Includes are" $(INCLUDE) "\n"
clean:
rm -rf $(BIN)/v1 $(BIN)/v2 $(BIN)/v3 $(BIN)/ses