Merge "Doxygen run for *.h files"
[platform/upstream/iotivity.git] / csdk / ocsocket / test / arduino / makefile
1 # //******************************************************************
2 # //
3 # // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
4 # //
5 # //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 # //
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
10 # //
11 # //      http://www.apache.org/licenses/LICENSE-2.0
12 # //
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.
18 # //
19 # //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20 #
21 BUILD := release
22 PLATFORM := arduinomega
23 ARDUINO_PORT := /dev/ttyACM0
24
25 # override with `make PLATFORM=arduinomega ARDUINOWIFI=1` to enable Arduino WiFi shield
26 ARDUINOWIFI := 0
27
28 ifeq ($(ARDUINOWIFI),0)
29         APP_NAME := ocsocket_test
30         OCSOCKET_CPPOBJ = ocsocket_arduino.o
31 else
32         APP_NAME := ocsocket_wifi_test
33         OCSOCKET_CPPOBJ = ocsocket_arduino_wifi.o
34 endif
35
36 OBJ_DIR := ./bin
37
38 ROOT_DIR = ../../..
39
40 include $(ROOT_DIR)/local.properties
41 include $(ROOT_DIR)/$(PLATFORM).properties
42
43
44 #include directories
45 OCSOCK_DIR = $(ROOT_DIR)/ocsocket
46 LOGGER_DIR = $(ROOT_DIR)/logger
47 INC_DIRS = -I$(OCSOCK_DIR)/include/ -I$(LOGGER_DIR)/include
48
49 VPATH := $(SDIR_ARD_PLATFORM):$(LOGGER_DIR)/src:$(OCSOCK_DIR)/src 
50
51 CFLAGS  := -Os -Wall -c -DTB_LOG
52
53 all: core.a $(APP_NAME).o $(APP_NAME).elf $(APP_NAME).hex
54
55 core.a: $(PLATFORM_OBJS)
56         $(AR) rcs $@ $^
57         $(RANLIB) $@
58
59 #logger needs to be compiled using C++ compiler
60 logger.o: logger.c
61         $(CCPLUS) $(CFLAGS) $(CFLAGS_PLATFORM) $(INC_DIRS) $(INC_DIR_PLATFORM) $< -o $@
62
63 %.o: %.c
64         $(CC) $(CFLAGS) $(CFLAGS_PLATFORM) $(INC_DIRS) $(INC_DIR_PLATFORM) $< -o $@
65
66 %.o: %.cpp
67         $(CCPLUS) $(CFLAGS) $(CFLAGS_PLATFORM) $(INC_DIRS) $(INC_DIR_PLATFORM) $< -o $@
68
69 $(APP_NAME).elf: $(APP_NAME).o $(OCSOCKET_CPPOBJ) logger.o core.a
70         $(CC) -Os -Wl,--gc-sections,--relax $(CFLAGS_PLATFORM) $^ -lm -o $@
71
72 $(APP_NAME).hex: $(APP_NAME).elf
73         $(AVR_OBJCOPY) -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 $< $(APP_NAME).eep
74         $(AVR_OBJCOPY) -O ihex -R .eeprom $< $@
75
76 install: all
77         $(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
78
79 .PHONY: clean
80
81 clean:
82         @rm -f *.o *.d *.elf *.eep *.a *.hex *.bin *.map *-
83         @rm -rf $(OBJ_DIR)
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104