blob: 1d5521b548d991d7f2298b00a92162960304111d [file] [log] [blame]
anjana_sreekumar@infosys.com991c2062020-01-08 11:42:57 +05301#
2# Copyright (c) 2003-2018, Great Software Laboratory Pvt. Ltd.
3# Copyright (c) 2017 Intel Corporation
4# Copyright (c) 2019, Infosys Ltd.
5#
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#
18include ../../Makefile.common
19
20ifeq ($(DEBUG),true)
21 CFLAGS += -g
22endif
23
24ifeq ($(DEBUG),false)
25 CFLAGS += -O3
26endif
27
28IF_LIBNAME = $(LIBDIR)/libinterface.so
29JSON_PARSER_LIBNAME = $(LIBDIR)/libjson.so
30LOG_LIBNAME = $(LIBDIR)/liblog.a
31TPOOL_LIBNAME = $(LIBDIR)/libthreadpool.a
32UTIL_LIBNAME = $(LIBDIR)/libsecutil.so
33
34IF_SRC = ./ipc_api.c
35LOG_SRC = ./log.c
36TPOOL_SRC = ./thread_pool.c ./tpool_queue.c
37JSON_PARSER_SRC = ./json_parser.c
38UTIL_SRC = ./snow_3g.c ./f8.c ./f9.c
39
40SRCDIR := .
41SRCEXT := c
42IF_OBJS := $(patsubst $(SRCDIR)/%,$(OBJDIR)/common/%,$(IF_SRC:.$(SRCEXT)=.o))
43LOG_OBJS := $(patsubst $(SRCDIR)/%,$(OBJDIR)/common/%,$(LOG_SRC:.$(SRCEXT)=.o))
44TPOOL_OBJS := $(patsubst $(SRCDIR)/%,$(OBJDIR)/common/%,$(TPOOL_SRC:.$(SRCEXT)=.o))
45JSON_PARSER_OBJS := $(patsubst $(SRCDIR)/%,$(OBJDIR)/common/%,$(JSON_PARSER_SRC:.$(SRCEXT)=.o))
46UTIL_OBJS := $(patsubst $(SRCDIR)/%,$(OBJDIR)/common/%,$(UTIL_SRC:.$(SRCEXT)=.o))
47
48OBJS := $(IF_OBJS) \
49 $(LOG_OBJS)\
50 $(TPOOL_OBJS) \
51 $(JSON_PARSER_OBJS) \
52 $(UTIL_OBJS)
53
54build_commonLibs: $(OBJS)
55 -@echo "Linking..."
56 -@mkdir -p $(LIBDIR)
57 $(CC) $(CFLAGS) $(IF_OBJS) -shared -o $(IF_LIBNAME)
58 $(CC) $(CFLAGS) $(JSON_PARSER_OBJS) -shared -o $(JSON_PARSER_LIBNAME)
59 $(CC) $(CFLAGS) $(UTIL_OBJS) -shared -o $(UTIL_LIBNAME)
60 ar rcs $(LOG_LIBNAME) $(LOG_OBJS)
61 ar rcs $(TPOOL_LIBNAME) $(TPOOL_OBJS)
62
63$(OBJS) : $(OBJDIR)/common/%.o : $(SRCDIR)/%.c
64 -@mkdir -p $(OBJDIR)/common
65 $(CC) $(CFLAGS) $(INC_DIRS) -fPIC -c -o $@ $<
66
67all: build_commonLibs
68
69install:all
70 -@mkdir -p $(TARGET_DIR)/lib
71 -@mkdir -p $(TARGET_DIR)/conf
72 -@cp $(IF_LIBNAME) $(TARGET_DIR)/lib
73 -@cp $(LOG_LIBNAME) $(TARGET_DIR)/lib
74 -@cp $(JSON_PARSER_LIBNAME) $(TARGET_DIR)/lib
75 -@cp $(UTIL_LIBNAME) $(TARGET_DIR)/lib
76 -@cp $(TPOOL_LIBNAME) $(TARGET_DIR)/lib
77
78clean:
79 rm -f $(OBJDIR)/common
80 rm -f $(IF_LIBNAME) \
81 $(JSON_PARSER_LIBNAME) \
82 $(UTIL_LIBNAME) \
83 $(LOG_LIBNAME) \
84 $(TPOOL_LIBNAME)
85