[REFACTOR] More modular Makefile
[platform/core/system/swap-probe.git] / Makefile
1 CURDIR = `pwd`
2 INSTALLDIR = usr/lib
3
4 DUMMY_VERSION = 0.0.1
5
6 INC_COMMON = -I./include \
7                          -I./probe_thread \
8                          -I/usr/include/system \
9                          -I/usr/include/appfw \
10                          -I/usr/include/ecore-1 \
11                          -I/usr/include/evas-1 \
12                          -I/usr/include/eina-1 \
13                          -I/usr/include/eina-1/eina \
14                          -I/usr/include/elementary-1 \
15                          -I/usr/include/eet-1 \
16                          -I/usr/include/edje-1 \
17                          -I/usr/include/efreet-1 \
18                          -I/usr/include/ethumb-1 \
19                          -I/usr/include/e_dbus-1 \
20                          -I/usr/include/dbus-1.0 \
21                          -I/usr/lib/dbus-1.0/include
22 INC_CAPI = $(INC_COMMON) #-I/usr/include/vconf -I/usr/include/pixman-1
23 INC_TIZEN = $(INC_COMMON) -I/usr/include/osp
24
25 UTILITY_SRCS :=                         \
26         ./helper/libdaprobe.c           \
27         ./helper/dahelper.c             \
28         ./helper/btsym.c                \
29         ./helper/dacollection.c         \
30         ./helper/dacapture.c            \
31         ./custom_chart/da_chart.c       \
32
33
34 PROBE_SRCS :=                                   \
35         ./probe_memory/libdamemalloc.c          \
36         ./probe_memory/libdamemmanage.c         \
37         ./probe_socket/libdasocket.c            \
38         ./probe_event/da_event.c                \
39         ./probe_event/keytouch.c                \
40         ./probe_event/orientation.c             \
41         ./probe_third/libdaemon.c               \
42         ./probe_thread/libdathread.c            \
43         ./probe_thread/libdasync.c              \
44         ./probe_userfunc/libdauserfunc.c        \
45         ./probe_file/da_io_posix.c              \
46         ./probe_file/da_io_stdc.c               \
47
48
49
50 COMMON_SRCS := $(UTILITY_SRCS) $(PROBE_SRCS)
51
52 CAPI_SRCS =$(COMMON_SRCS) \
53                         ./helper/appfw-capi.c \
54                         ./helper/addr-capi.c \
55                         ./probe_capi/capi_appfw.c \
56                         ./probe_ui/capi_capture.c
57
58 TIZEN_SRCS =    $(COMMON_SRCS) \
59                         ./helper/appfw-tizen.cpp \
60                         ./helper/addr-tizen.c \
61                         ./probe_memory/libdanew.cpp \
62                         ./probe_tizenapi/tizen_file.cpp \
63                         ./probe_tizenapi/tizen_socket.cpp \
64                         ./probe_tizenapi/tizen_http.cpp \
65                         ./probe_tizenapi/tizen_thread.cpp \
66                         ./probe_tizenapi/tizen_lifecycle.cpp \
67                         ./probe_tizenapi/tizen_sync.cpp \
68                         ./probe_tizenapi/tizen_controls.cpp \
69                         ./probe_tizenapi/tizen_constructor.cpp \
70                         ./probe_event/gesture.cpp \
71                         ./probe_ui/tizen_capture.cpp \
72                         ./probe_ui/tizen_scenemanager.cpp \
73                         ./probe_ui/tizen_frameani.cpp \
74                         ./probe_ui/tizen_display.cpp \
75                         ./probe_graphics/da_gles20.cpp
76
77 DUMMY_SRCS = ./custom_chart/da_chart_dummy.c
78
79 CAPI_TARGET = da_probe_capi.so
80 TIZEN_TARGET = da_probe_tizen.so
81 DUMMY_TARGET = libdaprobe.so
82
83 COMMON_FLAGS = -D_GNU_SOURCE -fPIC -shared -Wall -funwind-tables -fomit-frame-pointer -Xlinker --no-undefined -Werror -Wextra -O2 -Wwrite-strings -Wlogical-op -Wpacked -Winline -isystem /usr/include/osp
84 CAPI_FLAGS = $(COMMON_FLAGS)
85 TIZEN_FLAGS = $(COMMON_FLAGS) -DTIZENAPP
86
87 LIBDIR_COMMON =
88 LIBDIR_CAPI = $(LIBDIR_COMMON)
89 LIBDIR_TIZEN = $(LIBDIR_COMMON) -L/usr/lib/osp
90
91 COMMON_LDFLAGS = -ldl -lpthread -lrt -lecore -levas -lecore_input -leina -lecore_x -lcapi-system-runtime-info -lcapi-appfw-application -lX11 -lXext
92 CAPI_LDFLAGS = $(COMMON_LDFLAGS)
93 TIZEN_LDFLAGS = $(COMMON_LDFLAGS) -lstdc++ -losp-uifw -losp-appfw
94 DUMMY_LDFLAGS =
95
96 all:    $(CAPI_TARGET) $(TIZEN_TARGET) $(DUMMY_TARGET)
97 capi:   $(CAPI_TARGET)
98 tizen:  $(TIZEN_TARGET)
99 dummy:  $(DUMMY_TARGET)
100
101 headers:
102         cat ./scripts/api_names.txt | awk -f ./scripts/gen_api_id_mapping_header.awk > include/api_id_mapping.h
103         cat ./scripts/api_names.txt | awk -f ./scripts/gen_api_id_mapping_header_list.awk > include/api_id_list.h
104         cat ./scripts/api_names.txt | awk -f ./scripts/gen_api_id_mapping_list.awk > include/id_list
105
106 $(CAPI_TARGET): $(CAPI_SRCS) headers
107         $(CC) $(INC_CAPI) $(CAPI_FLAGS) $(LIBDIR_CAPI) -o $@ $(CAPI_SRCS) $(CAPI_LDFLAGS)
108
109 $(TIZEN_TARGET): $(TIZEN_SRCS) headers
110         $(CC) $(INC_TIZEN) $(TIZEN_FLAGS) $(LIBDIR_TIZEN) -o $@ $(TIZEN_SRCS) $(TIZEN_LDFLAGS)
111
112 $(DUMMY_TARGET): $(DUMMY_SRCS) headers
113         $(CC) $(INC_TIZEN) $(COMMON_FLAGS) -o $@ $(DUMMY_SRCS) $(DUMMY_LDFLAGS)
114
115 install:
116         [ -d "$(DESTDIR)/$(INSTALLDIR)" ] || mkdir -p $(DESTDIR)/$(INSTALLDIR)
117         install $(TIZEN_TARGET) $(DUMMY_TARGET) $(DESTDIR)/$(INSTALLDIR)/
118         install -m 644 include/id_list $(DESTDIR)/$(INSTALLDIR)/da_api_map
119
120 clean:
121         rm -f *.so *.o