1 # override with `make BUILD=debug`
2 # override with `make PLATFORM=arduinomega` or `make PLATFORM=arduinodue`
3 # default to release build
4 # default to build for linux
6 #other options are android, arduino
8 # override with `make PLATFORM=arduinomega ARDUINOWIFI=1` to enable Arduino WiFi shield
12 OBJ_DIR := $(OUT_DIR)/obj
16 # Note for Arduino: The CC flag is set to the C++ compiler since Arduino build
17 # includes Time.h header file which has C++ style definitions.
18 ifeq ($(PLATFORM),arduinomega)
19 include $(ROOT_DIR)/arduino/local.properties
20 include $(ROOT_DIR)/arduino/$(PLATFORM).properties
21 CC=$(ARDUINO_TOOLS_DIR)/avr-gcc
22 else ifeq ($(PLATFORM),arduinodue)
23 include $(ROOT_DIR)/local.properties
24 include $(ROOT_DIR)/$(PLATFORM).properties
25 CC=$(ARDUINO_TOOLS_DIR)/arm-none-eabi-g++
27 $(error Wrong value for PLATFORM !!)
30 CC_FLAGS.debug := -O0 -g3 -Wall -ffunction-sections -fdata-sections -fno-exceptions -pedantic \
32 CC_FLAGS.release := -Os -Wall -ffunction-sections -fdata-sections -fno-exceptions
34 SOURCES:= pdu.c net.c debug.c encode.c uri.c coap_list.c resource.c hashkey.c \
35 str.c option.c async.c subscribe.c block.c
36 #VPATH := $(OCSOCK_DIR)/src:$(LOGGER_DIR)/src:$(RANDOM_DIR)/src
37 ifeq (arduino, $(findstring arduino,$(PLATFORM)))
39 OBJECTSCPP:= $(patsubst %.cpp, %.o, $(SOURCESCPP))
40 VPATH += $(SDIR_ARD_TIME)
43 OBJECTS:= $(patsubst %.c, %.o, $(SOURCES))
45 all: prep_dirs libcoap.a
52 $(CC) -c $(CC_FLAGS.$(BUILD)) $(CFLAGS_PLATFORM) $(INC_DIR_PLATFORM) $< -o $(OBJ_DIR)/$@
55 $(CCPLUS) -c $(CC_FLAGS.$(BUILD)) $(CFLAGS_PLATFORM) $(INC_DIR_PLATFORM) $< -o $(OBJ_DIR)/$@
57 libcoap.a: $(OBJECTS) $(OBJECTSCPP)
58 $(AR) rcs $(OUT_DIR)/$@ $(addprefix $(OBJ_DIR)/,$^)
59 $(RANLIB) $(OUT_DIR)/$@
67 #There is no installation in LibCoap.