Tizen 2.0 Release
[profile/ivi/osmesa.git] / src / egl / main / Makefile
1 # src/egl/main/Makefile
2
3 TOP = ../../..
4 include $(TOP)/configs/current
5
6
7 EGL_MAJOR = 1
8 EGL_MINOR = 0
9
10 INCLUDE_DIRS = -I$(TOP)/include
11
12 HEADERS = \
13         eglcompiler.h \
14         eglconfig.h \
15         eglcontext.h \
16         eglcurrent.h \
17         egldefines.h \
18         egldisplay.h \
19         egldriver.h \
20         eglglobals.h \
21         eglimage.h \
22         egllog.h \
23         eglmisc.h \
24         eglmode.h \
25         eglmutex.h \
26         eglscreen.h \
27         eglstring.h \
28         eglsurface.h \
29         eglsync.h
30
31 SOURCES = \
32         eglapi.c \
33         eglarray.c \
34         eglconfig.c \
35         eglcontext.c \
36         eglcurrent.c \
37         egldisplay.c \
38         egldriver.c \
39         eglfallbacks.c \
40         eglglobals.c \
41         eglimage.c \
42         egllog.c \
43         eglmisc.c \
44         eglmode.c \
45         eglscreen.c \
46         eglstring.c \
47         eglsurface.c \
48         eglsync.c
49
50 OBJECTS = $(SOURCES:.c=.o)
51
52
53 # use dl*() to load drivers
54 LOCAL_CFLAGS = -D_EGL_OS_UNIX=1
55 LOCAL_LIBS =
56
57 # egl_dri2 and egl_glx are built-ins
58 ifeq ($(filter dri2, $(EGL_DRIVERS_DIRS)),dri2)
59 LOCAL_CFLAGS += -D_EGL_BUILT_IN_DRIVER_DRI2
60 LOCAL_LIBS += $(TOP)/src/egl/drivers/dri2/libegl_dri2.a
61 ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
62 EGL_LIB_DEPS += $(XCB_DRI2_LIBS)
63 endif
64 ifneq ($(findstring drm, $(EGL_PLATFORMS)),)
65 EGL_LIB_DEPS += -lgbm
66 endif
67 EGL_LIB_DEPS += $(LIBUDEV_LIBS) $(DLOPEN_LIBS) $(LIBDRM_LIB) $(WAYLAND_LIBS)
68 endif
69
70
71 ifneq ($(findstring wayland, $(EGL_PLATFORMS)),)
72 LOCAL_LIBS += $(TOP)/src/egl/wayland/wayland-drm/libwayland-drm.a
73 endif
74
75 ifeq ($(filter glx, $(EGL_DRIVERS_DIRS)),glx)
76 LOCAL_CFLAGS += -D_EGL_BUILT_IN_DRIVER_GLX
77 LOCAL_LIBS += $(TOP)/src/egl/drivers/glx/libegl_glx.a
78 EGL_LIB_DEPS += $(X11_LIBS) $(DLOPEN_LIBS)
79 endif
80
81 # translate --with-egl-platforms to _EGLPlatformType
82 EGL_NATIVE_PLATFORM=_EGL_INVALID_PLATFORM
83 ifeq ($(firstword $(EGL_PLATFORMS)),x11)
84 EGL_NATIVE_PLATFORM=_EGL_PLATFORM_X11
85 endif
86 ifeq ($(firstword $(EGL_PLATFORMS)),wayland)
87 EGL_NATIVE_PLATFORM=_EGL_PLATFORM_WAYLAND
88 endif
89 ifeq ($(firstword $(EGL_PLATFORMS)),drm)
90 EGL_NATIVE_PLATFORM=_EGL_PLATFORM_DRM
91 endif
92 ifeq ($(firstword $(EGL_PLATFORMS)),fbdev)
93 EGL_NATIVE_PLATFORM=_EGL_PLATFORM_FBDEV
94 endif
95
96 LOCAL_CFLAGS += \
97         -D_EGL_NATIVE_PLATFORM=$(EGL_NATIVE_PLATFORM) \
98         -D_EGL_DRIVER_SEARCH_DIR=\"$(EGL_DRIVER_INSTALL_DIR)\"
99
100 .c.o:
101         $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $(LOCAL_CFLAGS) $< -o $@
102
103
104
105 default: depend library
106
107
108 # EGL Library
109 library: $(TOP)/$(LIB_DIR)/$(EGL_LIB_NAME)
110
111 $(TOP)/$(LIB_DIR)/$(EGL_LIB_NAME): $(OBJECTS) $(LOCAL_LIBS)
112         $(MKLIB) -o $(EGL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
113                 -major $(EGL_MAJOR) -minor $(EGL_MINOR) \
114                 -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
115                 -L$(TOP)/$(LIB_DIR) $(EGL_LIB_DEPS) \
116                 $(OBJECTS) $(LOCAL_LIBS)
117
118 install-headers:
119         $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/KHR
120         $(INSTALL) -m 644 $(TOP)/include/KHR/*.h \
121                 $(DESTDIR)$(INSTALL_INC_DIR)/KHR
122         $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/EGL
123         $(INSTALL) -m 644 $(TOP)/include/EGL/*.h \
124                 $(DESTDIR)$(INSTALL_INC_DIR)/EGL
125
126 PKG_CONFIG_DIR = $(INSTALL_LIB_DIR)/pkgconfig
127
128 gl_pcedit = sed \
129         -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
130         -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
131         -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
132         -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \
133         -e 's,@EGL_PC_REQ_PRIV@,$(EGL_PC_REQ_PRIV),' \
134         -e 's,@EGL_PC_LIB_PRIV@,$(EGL_PC_LIB_PRIV),' \
135         -e 's,@EGL_PC_CFLAGS@,$(EGL_PC_CFLAGS),' \
136         -e 's,@EGL_LIB@,$(EGL_LIB),'
137
138 egl.pc: egl.pc.in
139         $(gl_pcedit) $< > $@
140
141 #install: default install-headers egl.pc
142 #       $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
143 #       $(MINSTALL) $(TOP)/$(LIB_DIR)/$(EGL_LIB_GLOB) \
144 #               $(DESTDIR)$(INSTALL_LIB_DIR)
145 #       $(INSTALL) -d $(DESTDIR)$(PKG_CONFIG_DIR)
146 #       $(INSTALL) -m 644 egl.pc $(DESTDIR)$(PKG_CONFIG_DIR)
147 install: default install-headers egl.pc
148         mkdir -p $(DESTDIR)$(INSTALL_LIB_DIR); \
149         cp $(TOP)/$(LIB_DIR)/libEGL.so.1.0 $(DESTDIR)$(INSTALL_LIB_DIR);\
150         cd $(DESTDIR)$(INSTALL_LIB_DIR); \
151         ln -s libEGL.so.1.0 libEGL.so.1;
152         $(INSTALL) -d $(DESTDIR)$(PKG_CONFIG_DIR) 
153         $(INSTALL) -m 644 egl.pc $(DESTDIR)$(PKG_CONFIG_DIR)
154
155 clean:
156         -rm -f *.o
157         -rm -f depend depend.bak
158
159
160 depend: $(SOURCES) $(HEADERS)
161         @ echo "running $(MKDEP)"
162         @ rm -f depend
163         @ touch depend
164         $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) \
165                 $(SOURCES) $(HEADERS) > /dev/null 2>/dev/null
166
167
168 -include depend
169 # DO NOT DELETE