c710631688cbcadd549beb220315ec73b8d73bf7
[profile/ivi/mesa.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 EGL_LIB_DEPS += $(XCB_DRI2_LIBS) $(LIBUDEV_LIBS) $(DLOPEN_LIBS) $(LIBDRM_LIB)
62 endif
63 ifeq ($(filter glx, $(EGL_DRIVERS_DIRS)),glx)
64 LOCAL_CFLAGS += -D_EGL_BUILT_IN_DRIVER_GLX
65 LOCAL_LIBS += $(TOP)/src/egl/drivers/glx/libegl_glx.a
66 EGL_LIB_DEPS += $(X11_LIBS) $(DLOPEN_LIBS)
67 endif
68
69 # translate --with-egl-platforms to _EGLPlatformType
70 EGL_NATIVE_PLATFORM=_EGL_INVALID_PLATFORM
71 ifeq ($(firstword $(EGL_PLATFORMS)),x11)
72 EGL_NATIVE_PLATFORM=_EGL_PLATFORM_X11
73 endif
74 ifeq ($(firstword $(EGL_PLATFORMS)),drm)
75 EGL_NATIVE_PLATFORM=_EGL_PLATFORM_DRM
76 endif
77 ifeq ($(firstword $(EGL_PLATFORMS)),fbdev)
78 EGL_NATIVE_PLATFORM=_EGL_PLATFORM_FBDEV
79 endif
80
81 LOCAL_CFLAGS += \
82         -D_EGL_NATIVE_PLATFORM=$(EGL_NATIVE_PLATFORM) \
83         -D_EGL_DRIVER_SEARCH_DIR=\"$(EGL_DRIVER_INSTALL_DIR)\"
84
85 .c.o:
86         $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $(LOCAL_CFLAGS) $< -o $@
87
88
89
90 default: depend library
91
92
93 # EGL Library
94 library: $(TOP)/$(LIB_DIR)/$(EGL_LIB_NAME)
95
96 $(TOP)/$(LIB_DIR)/$(EGL_LIB_NAME): $(OBJECTS) $(LOCAL_LIBS)
97         $(MKLIB) -o $(EGL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
98                 -major $(EGL_MAJOR) -minor $(EGL_MINOR) \
99                 -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
100                 -L$(TOP)/$(LIB_DIR) $(EGL_LIB_DEPS) \
101                 $(OBJECTS) $(LOCAL_LIBS)
102
103 install-headers:
104         $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/KHR
105         $(INSTALL) -m 644 $(TOP)/include/KHR/*.h \
106                 $(DESTDIR)$(INSTALL_INC_DIR)/KHR
107         $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/EGL
108         $(INSTALL) -m 644 $(TOP)/include/EGL/*.h \
109                 $(DESTDIR)$(INSTALL_INC_DIR)/EGL
110
111 PKG_CONFIG_DIR = $(INSTALL_LIB_DIR)/pkgconfig
112
113 gl_pcedit = sed \
114         -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
115         -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
116         -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
117         -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \
118         -e 's,@EGL_PC_REQ_PRIV@,$(EGL_PC_REQ_PRIV),' \
119         -e 's,@EGL_PC_LIB_PRIV@,$(EGL_PC_LIB_PRIV),' \
120         -e 's,@EGL_PC_CFLAGS@,$(EGL_PC_CFLAGS),' \
121         -e 's,@EGL_LIB@,$(EGL_LIB),'
122
123 egl.pc: egl.pc.in
124         $(gl_pcedit) $< > $@
125
126 install: default install-headers egl.pc
127         $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
128         $(MINSTALL) $(TOP)/$(LIB_DIR)/$(EGL_LIB_GLOB) \
129                 $(DESTDIR)$(INSTALL_LIB_DIR)
130         $(INSTALL) -d $(DESTDIR)$(PKG_CONFIG_DIR)
131         $(INSTALL) -m 644 egl.pc $(DESTDIR)$(PKG_CONFIG_DIR)
132
133 clean:
134         -rm -f *.o
135         -rm -f depend depend.bak
136
137
138 depend: $(SOURCES) $(HEADERS)
139         @ echo "running $(MKDEP)"
140         @ rm -f depend
141         @ touch depend
142         $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) \
143                 $(SOURCES) $(HEADERS) > /dev/null 2>/dev/null
144
145
146 -include depend
147 # DO NOT DELETE