From 6d54d52787d0fbdbd9ec2b7b6bc0002085660291 Mon Sep 17 00:00:00 2001 From: Joseph Morrow Date: Thu, 2 Oct 2014 13:48:45 -0400 Subject: [PATCH] Makefile changes req'd for a global build script. Also, global build script implementation "buildScript.mk." Updated base README to reflect the options and requirements for running this build script. Patch 2: Edited makefiles so that developers CAN continue to use the build processes they're used to. Also added 'all_dev' target that will build as much of everything the build server can (including OCICUC) to prevet regression in the build process as much as possible with a full-blown build script. Patch 3: Had to edit oc_logger makefile to support the new directory output structure from the edits of this changeset. Also took care of issues that Erich pointed out. Patch 4: Added notes to README to state what is NOT being built by the current iteration of buildScript.mk. Also edited lines of README that Doug had mentioned needed updated in Patch 3. Patch 5: Edited mistype in README and edited csdk/makefile as suggested by Sachin. Note: Arduino Due is not a part of the build script process. This changeset needs to be verified on the build server and put in place as the sole build process. Once this is done, Support for building the Arduino Due will go in place. Also, Ethernet Vs. Wifi build support will go in place at that time. Right now everything is Ethernet. Change-Id: Ie9938d9f3069aff1858141565dc66b4e2ece9e98 --- README | 182 ++++++++++++--------- buildScript.mk | 127 ++++++++++++++ csdk/libcoap-4.1.1/makefile | 82 ++++++---- csdk/makefile | 107 +++++++----- .../samples/arduino/SimpleClientServer/makefile | 6 +- .../arduino/SimpleClientServer/ocserver/makefile | 38 +++-- .../samples/linux/SimpleClientServer/makefile | 22 +-- csdk/stack/test/linux/makefile | 2 +- examples/makefile | 39 ++--- examples/ocicuc/Makefile | 3 +- makefile | 33 ++-- oc_logger/Makefile | 3 +- oc_logger/samples/linux/makefile | 10 +- 13 files changed, 435 insertions(+), 219 deletions(-) create mode 100644 buildScript.mk diff --git a/README b/README index 234f15d..b4a8df6 100644 --- a/README +++ b/README @@ -1,75 +1,109 @@ -This file is completely obsolete. :-) - -Builds with g++ 4.6, 4.8, 4.9. - -Run "make" to build OCLib.a, the examples, and TBStack in RELEASE mode. - -Run "make BUILD=debug" to build OCLib.a, the examples, and TBStack in DEBUG mode. - -OCProject/ -├── csdk -│   ├── examples :: TODO :: Unused remove?? -│   │   ├── occlient.c -│   │   └── ocserver.c -│   ├── ocstack.h -│   └── ocstack_stub.c -├── examples -│   ├── client -│   │   ├── MyMultiResourceHandler.cpp -│   │   ├── MyMultiResourceHandler.h -│   │   ├── MyObserverHandler.cpp -│   │   ├── MyObserverHandler.h -│   │   ├── MyResourceHandler.cpp -│   │   ├── MyResourceHandler.h -│   │   └── OCClient.cpp -│   ├── Makefile -│   ├── OCWrapper :: TODO :: Unused remove?? -│   │   ├── Makefile -│   │   ├── parsetest.cpp -│   │   ├── testClient.cpp -│   │   ├── testServerApp.cpp -│   │   └── testServer.cpp -│   ├── server -│   │   ├── multiple_resources.cpp -│   │   └── single_resource.cpp -│   ├── test_OCClient.cpp -│   ├── test_OCReflect.cpp -│   └── test_properties.cpp -├── include - TODO : Seperate what we expose and what we don't -│   ├── IClientWrapper.h -│   ├── InitializeException.h -│   ├── InProcClientWrapper.h -│   ├── InProcServerWrapper.h -│   ├── IServerWrapper.h -│   ├── OCApi.h -│   ├── OCException.h -│   ├── OCObject.h -│   ├── OCObserver.h -│   ├── OCObserverHandler.h -│   ├── OCPlatform.h -│   ├── OCPlatformHandler.h -│   ├── OCProperties.h -│   ├── OCReflect.h -│   ├── OCResource.h -│   ├── OCResourceHandler.h -│   ├── OCSecurityModel.h -│   ├── OCServer.h :: TODO :: Unused remove?? -│   ├── OutOfProcClientWrapper.h -│   ├── OutOfProcServerWrapper.h -│   ├── ResourceInitException.h -│   └── WrapperFactory.h -├── Makefile -├── OCLib -│   ├── InProcClientWrapper.cpp -│   ├── InProcServerWrapper.cpp -│   ├── OCApi.cpp -│   ├── OCObject.cpp -│   ├── OCObserver.cpp -│   ├── OCPlatform.cpp -│   ├── OCProperties.cpp -│   ├── OCReflect.cpp -│   ├── OCResource.cpp -│   ├── OCSecurityModel.cpp -│   └── OCServer.cpp :: TODO :: Unused remove?? -└── README - You are reading this. +****************************************************************** + + Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved. + +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + +=============================================================================== +== UB Stack & TB Stack == +=============================================================================== + +The OIC-RESOURCE repository contains two SDKs with underlying code +(i.e. "stack"). The two SDKs are referred to as "UB SDK" (or "C++ SDK") and "TB +SDK" (or "C SDK"). The associated stacks are referred to as "UB Stack" (or "C++ +Stack") and "TB Stack" (or "C Stack"). The UB Stack requires that the TB Stack +is built under it. + +=============================================================================== + +The UB Stack is intended ONLY for Linux Ubuntu 12.04 operating system. +To build UB Stack, please follow these requirements: +- GCC compiler version is 4.6.1 +- Pre-install the "gnu-libc" libraries package. +- The OIC-UTILITIES repository must be a sibling directory to the OIC-RESOURCE + repository. + +The TB Stack is intended ONLY for Linux Ubuntu 12.04, Arduino ATMega 2560 with +Arduino Framework 1.0.5, and Arduino Due with Arduino Framework 1.5.7. +Tip: Use Cutecom in Ubuntu 12.04 to view logs from Arduino ATMega 2560 and +Arduino Due. + +To build TB Stack, please follow these requirements for Linux Ubuntu 12.04: +- GCC compiler version is 4.6.1 +- Pre-install the "gnu-libc" libraries package. +- The OIC-UTILITIES repository must be a cousin directory to the OIC-RESOURCE + repository. +To build TB Stack, please follow these requirements for Arduino ATMega 2560: +- AVR-GCC compiler version is 4.5.3 +- Unzip the Time Library from here to your Arduino Directory Structure: + http://playground.arduino.cc/code/time +- The OIC-UTILITIES repository must be a cousin directory to the OIC-RESOURCE + repository. +- Apply 2 patches from OIC-UTILITIES/tb/ to your Arduino Directory Structure. + +At this time, build instructions have not been written for the Arduino ATMega +2560 with WiFi Shield, Arduino Due with Ethernet Shield, and Arduino Due with +WiFi Shield. These instructions will be included very soon (as the build +server(s) verifies and utilizes the new build script "buildScript.mk"). + +=============================================================================== + +Instructions for Common Build Processes: + +NOTE: 'GNU Make' is required to utilize the build script at location: +/buildScript.mk. + +- All Modules (TB Stack, TB Unit Tests, TB Examples, UB Stack, UB Examples) for +Linux & Arduino Mega 2560: + + make -f buildScript.mk all + +- All UB Stack Modules in Release & Debug (TB Stack, UB Stack, UB Examples) for +Linux: + + make -f buildScript.mk linux_ub + +- All Modules, without OCICUC, in Release & Debug (TB Stack, TB Unit Tests, +TB Examples, UB Stack, UB Examples) for linux: + + make -f buildScript.mk linux + +- All Modules, Including OCICUC, in Release & Debug (TB Stack, TB Unit Tests, +TB Examples, UB Stack, UB Examples, UB OCICUC) for linux: +(This will be what is used on the Build Server(s) to limit regression.) + + make -f buildScript.mk all_dev + +- All UB Stack Modules, Including OCICUC, in Release & Debug (TB Stack, +UB Stack, UB Examples, UB OCICUC) for linux: + + make -f buildScript.mk linux_ub_dev + +- All TB Stack Modules in Release & Debug (TB Stack, TB Unit Tests, +TB Examples) for Linux: + + make -f buildScript.mk linux_tb + +- All TB Stack Modules in Release & Debug (TB Stack, TB Unit Tests, +TB Examples) for Arduino ATMega 2560: + + make -f buildScript.mk arduinomega + +- Clean All: + + make -f buildScript.mk clean diff --git a/buildScript.mk b/buildScript.mk new file mode 100644 index 0000000..c44d83a --- /dev/null +++ b/buildScript.mk @@ -0,0 +1,127 @@ +# //****************************************************************** +# // +# // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved. +# // +# //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +# // +# // Licensed under the Apache License, Version 2.0 (the "License"); +# // you may not use this file except in compliance with the License. +# // You may obtain a copy of the License at +# // +# // http://www.apache.org/licenses/LICENSE-2.0 +# // +# // Unless required by applicable law or agreed to in writing, software +# // distributed under the License is distributed on an "AS IS" BASIS, +# // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# // See the License for the specific language governing permissions and +# // limitations under the License. +# // +# //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +# + +# This makefile build-script requires the following for each platform: +# Note: Refer to READMEs at "/" & "/csdk/" for +# more information. +# +# Linux: +# OS: Ubuntu 12.04 +# GCC Version: 4.6.1 +# +# Arduino ATMega 2560: +# Framework Version: Arduino 1.0.5 +# AVR-GCC Version: 4.5.3 + +# Header Description: +# ====NAME/TITLE - BUILD TYPE - OUT DIRECTORY==== + +all: linux arduinomega + +all_dev: linux_ub_dev arduinomega + +linux: linux_tb linux_ub + +linux_tb: linux_tb_stack linux_tb_unittests linux_tb_examples + +linux_ub: linux_tb linux_ub_stack linux_ub_examples + +linux_tb_stack: + @echo "=====BUILD FOR LINUX - UBUNTU 12.04====" + @echo "=====BUILD LIBCOAP - DEBUG - /csdk/libcoap/linux/debug/=====" + $(MAKE) -C csdk/libcoap "BUILD=debug" "PLATFORM=linux" + @echo "=====BUILD LIBCOAP - RELEASE - /csdk/libcoap/linux/release/=====" + $(MAKE) -C csdk/libcoap "BUILD=release" "PLATFORM=linux" + @echo "=====BUILD TB STACK - DEBUG - /csdk/linux/debug/=====" + $(MAKE) -C csdk/ "buildScript_all" "BUILD=debug" "PLATFORM=linux" + @echo "=====BUILD TB STACK - RELEASE - /csdk/linux/release/=====" + $(MAKE) -C csdk/ "buildScript_all" "BUILD=release" "PLATFORM=linux" + +linux_tb_unittests: linux_tb_stack + @echo "=====BUILD TB UNITTESTS - DEBUG - /csdk/stack/test/linux/debug/=====" + $(MAKE) -C csdk/stack/test/linux/ "BUILD=debug" + @echo "=====BUILD TB UNITTESTS - RELEASE - /csdk/stack/test/linux/release/=====" + $(MAKE) -C csdk/stack/test/linux/ "BUILD=release" + +linux_tb_examples: linux_tb_stack + @echo "=====BUILD TB SAMPLE APPS - DEBUG - /csdk/stack/samples/linux/SimpleClientServer/debug/=====" + $(MAKE) -C csdk/stack/samples/linux/SimpleClientServer "PLATFORM=linux" "BUILD=debug" + @echo "=====BUILD TB SAMPLE APPS - RELEASE - /csdk/stack/samples/linux/SimpleClientServer/release/=====" + $(MAKE) -C csdk/stack/samples/linux/SimpleClientServer "PLATFORM=linux" "BUILD=release" + +linux_ub_stack: linux_tb_stack + @echo "=====BUILD UB STACK AND SAMPLE APPS AND OCICUC - DEBUG - /debug/=====" + $(MAKE) -C ./ "buildScript_all" "BUILD=debug" + @echo "=====BUILD UB STACK AND SAMPLE APPS AND OCICUC - RELEASE - /release/=====" + $(MAKE) -C ./ "buildScript_all" "BUILD=release" + +linux_ub_examples: linux_ub_stack + @echo "=====BUILD UB SAMPLE APPS - DEBUG - /examples/debug=====" + $(MAKE) -C examples/ "buildScript_all" "BUILD=debug" + @echo "=====BUILD UB SAMPLE APPS - RELEASE - /examples/release=====" + $(MAKE) -C examples/ "buildScript_all" "BUILD=release" + +linux_ub_dev: linux + @echo "=====BUILD UB OCICUC - /examples/ocicuc=====" + $(MAKE) -C examples/ocicuc/ + +arduinomega: arduinomega_ethernet + +arduinomega_ethernet: arduinomega_stack_ethernet arduinomega_samples_ethernet + +arduinomega_stack_ethernet: + @echo "=====BUILD C STACK FOR ARDUINO ATMEGA 2560 - ETHERNET SHIELD======" + @echo "=====BUILD LIBCOAP - DEBUG - /csdk/libcoap/arduinomega/ethernet_shield/debug/=====" + $(MAKE) -C csdk/libcoap "BUILD=debug" "PLATFORM=arduinomega" "ARDUINOWIFI=0" + @echo "=====BUILD LIBCOAP - RELEASE - /csdk/libcoap/arduinomega/ethernet_shield/release/=====" + $(MAKE) -C csdk/libcoap "BUILD=release" "PLATFORM=arduinomega" "ARDUINOWIFI=0" + @echo "=====BUILD TB STACK - DEBUG - /csdk/arduinomega/ethernet_shield/debug/=====" + $(MAKE) -C csdk "buildScript_all" "BUILD=debug" "PLATFORM=arduinomega" "ARDUINOWIFI=0" + @echo "=====BUILD TB STACK - RELEASE - /csdk/arduinomega/ethernet_shield/release/=====" + $(MAKE) -C csdk "buildScript_all" "BUILD=release" "PLATFORM=arduinomega" "ARDUINOWIFI=0" + +arduinomega_samples_ethernet: + @echo "=====BUILD TB SAMPLE APPS FOR ARDUINO ATMEGA 2560 - ETHERNET SHIELD=====" + @echo "=====BUILD OCSERVER - DEBUG - /csdk/stack/samples/arduino/SimpleClientServer/ocserver/arduinomega/ethernet_shield/debug/=====" + $(MAKE) -C csdk/stack/samples/arduino/SimpleClientServer/ocserver "BUILD=debug" "PLATFORM=arduinomega" "ARDUINOWIFI=0" + @echo "=====BUILD OCSERVER - RELEASE - /csdk/stack/samples/arduino/SimpleClientServer/ocserver/arduinomega/ethernet_shield/release/=====" + $(MAKE) -C csdk/stack/samples/arduino/SimpleClientServer/ocserver "BUILD=release" "PLATFORM=arduinomega" "ARDUINOWIFI=0" + +linux_clean: + -rm -rf -C csdk/libcoap/linux + -rm -rf -C csdk/linux + $(MAKE) -C csdk/stack/test/linux "clean" + $(MAKE) -C csdk/stack/samples/linux/SimpleClientServer "clean" + $(MAKE) -C . "clean" + +arduinomega_clean: + -rm -rf csdk/libcoap/arduinomega + -rm -rf csdk/arduinomega + -rm -rf csdk/stack/test/arduino/arduinomega + -rm -rf csdk/stack/samples/arduino/SimpleClientServer/ocserver/arduinomega + +clean: + $(MAKE) -C csdk "clean" "deepclean" + $(MAKE) -C csdk/stack/test/linux "clean" + $(MAKE) -C csdk/stack/samples/linux/SimpleClientServer "clean" + $(MAKE) -C csdk/stack/samples/arduino/SimpleClientServer/ocserver "clean" + $(MAKE) -C . "clean" + $(MAKE) -C oc_logger/ "clean" diff --git a/csdk/libcoap-4.1.1/makefile b/csdk/libcoap-4.1.1/makefile index 4a1469c..b43fbcc 100644 --- a/csdk/libcoap-4.1.1/makefile +++ b/csdk/libcoap-4.1.1/makefile @@ -23,25 +23,29 @@ # default to release build # default to build for linux BUILD := release -#other options are android, arduino +#other options are arduinomega, arduinodue PLATFORM=linux +#other options are arduino +PLATFORM_TYPE=linux # override with `make PLATFORM=arduinomega ARDUINOWIFI=1` to enable Arduino WiFi shield ARDUINOWIFI := 0 -OUT_DIR := ./$(BUILD) -OBJ_DIR := $(OUT_DIR)/obj - -ROOT_DIR = .. -OCSOCK_DIR = $(ROOT_DIR)/ocsocket -LOGGER_DIR = $(ROOT_DIR)/logger -OC_LOG_DIR = $(ROOT_DIR)/../oc_logger -RANDOM_DIR = $(ROOT_DIR)/ocrandom -STACK_DIR = $(ROOT_DIR)/stack -OCMALLOC_DIR = $(ROOT_DIR)/ocmalloc +ifeq ($(ROOT_DIR), ) + ROOT_DIR = .. +endif +ifeq ($(PLATFORM), "") + PLATFORM := "linux" +endif -INC_DIRS = -I$(OCSOCK_DIR)/include/ -I$(LOGGER_DIR)/include -I$(RANDOM_DIR)/include -I$(OCMALLOC_DIR)/include -I$(OC_LOG_DIR)/include +OCSOCK_DIR = $(ROOT_DIR)/ocsocket +OC_LOG_DIR = $(ROOT_DIR)/../oc_logger +LOGGER_DIR = $(ROOT_DIR)/logger +RANDOM_DIR = $(ROOT_DIR)/ocrandom +STACK_DIR = $(ROOT_DIR)/stack +OCMALLOC_DIR = $(ROOT_DIR)/ocmalloc +INC_DIRS = -I$(OCSOCK_DIR)/include/ -I$(LOGGER_DIR)/include -I$(RANDOM_DIR)/include -I$(OCMALLOC_DIR)/include -I$(OC_LOG_DIR)/include -# Note for Arduino: The CC flag is set to the C++ compiler since Arduino build +# Note for Arduino: The CC flag is set to the C++ compiler since Arduino build # includes Time.h header file which has C++ style definitions. ifeq ($(PLATFORM),android) CXX=arm-linux-androideabi-g++ @@ -51,49 +55,58 @@ ifeq ($(PLATFORM),android) CFLAGS_PLATFORM = -DWITH_POSIX -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 LDFLAGS_PLATFORM = -march=armv7-a -Wl,--fix-cortex-a8 -llog else ifeq ($(PLATFORM),linux) + PLATFORM_TYPE:=linux CXX=g++ CC=gcc AR=ar RANLIB=ranlib CFLAGS_PLATFORM = -std=gnu99 -DWITH_POSIX else ifeq ($(PLATFORM),arduinomega) + PLATFORM_TYPE:=arduino include $(ROOT_DIR)/local.properties include $(ROOT_DIR)/$(PLATFORM).properties - CC=$(ARDUINO_TOOLS_DIR)/avr-g++ + CC=$(ARDUINO_TOOLS_DIR)/avr-g++ else ifeq ($(PLATFORM),arduinodue) + PLATFORM_TYPE:=arduino include $(ROOT_DIR)/local.properties include $(ROOT_DIR)/$(PLATFORM).properties - CC=$(ARDUINO_TOOLS_DIR)/arm-none-eabi-g++ + CC=$(ARDUINO_TOOLS_DIR)/arm-none-eabi-g++ else $(error Wrong value for PLATFORM !!) endif +ifeq ($(PLATFORM_TYPE),arduino) + ifeq ($(ARDUINOWIFI),1) + SOURCES += ocsocket_arduino_wifi.c + ARDUINO_SHIELD_TYPE := "/wifi_shield" + else + SOURCES += ocsocket_arduino.c + ARDUINO_SHIELD_TYPE := "/ethernet_shield" + endif + SOURCESCPP:= Time.cpp + OBJECTSCPP:= $(patsubst %.cpp, %.o, $(SOURCESCPP)) + VPATH := $(SDIR_ARD_TIME) +else + SOURCES += ocsocket.c +endif + +OUT_DIR := ./$(PLATFORM)$(ARDUINO_SHIELD_TYPE)/$(BUILD) +OBJ_DIR := $(OUT_DIR)/obj + CC_FLAGS.debug := -O0 -g3 -Wall -ffunction-sections -fdata-sections -fno-exceptions -pedantic \ -DTB_LOG CC_FLAGS.release := -Os -Wall -ffunction-sections -fdata-sections -fno-exceptions -SOURCES:= pdu.c net.c debug.c encode.c uri.c coap_list.c resource.c hashkey.c \ - str.c option.c async.c subscribe.c block.c logger.c ocrandom.c ocmalloc.c oc_logger.c oc_console_logger.c -VPATH := $(OCSOCK_DIR)/src:$(LOGGER_DIR)/src:$(RANDOM_DIR)/src:$(OCMALLOC_DIR)/src:$(OC_LOG_DIR)/c - -ifeq (arduino, $(findstring arduino,$(PLATFORM))) - ifeq ($(ARDUINOWIFI),1) - SOURCES += ocsocket_arduino_wifi.c - else - SOURCES += ocsocket_arduino.c - endif - SOURCESCPP:= Time.cpp - OBJECTSCPP:= $(patsubst %.cpp, %.o, $(SOURCESCPP)) - VPATH += $(SDIR_ARD_TIME) -else - SOURCES += ocsocket.c -endif +SOURCES+= pdu.c net.c debug.c encode.c uri.c coap_list.c resource.c hashkey.c \ + str.c option.c async.c subscribe.c block.c logger.c ocrandom.c ocmalloc.c oc_logger.c oc_console_logger.c +VPATH += $(OCSOCK_DIR)/src:$(LOGGER_DIR)/src:$(RANDOM_DIR)/src:$(OCMALLOC_DIR)/src:$(OC_LOG_DIR)/c OBJECTS:= $(patsubst %.c, %.o, $(SOURCES)) all: prep_dirs libcoap.a prep_dirs: + -mkdir -p $(PLATFORM) -mkdir -p $(OUT_DIR) -mkdir -p $(OBJ_DIR) @@ -110,9 +123,12 @@ libcoap.a: $(OBJECTS) $(OBJECTSCPP) .PHONY: clean clean: legacy_clean - -rm -rf release - -rm -rf debug + -rm -rf linux + -rm -rf arduinomega + -rm -rf arduinodue legacy_clean: rm -f *.o libcoap.a + rm -rf release + rm -rf debug diff --git a/csdk/makefile b/csdk/makefile index d9e2b49..9da0d42 100644 --- a/csdk/makefile +++ b/csdk/makefile @@ -29,13 +29,10 @@ PLATFORM := linux ARDUINOWIFI := 0 ifeq ($(ROOT_DIR), ) -ROOT_DIR = $(PWD) -endif - -ifeq ($(OBJ_DIR), ) -OBJ_DIR = obj +ROOT_DIR = ./ endif +PLATFORM_TYPE = linux ifeq ($(PLATFORM),linux) CXX=g++ @@ -43,38 +40,60 @@ ifeq ($(PLATFORM),linux) AR=ar RANLIB=ranlib CFLAGS_PLATFORM = -DWITH_POSIX -std=c99 + PLATFORM_TYPE=linux else ifeq ($(PLATFORM),arduinomega) include local.properties include $(PLATFORM).properties - CC=$(ARDUINO_TOOLS_DIR)/avr-g++ - ifeq ($(wildcard $(ARDUINO_DIR)/libraries/Time/Time/),) + CC=$(ARDUINO_TOOLS_DIR)/avr-g++ + ifeq ($(wildcard $(ARDUINO_DIR)/libraries/Time/Time/),) $(error Arduino Time library needs to be moved from /libraries/Time \ to /libraries/Time/Time. You may need to create \ /libraries/Time/Time directory. Please refer to the wiki or readme \ for more information) - endif + endif + PLATFORM_TYPE=arduino else ifeq ($(PLATFORM),arduinodue) include local.properties include $(PLATFORM).properties - CC=$(ARDUINO_TOOLS_DIR)/arm-none-eabi-g++ + CC=$(ARDUINO_TOOLS_DIR)/arm-none-eabi-g++ + PLATFORM_TYPE=arduino else - $(error Wrong value for PLATFORM !!) + $(error Wrong value for PLATFORM !!) endif -OCLOGGER_DIR = $(ROOT_DIR)/logger -OC_LOG_DIR = $(ROOT_DIR)/../oc_logger -OCRANDOM_DIR = $(ROOT_DIR)/ocrandom -OCSOCKET_DIR = $(ROOT_DIR)/ocsocket -LCOAP_DIR = $(ROOT_DIR)/libcoap-4.1.1 -OCCOAP_DIR = $(ROOT_DIR)/occoap -OCTBSTACK_DIR = $(ROOT_DIR)/stack -OCMALLOC_DIR = $(ROOT_DIR)/ocmalloc -UTILS_DIR = $(ROOT_DIR)/../../oic-utilities/tb +ifeq ($(PLATFORM_TYPE),arduino) + ifeq ($(ARDUINOWIFI),0) + ARDUINO_SHIELD_TYPE := "/ethernet_shield" + else ifeq ($(ARDUINOWIFI), 1) + ARDUINO_SHIELD_TYPE := "/wifi_shield" + endif + PLATFORM_SPECIFIC_BACKOUT:= ../../../../ +else + PLATFORM_SPECIFIC_BACKOUT := ../../../ +endif + +ifeq ($(OUT_DIR), ) +OUT_DIR = $(PLATFORM)$(ARDUINO_SHIELD_TYPE)/$(BUILD) +endif + +ifeq ($(OBJ_DIR), ) +OBJ_DIR = $(OUT_DIR)/obj +endif + +OCLOGGER_DIR = logger +OC_LOG_DIR = ../oc_logger +OCRANDOM_DIR = ocrandom +OCSOCKET_DIR = ocsocket +LCOAP_DIR = libcoap-4.1.1 +OCCOAP_DIR = occoap +OCTBSTACK_DIR = stack +OCMALLOC_DIR = ocmalloc +UTILS_DIR = ../../oic-utilities/tb CJSON_DIR = $(UTILS_DIR)/cJSON OCCOAP_SRC = $(OCCOAP_DIR)/src OCTBSTACK_SRC = $(OCTBSTACK_DIR)/src -OCMALLOC_SRC = $(OCMALLOC_DIR)/src +OCMALLOC_SRC = $(OCMALLOC_DIR)/src CJSON_SRC = $(CJSON_DIR) OCLOGGER_INC = $(OCLOGGER_DIR)/include @@ -119,56 +138,56 @@ SOURCES := $(CJSON_SOURCES) SOURCES += $(OCCOAP_SOURCES) SOURCES += $(OCTBSTACK_SOURCES) -all: make_lcoap objdirs obj_build liboctbstack.a #print_vars +all: make_lcoap objdirs obj_build liboctbstack.a + +buildScript_all: objdirs obj_build liboctbstack.a make_lcoap: $(MAKE) -C $(LCOAP_DIR) "BUILD=$(BUILD)" "PLATFORM=$(PLATFORM)" "ARDUINOWIFI=$(ARDUINOWIFI)" -objdirs: $(ROOT_DIR) - mkdir -p $(BUILD) - mkdir -p $(BUILD)/$(OBJ_DIR) +objdirs: + mkdir -p $(PLATFORM) + mkdir -p $(PLATFORM)/$(ARDUINO_SHIELD_TYPE) + mkdir -p $(OUT_DIR) + mkdir -p $(OBJ_DIR) obj_build: @echo "Building $@" - # Output all *.o files to $(OBJ_DIR)/$(BUILD) - $(foreach source,$(SOURCES), $(CC) $(CFLAGS) $(source) -o $(patsubst %.c, %.o, $(patsubst %, $(BUILD)/$(OBJ_DIR)/%, $(notdir $(source))));) + # Output all *.o files to $(OUT_DIR)/$(BUILD)/$(OBJ_DIR) + $(foreach source,$(SOURCES), $(CC) $(CFLAGS) $(source) -o $(patsubst %.c, %.o, $(patsubst %, $(OBJ_DIR)/%, $(notdir $(source))));) liboctbstack.a: obj_build @echo "Building $@" # Unpackage libcoap.a to $(OBJ_DIR)/$(BUILD). The output objects from OCStack and OCCoap are already at this location - @cd $(BUILD)/$(OBJ_DIR) && $(AR) -x $(LCOAP_DIR)/$(BUILD)/libcoap.a + @cd $(OBJ_DIR) && $(AR) -x $(PLATFORM_SPECIFIC_BACKOUT)$(LCOAP_DIR)/$(PLATFORM)$(ARDUINO_SHIELD_TYPE)/$(BUILD)/libcoap.a # Repackage all the objects at this location into a single archive. This is OCStack, OCCoap, and LibCoap (LibCoap contains OCRandom, OCLogger, and OCSocket.). - $(AR) -r $(BUILD)/$@ $(BUILD)/$(OBJ_DIR)/*.o + $(AR) -r $(OUT_DIR)/$@ $(OBJ_DIR)/*.o .PHONY: clean print_vars clean: legacy_clean - -rm -rf release - -rm -rf debug + -rm -rf linux + -rm -rf arduinomega + -rm -rf arduinodue deepclean: legacy_deepclean - -rm -rf release - -rm -rf debug + -rm -rf linux + -rm -rf arduinomega + -rm -rf arduinodue -legacy_clean: $(ROOT_DIR) +legacy_clean: @echo "Cleaning all." rm -f $(OBJ_DIR)/$(BUILD)/*.o rm -f $(ROOT_DIR)/$(BUILD)/liboctbstack.a rm -rf $(OBJ_DIR) + rm -rf release + rm -rf debug -legacy_deepclean: $(ROOT_DIR) +legacy_deepclean: @echo "Deep-Cleaning all." rm -f $(OBJ_DIR)/$(BUILD)/*.o rm -f $(ROOT_DIR)/liboctbstack.a rm -rf $(OBJ_DIR) $(MAKE) clean -C $(LCOAP_DIR) - -print_vars: - @echo "" - @echo 'INCLUDES ARE: '$(value INC_DIRS) - @echo "" - @echo 'SOURCE FILES ARE: '$(value SOURCES) - @echo "" - @echo 'OBJ_DIR/BUILD is: '$(OBJ_DIR)'/'$(BUILD) - @echo "" - @echo 'ROOT_DIR is: '$(ROOT_DIR) + rm -rf release + rm -rf debug diff --git a/csdk/stack/samples/arduino/SimpleClientServer/makefile b/csdk/stack/samples/arduino/SimpleClientServer/makefile index c4c5442..09a61a4 100644 --- a/csdk/stack/samples/arduino/SimpleClientServer/makefile +++ b/csdk/stack/samples/arduino/SimpleClientServer/makefile @@ -21,15 +21,17 @@ BUILD := release ARDUINO_PORT := /dev/ttyACM0 APP_INSTALL := ocserver +PLATFORM := arduinomega +ARDUINOWIFI := 0 ocserver: - $(MAKE) -c ./$@ "BUILD=$(BUILD)" + $(MAKE) -c ./$@ "BUILD=$(BUILD)" "install" "PLATFORM=$(PLATFORM)" "ARDUINO_PORT=$(ARDUINO_PORT)" "BUILD=$(BUILD)" "ARDUINOWIFI=$(ARDUINOWIFI)" occlient: $(MAKE) -c ./$@ "BUILD=$(BUILD)" install: - $(MAKE) -C ./$(APP_INSTALL) "install" "ARDUINO_PORT=$(ARDUINO_PORT)" "BUILD=$(BUILD)" + $(MAKE) -C ./$(APP_INSTALL) "install" "PLATFORM=$(PLATFORM)" "ARDUINO_PORT=$(ARDUINO_PORT)" "BUILD=$(BUILD)" "ARDUINOWIFI=$(ARDUINOWIFI)" clean: $(MAKE) -C ./occlient "clean" diff --git a/csdk/stack/samples/arduino/SimpleClientServer/ocserver/makefile b/csdk/stack/samples/arduino/SimpleClientServer/ocserver/makefile index c791775..ba8fc52 100644 --- a/csdk/stack/samples/arduino/SimpleClientServer/ocserver/makefile +++ b/csdk/stack/samples/arduino/SimpleClientServer/ocserver/makefile @@ -28,8 +28,6 @@ ARDUINOWIFI := 0 APP_NAME := ocserver -OBJ_DIR := ./bin - ROOT_DIR = ../../../../.. LOGGER_DIR = $(ROOT_DIR)/logger OC_LOG_DIR = $(ROOT_DIR)/../oc_logger @@ -51,36 +49,50 @@ CFLAGS := -Os -Wall -c -DTB_LOG ifeq ($(ARDUINOWIFI),1) CFLAGS += -DARDUINOWIFI + ARDUINO_SHIELD_TYPE := "/wifi_shield" +else + ARDUINO_SHIELD_TYPE := "/ethernet_shield" endif +OUT_DIR := $(PLATFORM)$(ARDUINO_SHIELD_TYPE)/$(BUILD) + +OBJ_DIR := $(OUT_DIR)/bin + all: prep_dirs core.a $(APP_NAME).o $(APP_NAME).elf $(APP_NAME).hex core.a: $(PLATFORM_OBJS) - @cd $(OBJ_DIR) && $(AR) -x $(ROOT_DIR)/../$(BUILD)/liboctbstack.a - $(AR) rcs $@ $^ $(OBJ_DIR)/*.o - $(RANLIB) $@ + @cd $(OBJ_DIR) && $(AR) -x ../../../../$(ROOT_DIR)/$(PLATFORM)$(ARDUINO_SHIELD_TYPE)/$(BUILD)/liboctbstack.a + $(AR) rcs $(OBJ_DIR)/$@ $(foreach obj, $^, $(OBJ_DIR)/$(obj)) $(OBJ_DIR)/*.o + @cd $(OBJ_DIR) && $(RANLIB) $@ prep_dirs: + -mkdir $(PLATFORM) + -mkdir $(PLATFORM)/$(ARDUINO_SHIELD_TYPE) + -mkdir $(OUT_DIR) -mkdir $(OBJ_DIR) %.o: %.c - $(CC) $(CFLAGS) $(CFLAGS_PLATFORM) $(INC_DIRS) $(INC_DIR_PLATFORM) $< -o $@ + $(CC) $(CFLAGS) $(CFLAGS_PLATFORM) $(INC_DIRS) $(INC_DIR_PLATFORM) $< -o $(OBJ_DIR)/$@ %.o: %.cpp - $(CXX) $(CFLAGS) $(CFLAGS_PLATFORM) $(INC_DIRS) $(INC_DIR_PLATFORM) $< -o $@ + $(CXX) $(CFLAGS) $(CFLAGS_PLATFORM) $(INC_DIRS) $(INC_DIR_PLATFORM) $< -o $(OBJ_DIR)/$@ $(APP_NAME).elf: $(APP_NAME).o core.a - $(CC) -Os -Wl,--gc-sections,--relax $(CFLAGS_PLATFORM) $^ -lm -o $@ + $(CC) -Os -Wl,--gc-sections,--relax $(CFLAGS_PLATFORM) $(foreach obj, $^, $(OBJ_DIR)/$(obj)) -lm -o $(OBJ_DIR)/$@ $(APP_NAME).hex: $(APP_NAME).elf - $(AVR_OBJCOPY) -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 $< $(APP_NAME).eep - $(AVR_OBJCOPY) -O ihex -R .eeprom $< $@ + $(AVR_OBJCOPY) -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 $(OBJ_DIR)/$< $(OBJ_DIR)/$(APP_NAME).eep + $(AVR_OBJCOPY) -O ihex -R .eeprom $(OBJ_DIR)/$< $(OUT_DIR)/$@ install: all - $(AVR_PROGRAMMER) -C$(ARDUINO_DIR)/hardware/tools/avrdude.conf -v -v -v -v -patmega2560 -cstk500v2 -P$(ARDUINO_PORT) -b115200 -D -Uflash:w:$(APP_NAME).hex:i + $(AVR_PROGRAMMER) -C$(ARDUINO_DIR)/hardware/tools/avrdude.conf -v -v -v -v -patmega2560 -cstk500v2 -P$(ARDUINO_PORT) -b115200 -D -Uflash:w:$(OUT_DIR)/$(APP_NAME).hex:i .PHONY: clean -clean: +clean: legacy_clean + rm -rf arduinomega + rm -rf arduinodue + +legacy_clean: + @rm -rf bin @rm -f *.o *.d *.elf *.eep *.a *.hex *.bin *.map *- - @rm -rf $(OBJ_DIR) diff --git a/csdk/stack/samples/linux/SimpleClientServer/makefile b/csdk/stack/samples/linux/SimpleClientServer/makefile index 7a08517..e525ebd 100644 --- a/csdk/stack/samples/linux/SimpleClientServer/makefile +++ b/csdk/stack/samples/linux/SimpleClientServer/makefile @@ -23,29 +23,29 @@ BUILD := release PLATFORM := linux CC := g++ -OUT_DIR := $(PWD)/$(BUILD) +OUT_DIR := $(BUILD) OBJ_DIR := $(OUT_DIR)/obj ifeq ($(ROOT_DIR), ) -ROOT_DIR = $(PWD)/../../../.. +ROOT_DIR = ../../../.. endif -OUT_DIR = $(PWD) +OUT_DIR = . OCLOGGER_DIR = $(ROOT_DIR)/logger OC_LOG_DIR = $(ROOT_DIR)/../oc_logger OCRANDOM_DIR = $(ROOT_DIR)/ocrandom OCSOCKET_DIR = $(ROOT_DIR)/ocsocket -LCOAP_DIR = $(ROOT_DIR)/libcoap-4.1.1 -OCCOAP_DIR = $(ROOT_DIR)/occoap +LCOAP_DIR = $(ROOT_DIR)/libcoap-4.1.1 +OCCOAP_DIR = $(ROOT_DIR)/occoap OCTBSTACK_DIR = $(ROOT_DIR)/stack OCLOGGER_INC = $(OCLOGGER_DIR)/include OC_LOG_INC = $(OC_LOG_DIR)/include OCRANDOM_INC = $(OCRANDOM_DIR)/include OCSOCKET_INC = $(OCSOCKET_DIR)/include -LCOAP_INC = $(LCOAP_DIR) -OCCOAP_INC = $(OCCOAP_DIR)/include +LCOAP_INC = $(LCOAP_DIR) +OCCOAP_INC = $(OCCOAP_DIR)/include OCTBSTACK_INC = $(OCTBSTACK_DIR)/include INC_DIRS := -I$(OCLOGGER_INC) @@ -56,10 +56,10 @@ INC_DIRS += -I$(LCOAP_INC) INC_DIRS += -I$(OCCOAP_INC) INC_DIRS += -I$(OCTBSTACK_INC) -CC_FLAGS.debug := -O0 -g3 -Wall -ffunction-sections -fdata-sections -fno-exceptions \ - -std=c++0x -pedantic $(INC_DIRS) -L$(ROOT_DIR)/$(BUILD) -DTB_LOG -CC_FLAGS.release := -Os -Wall -fdata-sections -Wl,--gc-sections -Wl,-s -fno-exceptions \ - -std=c++0x $(INC_DIRS) -L$(ROOT_DIR)/$(BUILD) -DTB_LOG +CC_FLAGS.debug := -O0 -g3 -Wall -ffunction-sections -fdata-sections -fno-exceptions \ + -std=c++0x -pedantic $(INC_DIRS) -L$(ROOT_DIR)/linux/$(BUILD) -DTB_LOG +CC_FLAGS.release := -Os -Wall -fdata-sections -Wl,--gc-sections -Wl,-s -fno-exceptions \ + -std=c++0x $(INC_DIRS) -L$(ROOT_DIR)/linux/$(BUILD) -DTB_LOG LDLIBS += -loctbstack -lpthread CPPFLAGS += $(CC_FLAGS.$(BUILD)) $(LDLIBS) diff --git a/csdk/stack/test/linux/makefile b/csdk/stack/test/linux/makefile index e7c2844..43ebff7 100644 --- a/csdk/stack/test/linux/makefile +++ b/csdk/stack/test/linux/makefile @@ -58,7 +58,7 @@ else $(error Wrong value for PLATFORM !!) endif -DEP_LIBS = $(ROOT_DIR)/$(BUILD)/liboctbstack.a +DEP_LIBS = $(ROOT_DIR)/linux/$(BUILD)/liboctbstack.a CFLAGS += -Os -Wall -Wno-write-strings -ffunction-sections -fdata-sections -fno-exceptions \ -Wextra -Wno-variadic-macros -pedantic -std=gnu99 -DWITH_POSIX -DTB_LOG diff --git a/examples/makefile b/examples/makefile index 7b56b7b..8467790 100644 --- a/examples/makefile +++ b/examples/makefile @@ -21,9 +21,10 @@ # override with `make BUILD=release` # default to release build BUILD := release +PLATFORM := linux CXX := g++ #CXX := clang -OUT_DIR := $(PWD)/$(BUILD) +OUT_DIR := $(BUILD) CXX_FLAGS.debug := -O0 -g3 -std=c++0x -Wall -pthread @@ -31,7 +32,6 @@ CXX_FLAGS.release := -O3 -std=c++0x -Wall -pthread CXX_INC := -I../include/ CXX_INC += -I../oc_logger/include - CXX_INC += -I../csdk/stack/include CXX_INC += -I../csdk/ocsocket/include CXX_INC += -I../csdk/ocrandom/include @@ -40,27 +40,20 @@ CXX_INC += -I../csdk/libcoap 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 += fridgeserver -APPS += fridgeclient -APPS += garageserver -APPS += garageclient -APPS += ocicuc +CXX_LIBS := ../$(BUILD)/obj/liboc.a ../csdk/$(PLATFORM)/$(BUILD)/liboctbstack.a $(LIB_OC_LOGGER) # Force metatargets to build: -.PHONY: prep_dirs oc_cpp_sdk $(APPS) +all.PHONY: prep_dirs oc_cpp_sdk simpleserver simpleclient simpleclientserver roomserver roomclient presenceserver presenceclient garageserver garageclient fridgeserver fridgeclient ocicuc_target + +apps.PHONY: prep_dirs oc_cpp_sdk simpleserver simpleclient simpleclientserver roomserver roomclient presenceserver presenceclient garageserver garageclient fridgeserver fridgeclient + +buildScript_all.PHONY: prep_dirs simpleserver simpleclient simpleclientserver roomserver roomclient presenceserver presenceclient garageserver garageclient fridgeserver fridgeclient + +all: all.PHONY -all: .PHONY +apps: apps.PHONY -apps: prep_dirs $(APPS) +buildScript_all: buildScript_all.PHONY prep_dirs: -mkdir -p $(OUT_DIR) @@ -101,14 +94,16 @@ garageserver: garageserver.cpp garageclient: garageclient.cpp $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ garageclient.cpp $(CXX_INC) $(CXX_LIBS) -ocicuc: +ocicuc_target: cd ocicuc && $(MAKE) apps clean: - rm -rf $(OUT_DIR) + rm -rf debug + rm -rf release cd ../ && $(MAKE) clean_cpp_sdk cd ocicuc && $(MAKE) clean_apps clean_apps: - rm -rf $(OUT_DIR) + rm -rf debug + rm -rf release cd ocicuc && $(MAKE) clean_apps diff --git a/examples/ocicuc/Makefile b/examples/ocicuc/Makefile index f82d10b..56d61ad 100644 --- a/examples/ocicuc/Makefile +++ b/examples/ocicuc/Makefile @@ -19,6 +19,7 @@ # //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # BUILD:=release +PLATFORM:=linux OCLIB=../.. OCLIB_LIB=../../$(BUILD)/obj/liboc.a @@ -41,7 +42,7 @@ BOOST_LIBS=-lboost_program_options LIB_OC_LOGGER:=../../oc_logger/lib/oc_logger.a -CXX_LIBS=$(OCLIB_LIB) ../../csdk/$(BUILD)/liboctbstack.a $(LIB_OC_LOGGER) $(BOOST_LIBS) +CXX_LIBS=$(OCLIB_LIB) ../../csdk/$(PLATFORM)/$(BUILD)/liboctbstack.a $(LIB_OC_LOGGER) $(BOOST_LIBS) APPS += client APPS += server diff --git a/makefile b/makefile index 697ab1d..e3098d9 100644 --- a/makefile +++ b/makefile @@ -20,10 +20,18 @@ # # override with `make BUILD=debug` # default to release build -BUILD := release -CXX := g++ +BUILD := release +CXX := g++ #CXX := clang -OUT_DIR := $(PWD)/$(BUILD) + +ifeq ($(ROOT_DIR), ) + ROOT_DIR := $(PWD) +endif +ifeq ($(PLATFORM), ) + PLATFORM := "linux" +endif + +OUT_DIR := $(ROOT_DIR)/$(BUILD) OBJ_DIR := $(OUT_DIR)/obj CXX_FLAGS.debug := -g3 -std=c++0x -Wall -pthread -O0 @@ -39,18 +47,22 @@ CXX_INC += -I./csdk/logger/include CXX_INC += -I./csdk/libcoap # Force metatargets to build: -.PHONY: prep_dirs c_sdk oc_logger liboc.a examples +all.PHONY: prep_dirs c_sdk oc_logger_target liboc.a examples + +buildScript_all.PHONY: prep_dirs oc_logger_target liboc.a -all: .PHONY +all: all.PHONY + +buildScript_all: buildScript_all.PHONY prep_dirs: -mkdir -p $(OUT_DIR) -mkdir -p $(OBJ_DIR) c_sdk: - cd csdk && $(MAKE) "BUILD=$(BUILD)" + cd csdk && $(MAKE) "BUILD=$(BUILD)" "PLATFORM=$(PLATFORM)" -oc_logger: +oc_logger_target: cd oc_logger && $(MAKE) "BUILD=$(BUILD)" cpp_sdk: prep_dirs c_sdk liboc.a @@ -79,16 +91,13 @@ InProcClientWrapper.o: src/InProcClientWrapper.cpp clean: clean_legacy -rm -rf release -rm -rf debug - cd csdk && $(MAKE) clean - cd csdk && $(MAKE) deepclean - 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 + cd csdk && $(MAKE) clean + cd csdk && $(MAKE) deepclean diff --git a/oc_logger/Makefile b/oc_logger/Makefile index e9aaf18..5637e5e 100644 --- a/oc_logger/Makefile +++ b/oc_logger/Makefile @@ -49,7 +49,8 @@ samples: cd samples/linux && $(MAKE) "BUILD=$(BUILD)" clean: - cd examples && $(MAKE) clean + cd examples && $(MAKE) "clean" + cd samples/linux && $(MAKE) "clean" rm -rf $(BIN_DIR)/targets/*.o cd cpp && $(MAKE) clean cd c && $(MAKE) clean diff --git a/oc_logger/samples/linux/makefile b/oc_logger/samples/linux/makefile index 8b16e11..6c3bb87 100644 --- a/oc_logger/samples/linux/makefile +++ b/oc_logger/samples/linux/makefile @@ -23,14 +23,14 @@ BUILD := release PLATFORM := linux CC := g++ -OUT_DIR := $(PWD)/$(BUILD) +OUT_DIR := $(BUILD) OBJ_DIR := $(OUT_DIR)/obj ifeq ($(ROOT_DIR), ) -ROOT_DIR = $(PWD)/../../../csdk +ROOT_DIR = ../../../csdk endif -OUT_DIR = $(PWD) +OUT_DIR = ./ OCLOGGER_DIR = $(ROOT_DIR)/logger OC_LOG_DIR = $(ROOT_DIR)/../oc_logger @@ -59,9 +59,9 @@ INC_DIRS += -I$(OCCOAP_INC) INC_DIRS += -I$(OCTBSTACK_INC) CC_FLAGS.debug := -O0 -g3 -Wall -ffunction-sections -fdata-sections \ - -std=c99 $(INC_DIRS) -L$(ROOT_DIR)/$(BUILD) -DTB_LOG + -std=c99 $(INC_DIRS) -L$(ROOT_DIR)/$(PLATFORM)/$(BUILD) -DTB_LOG CC_FLAGS.release := -Os -Wall -fdata-sections -Wl,--gc-sections -Wl,-s \ - -std=c99 $(INC_DIRS) -L$(ROOT_DIR)/$(BUILD) + -std=c99 $(INC_DIRS) -L$(ROOT_DIR)/$(PLATFORM)/$(BUILD) LDLIBS += $(OC_LOG_LIB) -loctbstack -lpthread CPPFLAGS += $(CC_FLAGS.$(BUILD)) $(LDLIBS) -- 2.7.4