06d34fe714eb94991126f59a8b1f41f741e9a9a1
[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/osp              \
23                 -I/usr/include/pixman-1         \
24                 -I/usr/include/system           \
25                 -I/usr/include/vconf            \
26                 -I/usr/lib/dbus-1.0/include     \
27
28 WARN_CFLAGS =                           \
29                 -Wall                   \
30                 -funwind-tables         \
31                 -fomit-frame-pointer    \
32                 -Xlinker                \
33                 --no-undefined          \
34                 -Werror                 \
35                 -Wextra                 \
36                 -O2                     \
37                 -Wwrite-strings         \
38                 -Wlogical-op            \
39                 -Wpacked                \
40                 -Winline                \
41                 -Wno-psabi              \
42                 -isystem /usr/include/osp
43
44 ## Since linking unneeded libraries bloats output of ldd(1), this variable
45 ## holds search paths and common libraries.
46
47 LDFLAGS = -shared -L/usr/lib/osp        \
48         -lX11                           \
49         -lXext                          \
50         -lcapi-appfw-application        \
51         -lcapi-system-runtime-info      \
52         -ldl                            \
53         -lecore                         \
54         -lecore_input                   \
55         -lecore_x                       \
56         -leina                          \
57         -levas                          \
58         -lpthread                       \
59         -lrt
60
61 ASMFLAG = -O0 -g
62
63 ## FIXME: Ideally, UTILITY_SRCS is sources for probe infrastructure and
64 ## PROBE_SRCS is sources for actual replacement functions.  Unfortunatelly,
65 ## it is not so easy and UTILITY_SRCS do not link alone.
66
67 COMMON_SRCS = $(UTILITY_SRCS) $(PROBE_SRCS)
68 UTILITY_SRCS =                          \
69         ./helper/libdaprobe.c           \
70         ./helper/dahelper.c             \
71         ./helper/btsym.c                \
72         ./helper/dacollection.c         \
73         ./helper/dacapture.c            \
74         ./helper/daforkexec.c           \
75         ./custom_chart/da_chart.c       \
76
77 PROBE_SRCS =                                    \
78         ./probe_memory/libdamemalloc.c          \
79         ./probe_memory/libdamemmanage.c         \
80         ./probe_socket/libdasocket.c            \
81         ./probe_event/da_event.c                \
82         ./probe_event/keytouch.c                \
83         ./probe_event/orientation.c             \
84         ./probe_third/libdaemon.c               \
85         ./probe_thread/libdathread.c            \
86         ./probe_thread/libdasync.c              \
87         ./probe_userfunc/libdauserfunc.c        \
88         ./probe_file/da_io_posix.c              \
89         ./probe_file/da_io_stdc.c               \
90
91 DUMMY_SRCS = ./custom_chart/da_chart_dummy.c
92 CAPI_SRCS =     $(COMMON_SRCS)                  \
93                 ./helper/appfw-capi.c           \
94                 ./helper/addr-capi.c            \
95                 ./probe_capi/capi_appfw.c       \
96                 ./probe_ui/capi_capture.c
97
98 TIZEN_SRCS =    $(COMMON_SRCS)                          \
99                 ./helper/appfw-tizen.cpp                \
100                 ./helper/addr-tizen.c                   \
101                 ./helper/common_probe_init.cpp          \
102                 ./probe_memory/libdanew.cpp             \
103                 ./probe_tizenapi/tizen_file.cpp         \
104                 ./probe_tizenapi/tizen_socket.cpp       \
105                 ./probe_tizenapi/tizen_http.cpp         \
106                 ./probe_tizenapi/tizen_thread.cpp       \
107                 ./probe_tizenapi/tizen_lifecycle.cpp    \
108                 ./probe_tizenapi/tizen_sync.cpp         \
109                 ./probe_tizenapi/tizen_controls.cpp     \
110                 ./probe_tizenapi/tizen_constructor.cpp  \
111                 ./probe_event/gesture.cpp               \
112                 ./probe_ui/tizen_capture.cpp            \
113                 ./probe_ui/tizen_scenemanager.cpp       \
114                 ./probe_ui/tizen_frameani.cpp           \
115                 ./probe_ui/tizen_display.cpp            \
116                 ./probe_graphics/da_gles20_tizen.cpp            \
117                 ./probe_graphics/da_gles20_native.cpp           \
118                 ./probe_graphics/da_egl_tizen.cpp                       \
119                 ./probe_graphics/da_egl_native.cpp
120
121 ASM_SRC = ./helper/da_call_original.S
122
123 ## Totally brain-dead.
124 ## FIXME: Rewrite this normally with eval.
125 ASM_OBJ = $(patsubst %.S,%.o, $(ASM_SRC))
126 CAPI_OBJS = $(patsubst %.c,%.o, $(CAPI_SRCS)) $(ASM_OBJ)
127 TIZEN_OBJS = $(patsubst %.cpp,%.o, $(patsubst %.c,%.o, $(TIZEN_SRCS))) $(ASM_OBJ)
128 DUMMY_OBJS = $(patsubst %.c,%.o, $(DUMMY_SRCS))
129
130
131 CAPI_TARGET = da_probe_capi.so
132 TIZEN_TARGET = da_probe_tizen.so
133 DUMMY_TARGET = libdaprobe.so
134
135 CPPFLAGS = $(INCLUDE_CPPFLAGS) -D_GNU_SOURCE -DSELF_LIB_NAME="\"/$(INSTALLDIR)/$(TIZEN_TARGET)\""
136 CFLAGS = $(WARN_CFLAGS) -fPIC
137 CXXFLAGS = $(WARN_CFLAGS) -fPIC
138
139 TIZEN_CPPFLAGS = -DTIZENAPP
140 TIZEN_LDFLAGS = -lstdc++ -losp-uifw -losp-appfw
141
142 all:    capi tizen dummy
143 capi:   headers $(CAPI_TARGET)
144 tizen:  headers $(TIZEN_TARGET)
145 dummy:  headers $(DUMMY_TARGET)
146
147 $(ASM_OBJ): $(ASM_SRC)
148         $(CC) $(ASMFLAG) -c $^ -o $@
149
150 GENERATED_HEADERS = include/api_id_mapping.h include/api_id_list.h include/id_list
151 headers: $(GENERATED_HEADERS)
152
153 include/api_id_mapping.h: ./scripts/gen_api_id_mapping_header.awk
154 include/api_id_list.h: ./scripts/gen_api_id_mapping_header_list.awk
155 include/id_list: ./scripts/gen_api_id_mapping_list.awk
156
157 da_api_map: $(GENERATED_HEADERS)
158
159 $(GENERATED_HEADERS): APINAMES=scripts/api_names.txt
160 $(GENERATED_HEADERS): ./scripts/api_names.txt
161 $(GENERATED_HEADERS):
162         awk -f $< < $(APINAMES) > $@
163
164 $(CAPI_TARGET): $(CAPI_OBJS)
165         $(CC) $(LDFLAGS) $^ -o $@
166
167 $(TIZEN_TARGET): LDFLAGS+=$(TIZEN_LDFLAGS)
168 $(TIZEN_TARGET): CPPFLAGS+=$(TIZEN_CPPFLAGS)
169 $(TIZEN_TARGET): $(TIZEN_OBJS)
170         $(CC) $(LDFLAGS) $^ -o $@
171
172 $(DUMMY_TARGET): $(DUMMY_OBJS)
173         $(CC) $(LDFLAGS) $^ -o $@
174
175 install: all
176         [ -d "$(DESTDIR)/$(INSTALLDIR)" ] || mkdir -p $(DESTDIR)/$(INSTALLDIR)
177         install $(TIZEN_TARGET) $(DUMMY_TARGET) $(DESTDIR)/$(INSTALLDIR)/
178         install -m 644 include/id_list $(DESTDIR)/$(INSTALLDIR)/da_api_map
179
180 clean:
181         rm -f *.so *.o $(GENERATED_HEADERS)
182
183 .PHONY: all capi tizen dummy clean install headers