[FEATURE] Osp: total remove
[platform/core/system/swap-probe.git] / Makefile
1 INSTALLDIR = usr/lib
2
3 ## Since include directives do not impose additional dependencies, we can make
4 ## Makefile more clear, simply putting all includes we ever need in single
5 ## variable. Keep it alphabetic, please.
6
7 INCLUDE_CPPFLAGS =                              \
8                 -I./include                     \
9                 -I./probe_thread                \
10                 -I/usr/include/appfw            \
11                 -I/usr/include/dbus-1.0         \
12                 -I/usr/include/e_dbus-1         \
13                 -I/usr/include/ecore-1          \
14                 -I/usr/include/edje-1           \
15                 -I/usr/include/eet-1            \
16                 -I/usr/include/efreet-1         \
17                 -I/usr/include/eina-1           \
18                 -I/usr/include/eina-1/eina      \
19                 -I/usr/include/elementary-1     \
20                 -I/usr/include/ethumb-1         \
21                 -I/usr/include/evas-1           \
22                 -I/usr/include/pixman-1         \
23                 -I/usr/include/system           \
24                 -I/usr/include/vconf            \
25                 -I/usr/lib/dbus-1.0/include     \
26
27 WARN_CFLAGS =                           \
28                 -Wall                   \
29                 -funwind-tables         \
30                 -fomit-frame-pointer    \
31                 -Xlinker                \
32                 --no-undefined          \
33                 -Werror                 \
34                 -Wextra                 \
35                 -O2                     \
36                 -Wwrite-strings         \
37                 -Wlogical-op            \
38                 -Wpacked                \
39                 -Winline                \
40                 -Wno-psabi              \
41
42 ## Since linking unneeded libraries bloats output of ldd(1), this variable
43 ## holds search paths and common libraries.
44
45 LDFLAGS = -shared       \
46         -lX11                           \
47         -lXext                          \
48         -lcapi-appfw-application        \
49         -lcapi-system-runtime-info      \
50         -ldl                            \
51         -lecore                         \
52         -lecore_input                   \
53         -lecore_x                       \
54         -leina                          \
55         -levas                          \
56         -lpthread                       \
57         -lrt
58
59 ASMFLAG = -O0 -g
60
61 ## FIXME: Ideally, UTILITY_SRCS is sources for probe infrastructure and
62 ## PROBE_SRCS is sources for actual replacement functions.  Unfortunatelly,
63 ## it is not so easy and UTILITY_SRCS do not link alone.
64
65 COMMON_SRCS = $(UTILITY_SRCS) $(PROBE_SRCS)
66 UTILITY_SRCS =                          \
67         ./helper/libdaprobe.c           \
68         ./helper/dahelper.c             \
69         ./helper/btsym.c                \
70         ./helper/dacollection.c         \
71         ./helper/dacapture.c            \
72         ./helper/daforkexec.c           \
73         ./custom_chart/da_chart.c       \
74
75 PROBE_SRCS =                                    \
76         ./probe_memory/libdamemalloc.c          \
77         ./probe_memory/libdamemmanage.c         \
78         ./probe_socket/libdasocket.c            \
79         ./probe_event/da_event.c                \
80         ./probe_event/keytouch.c                \
81         ./probe_event/orientation.c             \
82         ./probe_third/libdaemon.c               \
83         ./probe_thread/libdathread.c            \
84         ./probe_thread/libdasync.c              \
85         ./probe_userfunc/libdauserfunc.c        \
86         ./probe_file/da_io_posix.c              \
87         ./probe_file/da_io_stdc.c               \
88
89 DUMMY_SRCS = ./custom_chart/da_chart_dummy.c
90 CAPI_SRCS =     $(COMMON_SRCS)                  \
91                 ./helper/appfw-capi.c           \
92                 ./helper/addr-capi.c            \
93                 ./probe_capi/capi_appfw.c       \
94                 ./probe_ui/capi_capture.c
95
96 TIZEN_SRCS =    $(COMMON_SRCS)                          \
97                 ./helper/addr-tizen.c                   \
98                 ./helper/common_probe_init.cpp  \
99                 ./probe_memory/libdanew.cpp
100
101 ASM_SRC = ./helper/da_call_original.S
102
103 ## Totally brain-dead.
104 ## FIXME: Rewrite this normally with eval.
105 ASM_OBJ = $(patsubst %.S,%.o, $(ASM_SRC))
106 CAPI_OBJS = $(patsubst %.c,%.o, $(CAPI_SRCS)) $(ASM_OBJ)
107 TIZEN_OBJS = $(patsubst %.cpp,%.o, $(patsubst %.c,%.o, $(TIZEN_SRCS))) $(ASM_OBJ)
108 DUMMY_OBJS = $(patsubst %.c,%.o, $(DUMMY_SRCS))
109
110
111 CAPI_TARGET = da_probe_capi.so
112 TIZEN_TARGET = da_probe_tizen.so
113 DUMMY_TARGET = libdaprobe.so
114
115 CPPFLAGS = $(INCLUDE_CPPFLAGS) -D_GNU_SOURCE -DSELF_LIB_NAME="\"/$(INSTALLDIR)/$(TIZEN_TARGET)\""
116 CFLAGS = $(WARN_CFLAGS) -fPIC
117 CXXFLAGS = $(WARN_CFLAGS) -fPIC
118
119 TIZEN_CPPFLAGS = -DTIZENAPP
120 TIZEN_LDFLAGS = -lstdc++
121
122 all:    capi tizen dummy
123 capi:   headers $(CAPI_TARGET)
124 tizen:  headers $(TIZEN_TARGET)
125 dummy:  headers $(DUMMY_TARGET)
126
127 $(ASM_OBJ): $(ASM_SRC)
128         $(CC) $(ASMFLAG) -c $^ -o $@
129
130 GENERATED_HEADERS = include/api_id_mapping.h include/api_id_list.h include/id_list
131 headers: $(GENERATED_HEADERS)
132 rmheaders:
133         rm -f $(GENERATED_HEADERS)
134
135 include/api_id_mapping.h: ./scripts/gen_api_id_mapping_header.awk
136 include/api_id_list.h: ./scripts/gen_api_id_mapping_header_list.awk
137 include/id_list: ./scripts/gen_api_id_mapping_list.awk
138
139 da_api_map: $(GENERATED_HEADERS)
140
141 $(GENERATED_HEADERS): APINAMES=scripts/api_names.txt
142 $(GENERATED_HEADERS): ./scripts/api_names.txt
143 $(GENERATED_HEADERS):
144         awk -f $< < $(APINAMES) > $@
145
146 $(CAPI_TARGET): $(CAPI_OBJS)
147         $(CC) $(LDFLAGS) $^ -o $@
148
149 $(TIZEN_TARGET): LDFLAGS+=$(TIZEN_LDFLAGS)
150 $(TIZEN_TARGET): CPPFLAGS+=$(TIZEN_CPPFLAGS)
151 $(TIZEN_TARGET): $(TIZEN_OBJS)
152         $(CC) $(LDFLAGS) $^ -o $@
153
154 $(DUMMY_TARGET): $(DUMMY_OBJS)
155         $(CC) $(LDFLAGS) $^ -o $@
156
157 install: all
158         [ -d "$(DESTDIR)/$(INSTALLDIR)" ] || mkdir -p $(DESTDIR)/$(INSTALLDIR)
159         install $(TIZEN_TARGET) $(DUMMY_TARGET) $(DESTDIR)/$(INSTALLDIR)/
160         install -m 644 include/id_list $(DESTDIR)/$(INSTALLDIR)/da_api_map
161
162 clean:
163         rm -f *.so *.o $(GENERATED_HEADERS)
164
165 .PHONY: all capi tizen dummy clean install headers