[FIX] Build for ARM target
[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                 -isystem /usr/include/osp
42
43 ## Since linking unneeded libraries bloats output of ldd(1), this variable
44 ## holds search paths and common libraries.
45
46 LDFLAGS = -shared -L/usr/lib/osp        \
47         -lX11                           \
48         -lXext                          \
49         -lcapi-appfw-application        \
50         -lcapi-system-runtime-info      \
51         -ldl                            \
52         -lecore                         \
53         -lecore_input                   \
54         -lecore_x                       \
55         -leina                          \
56         -levas                          \
57         -lpthread                       \
58         -lrt
59
60 ## FIXME: Ideally, UTILITY_SRCS is sources for probe infrastructure and
61 ## PROBE_SRCS is sources for actual replacement functions.  Unfortunatelly,
62 ## it is not so easy and UTILITY_SRCS do not link alone.
63
64 COMMON_SRCS = $(UTILITY_SRCS) $(PROBE_SRCS)
65 UTILITY_SRCS =                          \
66         ./helper/libdaprobe.c           \
67         ./helper/dahelper.c             \
68         ./helper/btsym.c                \
69         ./helper/dacollection.c         \
70         ./helper/dacapture.c            \
71         ./custom_chart/da_chart.c       \
72
73 PROBE_SRCS =                                    \
74         ./probe_memory/libdamemalloc.c          \
75         ./probe_memory/libdamemmanage.c         \
76         ./probe_socket/libdasocket.c            \
77         ./probe_event/da_event.c                \
78         ./probe_event/keytouch.c                \
79         ./probe_event/orientation.c             \
80         ./probe_third/libdaemon.c               \
81         ./probe_thread/libdathread.c            \
82         ./probe_thread/libdasync.c              \
83         ./probe_userfunc/libdauserfunc.c        \
84         ./probe_file/da_io_posix.c              \
85         ./probe_file/da_io_stdc.c               \
86
87 DUMMY_SRCS = ./custom_chart/da_chart_dummy.c
88 CAPI_SRCS =     $(COMMON_SRCS)                  \
89                 ./helper/appfw-capi.c           \
90                 ./helper/addr-capi.c            \
91                 ./probe_capi/capi_appfw.c       \
92                 ./probe_ui/capi_capture.c
93
94 TIZEN_SRCS =    $(COMMON_SRCS)                          \
95                 ./helper/appfw-tizen.cpp                \
96                 ./helper/addr-tizen.c                   \
97                 ./probe_memory/libdanew.cpp             \
98                 ./probe_tizenapi/tizen_file.cpp         \
99                 ./probe_tizenapi/tizen_socket.cpp       \
100                 ./probe_tizenapi/tizen_http.cpp         \
101                 ./probe_tizenapi/tizen_thread.cpp       \
102                 ./probe_tizenapi/tizen_lifecycle.cpp    \
103                 ./probe_tizenapi/tizen_sync.cpp         \
104                 ./probe_tizenapi/tizen_controls.cpp     \
105                 ./probe_tizenapi/tizen_constructor.cpp  \
106                 ./probe_event/gesture.cpp               \
107                 ./probe_ui/tizen_capture.cpp            \
108                 ./probe_ui/tizen_scenemanager.cpp       \
109                 ./probe_ui/tizen_frameani.cpp           \
110                 ./probe_ui/tizen_display.cpp            \
111                 ./probe_graphics/da_gles20.cpp
112
113 ## Totally brain-dead.
114 ## FIXME: Rewrite this normally with eval.
115 CAPI_OBJS = $(patsubst %.c,%.o, $(CAPI_SRCS))
116 TIZEN_OBJS = $(patsubst %.cpp,%.o, $(patsubst %.c,%.o, $(TIZEN_SRCS)))
117 DUMMY_OBJS = $(patsubst %.c,%.o, $(DUMMY_SRCS))
118
119
120 CAPI_TARGET = da_probe_capi.so
121 TIZEN_TARGET = da_probe_tizen.so
122 DUMMY_TARGET = libdaprobe.so
123
124 CPPFLAGS = $(INCLUDE_CPPFLAGS) -D_GNU_SOURCE
125 CFLAGS = $(WARN_CFLAGS) -fPIC
126 CXXFLAGS = $(WARN_CFLAGS) -fPIC
127
128 TIZEN_CPPFLAGS = -DTIZENAPP
129 TIZEN_LDFLAGS = -lstdc++ -losp-uifw -losp-appfw
130
131 all:    capi tizen dummy
132 capi:   headers $(CAPI_TARGET)
133 tizen:  headers $(TIZEN_TARGET)
134 dummy:  headers $(DUMMY_TARGET)
135
136 GENERATED_HEADERS = include/api_id_mapping.h include/api_id_list.h include/id_list
137 headers: $(GENERATED_HEADERS)
138
139 include/api_id_mapping.h: ./scripts/gen_api_id_mapping_header.awk
140 include/api_id_list.h: ./scripts/gen_api_id_mapping_header_list.awk
141 include/id_list: ./scripts/gen_api_id_mapping_list.awk
142 $(GENERATED_HEADERS): APINAMES=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:
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
164
165 .PHONY: all capi tizen dummy clean install headers