-
Notifications
You must be signed in to change notification settings - Fork 78
/
Copy pathMakefile
69 lines (51 loc) · 1.61 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
69
CXX ?= g++
CXXFLAGS ?= -g -Wall -W -Winline -ansi
CXXFLAGS += -Ilib/tropicssl/include -Isrc -Itests/UnitTest++/src
RM = rm
.SUFFIXES: .o .cpp
name = SparkCoreCommunication
lib = src/lib$(name).a
test = tests/test$(name)
testlibdir = tests/UnitTest++
testlib = UnitTest++
testlibpath = $(testlibdir)/lib$(testlib).a
testrunner = tests/Main.cpp
ssllibdir = lib/tropicssl/library
ssllib = $(ssllibdir)/libtropicssl.a
objects = src/handshake.o \
src/coap.o \
src/spark_protocol.o \
src/events.o
testobjects = tests/ConstructorFixture.o \
tests/TestHandshake.o \
tests/TestAES.o \
tests/TestCoAP.o \
tests/TestQueue.o \
tests/TestStateMachine.o \
tests/TestSparkProtocol.o \
tests/TestDescriptor.o \
tests/TestUserFunctions.o \
tests/TestEvents.o
LDFLAGS ?= -L$(ssllibdir) -ltropicssl -Lsrc -l$(name) -L$(testlibdir) -l$(testlib)
all: $(lib)
$(lib): $(objects)
@echo Creating spark communication library...
@$(AR) cr $(lib) $(objects)
.cpp.o:
@$(CXX) $(CXXFLAGS) -c -o $@ $<
clean:
-@$(RM) $(objects) $(lib) $(testobjects) 2> /dev/null
############### tests #############
test: $(lib) $(testlibpath) $(testobjects) $(ssllib)
@$(CXX) $(testrunner) $(CXXFLAGS) $(testobjects) $(LDFLAGS) -o $(test)
@echo running unit tests...
@./$(test)
$(testlibpath):
$(MAKE) -C $(testlibdir)
testclean:
$(MAKE) -C $(testlibdir) clean
############# ssl library ###########
$(ssllib):
$(MAKE) -C $(ssllibdir)
sslclean:
$(MAKE) -C $(ssllibdir) clean