Revert "Remove TPCS and TWPServer features"
[platform/upstream/csf-framework.git] / framework / Makefile_TWPSerDaemon
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 = bin
33 TARGET = $(OUTDIR)/TWPSerDaemon
34 SRCDIR = .
35 INCLUDE = -I. $(TCS_INC) -I../plugin
36 LD_FLAGS := $(LD_FLAGS) -ldl -lpthread -lsecfw -lscserver -lm -Llib $(shell pkg-config --libs libtzplatform-config)
37
38 ifeq ($(TCS_CC), )
39         CC = gcc
40 else
41         CC = $(TCS_CC)
42 endif
43 ifeq ($(TCS_LD), )
44         LD = ld
45 else
46         LD = $(TCS_LD)
47 endif
48 ifeq ($(TCS_AR), )
49         AR = ar
50 else
51         AR = $(TCS_AR)
52 endif
53 ifeq ($(TCS_STRIP), )
54         STRIP = strip
55 else
56         STRIP = $(TCS_STRIP)
57 endif
58
59 ifeq ($(TCS_CFG), release)
60         CFLAGS := -O3 -fPIC $(INCLUDE) -DUNIX $(CFLAGS)
61 else
62         CFLAGS := -g -fPIC $(INCLUDE) -DUNIX -DDEBUG $(CFLAGS)
63 endif
64
65 CFLAGS := $(CFLAGS) $(PKCL_CFLAGS) $(TCS_CFLAGS)
66
67 SOURCES = $(SRCDIR)/TWPSerDaemon.c \
68                 $(SRCDIR)/IpcForkDaemon.c 
69
70 OBJECTS = $(OUTDIR)/TWPSerDaemon.o \
71                 $(OUTDIR)/IpcForkDaemon.o
72
73 # Define a list of pkg-config packages we want to use
74 ifeq ($(TCS_CFG), release)
75         pkg_packages = dbus-glib-1
76 else
77         pkg_packages = dbus-glib-1 dlog
78 endif
79
80 PKG_CFLAGS  = $(shell pkg-config --cflags $(pkg_packages))
81 PKG_LDFLAGS = $(shell pkg-config --libs $(pkg_packages))
82
83 # Combine user supplied, additional, and pkg-config flags
84 PKGLD_FLAGS += $(PKG_LDFLAGS) -lscserver -L./lib
85
86 GBS_CFLAGS = -I${SYSROOT}/usr/include/dbus-1.0 -I${SYSROOT}/usr/lib/dbus-1.0/include
87 PKGCFLAGS += -I$(SRCDIR) $(PKCL_CFLAGS) $(GBS_CFLAGS) $(PKG_CFLAGS)
88
89 $(OUTDIR)/%.o: $(SRCDIR)/%.c
90         $(CC) $(CFLAGS) $(PKGCFLAGS) -I. -o $(OUTDIR)/$*.o -c $(SRCDIR)/$*.c
91
92 all: $(OUTDIR) $(TARGET)
93
94 $(TARGET): $(OBJECTS)
95         $(CC) -Wl,-zdefs -o $(TARGET) $(OBJECTS) $(LD_FLAGS) $(PKGLD_FLAGS)
96
97 $(OUTDIR):
98         @mkdir $(OUTDIR)
99
100 distclean: clean
101         @rm -rf $(OUTDIR)
102
103 clean:
104         @rm -f $(TARGET)
105         @rm -f $(OBJECTS) *~
106         @rm -f *.bb *.bbg *.da *.gcov