1 # override with `make BUILD=debug`
2 # default to release build
6 OUT_DIR := $(PWD)/$(BUILD)
7 OBJ_DIR := $(OUT_DIR)/obj
9 CXX_FLAGS.debug := -g3 -std=c++0x -Wall -pthread -O0
10 CXX_FLAGS.release := -std=c++0x -Wall -pthread -O3
12 CXX_INC := -I./include/
13 CXX_INC += -I./csdk/stack/include
14 CXX_INC += -I./csdk/ocsocket/include
15 CXX_INC += -I./csdk/ocrandom/include
16 CXX_INC += -I./csdk/logger/include
17 CXX_INC += -I./csdk/libcoap
19 # Force metatargets to build:
20 .PHONY: prep_dirs c_sdk liboc.a examples
29 cd csdk && $(MAKE) "BUILD=$(BUILD)"
32 cd examples && $(MAKE) "BUILD=$(BUILD)"
34 liboc.a: OCPlatform.o OCResource.o OCUtilities.o InProcServerWrapper.o InProcClientWrapper.o
35 ar -cvq $(OBJ_DIR)/liboc.a $(OBJ_DIR)/OCPlatform.o $(OBJ_DIR)/OCResource.o $(OBJ_DIR)/OCUtilities.o $(OBJ_DIR)/InProcServerWrapper.o $(OBJ_DIR)/InProcClientWrapper.o
37 OCPlatform.o: src/OCPlatform.cpp
38 $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c src/OCPlatform.cpp $(CXX_INC)
40 OCResource.o: src/OCResource.cpp
41 $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c src/OCResource.cpp $(CXX_INC)
43 OCUtilities.o: src/OCUtilities.cpp
44 $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c src/OCUtilities.cpp $(CXX_INC)
46 InProcServerWrapper.o: src/InProcServerWrapper.cpp
47 $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c src/InProcServerWrapper.cpp $(CXX_INC)
49 InProcClientWrapper.o: src/InProcClientWrapper.cpp
50 $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c src/InProcClientWrapper.cpp $(CXX_INC)
55 cd csdk && $(MAKE) clean
56 cd csdk && $(MAKE) deepclean
57 cd examples && $(MAKE) clean
59 -rm -f -v $(OBJ_DIR)/liboc.a $(OBJ_DIR)/*.o