1 # //******************************************************************
3 # // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
5 # //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 # // Licensed under the Apache License, Version 2.0 (the "License");
8 # // you may not use this file except in compliance with the License.
9 # // You may obtain a copy of the License at
11 # // http://www.apache.org/licenses/LICENSE-2.0
13 # // Unless required by applicable law or agreed to in writing, software
14 # // distributed under the License is distributed on an "AS IS" BASIS,
15 # // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # // See the License for the specific language governing permissions and
17 # // limitations under the License.
19 # //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
23 #other options are android, arduino
27 OCSOCK_DIR = $(ROOT_DIR)/ocsocket
28 LOGGER_DIR = $(ROOT_DIR)/logger
29 RANDOM_DIR = $(ROOT_DIR)/ocrandom
31 INC_DIRS = -I.. -I$(OCSOCK_DIR)/include/ -I$(LOGGER_DIR)/include -I$(RANDOM_DIR)/include
33 ifeq ($(PLATFORM),android)
34 CXX=arm-linux-androideabi-g++
35 CC=arm-linux-androideabi-gcc
36 AR=arm-linux-androideabi-ar
37 RANLIB=arm-linux-androideabi-ranlib
38 CFLAGS_ANDROID = -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16
39 LDFLAGS_ANDROID = -march=armv7-a -Wl,--fix-cortex-a8 -llog
40 else ifeq ($(PLATFORM),linux)
46 $(error Wrong value for PLATFORM !!)
49 DEP_LIBS = ../libcoap.a
51 CFLAGS += -Os -Wall -Wno-write-strings -ffunction-sections -fdata-sections -fno-exceptions \
52 -Wextra -Wno-variadic-macros -pedantic -std=gnu99 -DWITH_POSIX
54 PROGRAMS = coap-server coap-client
56 SOURCES:= client.c server.c
58 OBJECTS:= $(patsubst %.c, %.o, $(SOURCES))
63 $(CC) -c $(CFLAGS) $(CFLAGS_ANDROID) $(INC_DIRS) $< -o $@
65 coap-client: client.o $(DEP_LIBS)
66 $(CC) -Os -Wl,--gc-sections $(LDFLAGS_ANDROID) $^ -o $@
68 coap-server: server.o $(DEP_LIBS)
69 $(CC) -Os -Wl,--gc-sections $(LDFLAGS_ANDROID) $^ -o $@
72 @echo "Installing for PLATFORM $(PLATFORM)"
73 ifeq ($(PLATFORM),android)
74 adb push coap-client /data/local/tmp/
75 adb push coap-server /data/local/tmp/