Revert "Remove TPCS and TWPServer features"
[platform/upstream/csf-framework.git] / framework / Makefile_channel_client
1 #
2 #  Copyright (c) 2014, McAfee, Inc.
3 #  
4 #  All rights reserved.
5 #  
6 #  Redistribution and use in source and binary forms, with or without modification,
7 #  are permitted provided that the following conditions are met:
8 #  
9 #  Redistributions of source code must retain the above copyright notice, this list
10 #  of conditions and the following disclaimer.
11 #  
12 #  Redistributions in binary form must reproduce the above copyright notice, this
13 #  list of conditions and the following disclaimer in the documentation and/or other
14 #  materials provided with the distribution.
15 #  
16 #  Neither the name of McAfee, Inc. nor the names of its contributors may be used
17 #  to endorse or promote products derived from this software without specific prior
18 #  written permission.
19 #  
20 #  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 #  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 #  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 #  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 #  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 #  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 #  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 #  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 #  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 #  OF THE POSSIBILITY OF SUCH DAMAGE.
30 #
31
32 OUTDIR = lib
33 TARGET = $(OUTDIR)/libscclient.so
34 SRCDIR = .
35 LD_FLAGS := $(LD_FLAGS) -ldl -lpthread $(shell pkg-config --libs libtzplatform-config)
36
37 ifeq ($(TCS_CC), )
38         CC = gcc
39 else
40         CC = $(TCS_CC)
41 endif
42 ifeq ($(TCS_LD), )
43         LD = ld
44 else
45         LD = $(TCS_LD)
46 endif
47 ifeq ($(TCS_AR), )
48         AR = ar
49 else
50         AR = $(TCS_AR)
51 endif
52 ifeq ($(TCS_STRIP), )
53         STRIP = strip
54 else
55         STRIP = $(TCS_STRIP)
56 endif
57
58 ifeq ($(TCS_CFG), release)
59         CFLAGS := -O3 -fPIC -DUNIX $(CFLAGS)
60 else
61         CFLAGS := -g -fPIC -DUNIX -DDEBUG $(CFLAGS)
62 endif
63
64 # Define a list of pkg-config packages we want to use
65
66 ifeq ($(TCS_CFG), release)
67         pkg_packages = dbus-glib-1
68 else
69         pkg_packages =  dbus-glib-1 dlog
70 endif
71
72 PKG_CFLAGS  = $(shell pkg-config --cflags $(pkg_packages))
73 PKG_LDFLAGS = $(shell pkg-config --libs $(pkg_packages))
74
75 # Combine user supplied, additional, and pkg-config flags
76 LD_FLAGS += $(PKG_LDFLAGS)
77
78 GBS_CFLAGS = -I${SYSROOT}/usr/include/dbus-1.0 -I${SYSROOT}/usr/lib/dbus-1.0/include
79 CFLAGS   += $(PKCL_CFLAGS) $(TCS_CFLAGS) $(GBS_CFLAGS) $(PKG_CFLAGS)
80
81 SOURCES = $(SRCDIR)/IpcClient.c \
82                 $(SRCDIR)/IpcStructs.c
83
84 OBJECTS = $(OUTDIR)/IpcClient.o \
85                 $(OUTDIR)/IpcStructs.o
86
87 $(OUTDIR)/%.o: $(SRCDIR)/%.c
88         $(CC) $(CFLAGS) -o $(OUTDIR)/$*.o -c $(SRCDIR)/$*.c
89
90 all: $(OUTDIR) $(TARGET)
91
92 $(TARGET): $(OBJECTS)
93         $(CC) -shared -Wl,-zdefs -o $(TARGET) $(OBJECTS) $(LD_FLAGS)
94
95 $(OUTDIR):
96         @mkdir $(OUTDIR)
97
98 install: all
99         mkdir -p ${DESTDIR}/bin
100         cp ${TARGET} ${DESTDIR}/bin/
101
102 distclean: clean
103         @rm -rf $(OUTDIR)
104
105 clean:
106         @rm -f $(TARGET)
107         @rm -f $(OBJECTS) *~
108         @rm -f *.bb *.bbg *.da *.gcov