Modified makefiles so that each makefile could build its own dependencies or build...
authorThuyen Tran <thuyen.c.tran@intel.com>
Wed, 24 Sep 2014 00:00:12 +0000 (17:00 -0700)
committerThuyen Tran <thuyen.c.tran@intel.com>
Tue, 30 Sep 2014 23:32:07 +0000 (16:32 -0700)
Fixed .gitignore and makefiles base on review comments.
Rebased as requested by Erich.
Added fix to building with boost
Cleaned up .gitignore

Change-Id: I0829400e74694f2a7f8271ea72f93e7cd7be000c

.gitignore
csdk/stack/samples/linux/SimpleClientServer/makefile
examples/makefile
examples/ocicuc/Makefile
makefile

index 0a27705..7583ff5 100644 (file)
@@ -4,6 +4,19 @@
 /csdk/libcoap-4.1.1/release/
 /examples/release
 
+/debug
+csdk/debug/
+csdk/libcoap-4.1.1/debug/
+/examples/debug
+csdk/stack/samples/linux/SimpleClientServer/debug/
+
+
 # Ignore any object files
 *.o
 *.obj
+
+
+# Ignore Eclipse workspace files
+*.settings/
+*.cproject
+*.project
index 91d8678..7a08517 100644 (file)
@@ -73,12 +73,15 @@ PROGRAMS    += occlient
 PROGRAMS       += ocservercoll
 PROGRAMS       += occlientcoll
 
-all:   prep_dirs $(OBJECTS) $(PROGRAMS)
+all:   c_sdk prep_dirs $(OBJECTS) $(PROGRAMS)
 
 prep_dirs:
        -mkdir -p $(OUT_DIR)
        -mkdir -p $(OBJ_DIR)
 
+c_sdk:
+       cd $(ROOT_DIR) && $(MAKE) BUILD=$(BUILD) PLATFORM=$(PLATFORM)
+
 $(OBJ_DIR)/%.o: %.cpp
        $(CC) -c $(CPPFLAGS) $< -o $@
 
@@ -99,6 +102,8 @@ occlientcoll: $(OBJ_DIR)/occlientcoll.o $(OBJ_DIR)/common.o
 clean: legacy_clean
        -rm -rf release
        -rm -rf debug
+       cd $(ROOT_DIR) && $(MAKE) clean
+       cd $(ROOT_DIR) && $(MAKE) deepclean
 
 legacy_clean:
        rm -f *.o $(PROGRAMS)
index 0cf6d19..b070ab8 100644 (file)
@@ -42,13 +42,29 @@ LIB_OC_LOGGER := ../oc_logger/lib/oc_logger.a
 
 CXX_LIBS  := ../$(BUILD)/obj/liboc.a ../csdk/$(BUILD)/liboctbstack.a $(LIB_OC_LOGGER)
 
+APPS  += simpleserver
+APPS  += simpleclient
+APPS  += simpleclientserver
+APPS  += roomserver
+APPS  += roomclient
+APPS  += presenceserver
+APPS  += presenceclient
+APPS  += garageserver
+APPS  += garageclient
+APPS  += ocicuc
+
 # Force metatargets to build:
-.PHONY: prep_dirs simpleserver simpleclient simpleclientserver roomserver roomclient presenceserver presenceclient garageserver garageclient fridgeserver fridgeclient ocicuc
+.PHONY:        prep_dirs oc_cpp_sdk $(APPS)
 
 all: .PHONY
 
+apps: prep_dirs $(APPS)
+
 prep_dirs:
        -mkdir -p $(OUT_DIR)
+       
+oc_cpp_sdk:
+       cd ../ && $(MAKE) cpp_sdk "BUILD=$(BUILD)"
 
 simpleserver: simpleserver.cpp
        $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ simpleserver.cpp $(CXX_INC) $(CXX_LIBS)
@@ -83,11 +99,14 @@ garageserver: garageserver.cpp
 garageclient: garageclient.cpp
        $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ garageclient.cpp $(CXX_INC) $(CXX_LIBS)
 
-
 ocicuc:
-       cd ocicuc && $(MAKE)
-
-clean:
+       cd ocicuc && $(MAKE) apps
+       
+clean: 
        rm -rf $(OUT_DIR)
-       cd ocicuc && $(MAKE) clean
+       cd ../ && $(MAKE) clean_cpp_sdk
+       cd ocicuc && $(MAKE) clean_apps
 
+clean_apps:
+       rm -rf $(OUT_DIR)
+       cd ocicuc && $(MAKE) clean_apps
index 4328818..f82d10b 100644 (file)
@@ -21,7 +21,7 @@
 BUILD:=release
 
 OCLIB=../..
-OCLIB_LIB=../../$(BUILD)/obj/liboc.a #$(OCLIB)/release/obj/liboc.a
+OCLIB_LIB=../../$(BUILD)/obj/liboc.a 
 
 CXX_FLAGS.debug     := -g3 -O0
 CXX_FLAGS.release   := -O3
@@ -37,14 +37,25 @@ CXX_INC=-I$(OCLIB)/include \
        -I../../csdk/logger/include
 
 BOOST_LIBS=-lboost_program_options
+#BOOST_LIBS=/usr/local/boost/lib/libboost_program_options.a    # for boost_1_55 lib
 
 LIB_OC_LOGGER:=../../oc_logger/lib/oc_logger.a
 
 CXX_LIBS=$(OCLIB_LIB) ../../csdk/$(BUILD)/liboctbstack.a $(LIB_OC_LOGGER) $(BOOST_LIBS)
 
+APPS += client 
+APPS += server 
+APPS += monoprocess 
+
 .PHONY: client server
 
-all: client server monoprocess
+all: oc_cpp_sdk apps
+       @echo Remember to \"export LD_LIBRARY_PATH=$(BOOST_LIB)\:\$$LD_LIBRARY_PATH\"
+
+apps: $(APPS)
+
+oc_cpp_sdk:
+       cd ../../ && $(MAKE) cpp_sdk "BUILD=$(BUILD)"
 
 %.o: %.cpp
        $(CXX) $(CXXFLAGS) $(CXX_FLAGS) $(CXX_INC) -c -o $@ $<
@@ -59,4 +70,9 @@ monoprocess: monoprocess.o driver.o utility.o light_resource.o
        $(CXX) $(CXX_FLAGS) -o $@ $^ $(CXX_LIBS)
 
 clean:
-       rm -f *\.o server client monoprocess
+       rm -f *.o $(APPS)
+       cd ../../ && $(MAKE) clean_cpp_sdk      
+
+clean_apps:
+       rm -f *.o $(APPS)
+       
index 41067b5..697ab1d 100644 (file)
--- a/makefile
+++ b/makefile
@@ -53,8 +53,10 @@ c_sdk:
 oc_logger:
        cd oc_logger && $(MAKE) "BUILD=$(BUILD)"
 
-examples:
-       cd examples && $(MAKE) "BUILD=$(BUILD)"
+cpp_sdk: prep_dirs c_sdk liboc.a
+
+examples: liboc.a
+       cd examples && $(MAKE) apps "BUILD=$(BUILD)"
 
 liboc.a: OCPlatform.o OCResource.o OCUtilities.o InProcServerWrapper.o InProcClientWrapper.o
        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
@@ -79,7 +81,14 @@ clean: clean_legacy
        -rm -rf debug
        cd csdk && $(MAKE) clean
        cd csdk && $(MAKE) deepclean
-       cd examples && $(MAKE) clean
+       cd examples && $(MAKE) clean_apps
        cd oc_logger && $(MAKE) clean
+
+clean_cpp_sdk: clean_legacy
+       -rm -rf release
+       -rm -rf debug
+       cd csdk && $(MAKE) clean
+       cd csdk && $(MAKE) deepclean
+
 clean_legacy:
        -rm -f -v $(OBJ_DIR)/liboc.a $(OBJ_DIR)/*.o