d4f18c0f93c98189d156c94b023627e7c748da21
[AGL/meta-agl.git] / meta-agl-bsp / meta-iot-cloud / recipes-aws / aws-iot-device-sdk-embedded-c / files / Makefile.aws
1 ###########################################################################
2 # Copyright 2020 MERA
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 ###########################################################################
16
17 # Generated library name
18 NAME := awsiotsdk
19
20 SRC = .
21 AWS_SDK_DIR = $(SRC)/..
22 PLATFORM_DIR = $(AWS_SDK_DIR)/platform/linux/mbedtls
23 PLATFORM_COMMON_DIR = $(AWS_SDK_DIR)/platform/linux/common
24 AWS_INSTALL_HEADERS_DIR = /usr/include/awsiotsdk
25
26
27 CFLAGS += -I $(AWS_SDK_DIR)/include
28 CFLAGS += -I $(AWS_SDK_DIR)/external_libs/jsmn
29 CFLAGS += -I $(PLATFORM_COMMON_DIR)
30 CFLAGS += -I $(PLATFORM_DIR)
31 CFLAGS += -DENABLE_IOT_DEBUG -DENABLE_IOT_INFO -DENABLE_IOT_WARN -DENABLE_IOT_ERROR
32
33
34 # Source to compile
35 SRCS += $(wildcard $(SRC)/*.c)
36 SRCS += $(wildcard $(AWS_SDK_DIR)/external_libs/jsmn/*.c)
37 SRCS += $(wildcard $(PLATFORM_DIR)/*.c)
38 SRCS += $(wildcard $(PLATFORM_COMMON_DIR)/*.c)
39
40 OBJS = $(SRCS:.c=.o)
41
42
43 .PHONY: all
44 all: lib$(NAME).a
45
46 lib$(NAME).a: $(OBJS)
47         $(AR) -rcs $@ $(OBJS)
48
49 .PHONY: install
50 install: lib$(NAME).a
51         install -D -m 0644 lib$(NAME).a $(DESTDIR)/usr/lib/lib$(NAME).a
52         install -d $(DESTDIR)$(AWS_INSTALL_HEADERS_DIR)
53         install -m 0644 $(AWS_SDK_DIR)/include/*.h $(DESTDIR)$(AWS_INSTALL_HEADERS_DIR)/
54         install -m 0644 $(AWS_SDK_DIR)/external_libs/jsmn/*.h $(DESTDIR)$(AWS_INSTALL_HEADERS_DIR)/
55         install -m 0644 $(PLATFORM_COMMON_DIR)/*.h $(DESTDIR)$(AWS_INSTALL_HEADERS_DIR)/
56         install -m 0644 $(PLATFORM_DIR)/*.h $(DESTDIR)$(AWS_INSTALL_HEADERS_DIR)/
57         install -d $(DESTDIR)/usr/lib/pkgconfig
58         install -m 0644 ../awsiotsdk.pc $(DESTDIR)/usr/lib/pkgconfig/ 
59
60 .PHONY: clean
61 clean:
62         -rm -f lib$(NAME).a $(OBJS)