Initial merge-commit of the OIC code. Should successfully do discovery for single...
[platform/upstream/iotivity.git] / csdk / libcoap-4.1.1 / Makefile
1 #other options are android, arduino
2 PLATFORM=linux
3
4 ROOT_DIR = ..
5 OCSOCK_DIR = $(ROOT_DIR)/ocsocket
6 LOGGER_DIR = $(ROOT_DIR)/logger
7 RANDOM_DIR = $(ROOT_DIR)/ocrandom
8 CJSON_DIR  = $(ROOT_DIR)/../../../ccf-utilities/tb/cJSON
9 INC_DIRS = -I$(OCSOCK_DIR)/include/ -I$(LOGGER_DIR)/include -I$(RANDOM_DIR)/include -I$(CJSON_DIR)
10
11 ifeq ($(PLATFORM),android)
12     CCPLUS=arm-linux-androideabi-g++
13     CC=arm-linux-androideabi-gcc
14     AR=arm-linux-androideabi-ar
15     RANLIB=arm-linux-androideabi-ranlib
16     CFLAGS_ANDROID =  -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16
17     LDFLAGS_ANDROID = -march=armv7-a -Wl,--fix-cortex-a8 -llog
18 else ifeq ($(PLATFORM),linux)
19     CCPLUS=g++
20     CC=gcc
21     AR=ar
22     RANLIB=ranlib
23 else
24    $(error Wrong value for PLATFORM !!)
25 endif
26
27 CFLAGS += -Os -Wall -Wno-write-strings -ffunction-sections -fdata-sections -fno-exceptions \
28         -Wextra -Wno-variadic-macros -pedantic -std=gnu99 -DWITH_POSIX -DTB_LOG
29
30 SUBDIRS:= examples doc
31
32 SOURCES:= pdu.c net.c debug.c encode.c uri.c coap_list.c resource.c hashkey.c \
33           str.c option.c async.c subscribe.c block.c ocsocket.c logger.c \
34           ocrandom.c cJSON.c
35
36 OBJECTS:= $(patsubst %.c, %.o, $(SOURCES))
37
38 VPATH = $(OCSOCK_DIR)/src:$(LOGGER_DIR)/src:$(RANDOM_DIR)/src:$(CJSON_DIR)
39
40 %.o: %.c
41         $(CC) -c $(CFLAGS) $(CFLAGS_ANDROID) $(INC_DIRS) $< -o $@
42
43 all: libcoap.a
44         $(MAKE) -C examples all
45
46 libcoap.a: $(OBJECTS)
47         $(AR) rcs $@ $^
48         $(RANLIB) $@
49
50 install: all
51         $(MAKE) -C examples install
52
53 doc:    
54         $(MAKE) -C doc
55
56 .PHONY: clean
57
58 clean: $(SUBDIRS)
59         rm -f *.o libcoap.a
60         for dir in $(SUBDIRS); do \
61                 $(MAKE) -C $$dir clean ; \
62         done
63
64