1 # override with `make BUILD=release`
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
11 CXX_FLAGS.release := -std=c++0x -Wall -pthread
13 CXX_INC := -I./include/
14 CXX_INC += -I./csdk/stack/include
15 CXX_INC += -I./csdk/ocsocket/include
16 CXX_INC += -I./csdk/ocrandom/include
17 CXX_INC += -I./csdk/logger/include
18 CXX_INC += -I./csdk/libcoap
20 # Force metatargets to build:
21 .PHONY: prep_dirs c_sdk OCLib.a examples
30 cd csdk && $(MAKE) "BUILD=$(BUILD)"
33 cd examples && $(MAKE) "BUILD=$(BUILD)"
35 OCLib.a: OCPlatform.o OCResource.o OCReflect.o OCUtilities.o InProcServerWrapper.o InProcClientWrapper.o
36 ar -cvq $(OBJ_DIR)/OCLib.a $(OBJ_DIR)/OCPlatform.o $(OBJ_DIR)/OCResource.o $(OBJ_DIR)/OCReflect.o $(OBJ_DIR)/OCUtilities.o $(OBJ_DIR)/InProcServerWrapper.o $(OBJ_DIR)/InProcClientWrapper.o
38 OCReflect.o: OCLib/OCReflect.cpp
39 $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c OCLib/OCReflect.cpp $(CXX_INC)
41 OCPlatform.o: OCLib/OCPlatform.cpp
42 $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c OCLib/OCPlatform.cpp $(CXX_INC)
44 OCResource.o: OCLib/OCResource.cpp
45 $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c OCLib/OCResource.cpp $(CXX_INC)
47 OCUtilities.o: OCLib/OCUtilities.cpp
48 $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c OCLib/OCUtilities.cpp $(CXX_INC)
50 InProcServerWrapper.o: OCLib/InProcServerWrapper.cpp
51 $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c OCLib/InProcServerWrapper.cpp $(CXX_INC)
53 InProcClientWrapper.o: OCLib/InProcClientWrapper.cpp
54 $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c OCLib/InProcClientWrapper.cpp $(CXX_INC)
59 cd csdk && $(MAKE) clean
60 cd csdk && $(MAKE) deepclean
61 cd examples && $(MAKE) clean
63 -rm -f -v $(OBJ_DIR)/OCLib.a $(OBJ_DIR)/*.o