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