1 # override with `make BUILD=release`
2 # default to release build
6 OUT_DIR := $(PWD)/$(BUILD)
7 OBJ_DIR := $(OUT_DIR)/obj
8 SAMPLES_OUT_DIR := $(OUT_DIR)/samples
10 CXX_FLAGS.debug := -g3 -std=c++0x -Wall -pthread
12 CXX_FLAGS.release := -std=c++0x -Wall -pthread
14 CXX_INC := -I./include/
15 CXX_INC += -I./csdk/stack/include
16 CXX_INC += -I./csdk/ocsocket/include
17 CXX_INC += -I./csdk/ocrandom/include
18 CXX_INC += -I./csdk/logger/include
20 # Force metatargets to build:
21 .PHONY: prep_dirs c_sdk simpleserver simpleclient simpleclientserver
28 -mkdir $(SAMPLES_OUT_DIR)
31 cd csdk && $(MAKE) "BUILD=$(BUILD)"
34 cd examples && $(MAKE) "BUILD=$(BUILD)"
37 $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(SAMPLES_OUT_DIR)/$@ examples/simpleserver.cpp $(CXX_INC) $(OBJ_DIR)/OCLib.a csdk/$(BUILD)/liboctbstack.a
40 $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(SAMPLES_OUT_DIR)/$@ examples/simpleclient.cpp $(CXX_INC) $(OBJ_DIR)/OCLib.a csdk/$(BUILD)/liboctbstack.a
42 simpleclientserver: OCLib.a
43 $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(SAMPLES_OUT_DIR)/$@ examples/simpleclientserver.cpp $(CXX_INC) $(OBJ_DIR)/OCLib.a csdk/$(BUILD)/liboctbstack.a
45 OCLib.a: OCPlatform.o OCResource.o OCReflect.o InProcServerWrapper.o InProcClientWrapper.o
46 ar -cvq $(OBJ_DIR)/OCLib.a $(OBJ_DIR)/OCPlatform.o $(OBJ_DIR)/OCResource.o $(OBJ_DIR)/OCReflect.o $(OBJ_DIR)/InProcServerWrapper.o $(OBJ_DIR)/InProcClientWrapper.o
48 OCReflect.o: OCLib/OCReflect.cpp
49 $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c OCLib/OCReflect.cpp $(CXX_INC)
51 OCPlatform.o: OCLib/OCPlatform.cpp
52 $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c OCLib/OCPlatform.cpp $(CXX_INC)
54 OCResource.o: OCLib/OCResource.cpp
55 $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c OCLib/OCResource.cpp $(CXX_INC)
57 InProcServerWrapper.o: OCLib/InProcServerWrapper.cpp
58 $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c OCLib/InProcServerWrapper.cpp $(CXX_INC)
60 InProcClientWrapper.o: OCLib/InProcClientWrapper.cpp
61 $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c OCLib/InProcClientWrapper.cpp $(CXX_INC)
66 cd csdk && $(MAKE) clean
67 cd csdk && $(MAKE) deepclean
69 -rm -f -v OCLib.a *.o simpleserver simpleclient simpleclientserver