Merge remote branch 'origin/master' into pipe-video
[mesa.git] / src / mapi / es1api / Makefile
1 # src/mapi/es1api/Makefile
2
3 TOP := ../../..
4 include $(TOP)/configs/current
5
6 # this Makefile can build both OpenGL ES 1.1 and 2.0
7 ifeq ($(ES),)
8 ES := es1
9
10 esapi_HEADER := GLES
11 esapi_PC := glesv1_cm.pc
12
13 esapi_LIB := $(GLESv1_CM_LIB)
14 esapi_LIB_NAME := $(GLESv1_CM_LIB_NAME)
15 esapi_LIB_GLOB := $(GLESv1_CM_LIB_GLOB)
16 esapi_LIB_DEPS := $(GLESv1_CM_LIB_DEPS)
17 esapi_LIB_MAJOR := 1
18 esapi_LIB_MINOR := 1
19 esapi_LIB_PATCH := 0
20 else
21 esapi_HEADER := GLES2
22 esapi_PC := glesv2.pc
23
24 esapi_LIB := $(GLESv2_LIB)
25 esapi_LIB_NAME := $(GLESv2_LIB_NAME)
26 esapi_LIB_GLOB := $(GLESv2_LIB_GLOB)
27 esapi_LIB_DEPS := $(GLESv2_LIB_DEPS)
28 esapi_LIB_MAJOR := 2
29 esapi_LIB_MINOR := 0
30 esapi_LIB_PATCH := 0
31 endif
32
33 ESAPI = $(ES)api
34
35 GLAPI := $(TOP)/src/mapi/glapi
36 MAPI := $(TOP)/src/mapi/mapi
37 # directory for generated sources/headers
38 GEN := glapi
39
40 esapi_CPPFLAGS := \
41 -I$(TOP)/include \
42 -I$(TOP)/src/mapi \
43 -DMAPI_ABI_HEADER=\"$(ESAPI)/glapi_mapi_tmp.h\"
44
45 include $(MAPI)/sources.mak
46 esapi_SOURCES := $(addprefix $(MAPI)/, $(MAPI_BRIDGE_SOURCES))
47 esapi_OBJECTS := $(MAPI_BRIDGE_SOURCES:.c=.o)
48 esapi_CPPFLAGS += -DMAPI_MODE_BRIDGE
49
50 esapi_LIB_DEPS := -L$(TOP)/$(LIB_DIR) -l$(GLAPI_LIB) $(esapi_LIB_DEPS)
51
52 .PHONY: default
53 default: depend $(TOP)/$(LIB_DIR)/$(esapi_LIB_NAME)
54
55 $(TOP)/$(LIB_DIR)/$(esapi_LIB_NAME): $(esapi_OBJECTS)
56 $(MKLIB) -o $(esapi_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
57 -major $(esapi_LIB_MAJOR) \
58 -minor $(esapi_LIB_MINOR) \
59 -patch $(esapi_LIB_PATCH) \
60 -id $(INSTALL_LIB_DIR)/lib$(esapi_LIB).$(esapi_LIB_MAJOR).dylib \
61 $(MKLIB_OPTIONS) -install $(TOP)/$(LIB_DIR) \
62 $(esapi_OBJECTS) $(esapi_LIB_DEPS)
63
64 # not used, but kept for completeness
65 lib$(ESAPI).a: $(esapi_OBJECTS)
66 @$(MKLIB) -o $(ESAPI) -static $(esapi_OBJECTS)
67
68 $(esapi_OBJECTS): %.o: $(MAPI)/%.c
69 $(CC) -c $(esapi_CPPFLAGS) $(CFLAGS) $< -o $@
70
71 $(esapi_SOURCES): | glapi-stamp
72
73 .PHONY: glapi-stamp
74 glapi-stamp:
75 @# generate sources/headers
76 @$(MAKE) -C $(GLAPI)/gen-es $(ES)
77 @touch $@
78
79 .PHONY: clean
80 clean:
81 -rm -f $(esapi_PC)
82 -rm -f $(TOP)/$(LIB_DIR)/$(esapi_LIB_NAME)
83 -rm -f lib$(ESAPI).a
84 -rm -f $(esapi_OBJECTS)
85 -rm -f depend depend.bak
86 -rm -f glapi-stamp
87 @# clean generated sources/headers
88 @$(MAKE) -C $(GLAPI)/gen-es clean-$(ES)
89
90 pcedit = \
91 -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
92 -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
93 -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
94 -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \
95
96 pcedit-es1 = \
97 $(pcedit) \
98 -e 's,@GLESv1_CM_PC_REQ_PRIV@,$(GLESv1_CM_PC_REQ_PRIV),' \
99 -e 's,@GLESv1_CM_PC_LIB_PRIV@,$(GLESv1_CM_PC_LIB_PRIV),' \
100 -e 's,@GLESv1_CM_PC_CFLAGS@,$(GLESv1_CM_PC_CFLAGS),' \
101 -e 's,@GLESv1_CM_LIB@,$(GLESv1_CM_LIB),'
102
103 pcedit-es2 = \
104 $(pcedit) \
105 -e 's,@GLESv2_PC_REQ_PRIV@,$(GLESv2_PC_REQ_PRIV),' \
106 -e 's,@GLESv2_PC_LIB_PRIV@,$(GLESv2_PC_LIB_PRIV),' \
107 -e 's,@GLESv2_PC_CFLAGS@,$(GLESv2_PC_CFLAGS),' \
108 -e 's,@GLESv2_LIB@,$(GLESv2_LIB),'
109
110 $(esapi_PC): $(esapi_PC).in
111 @sed $(pcedit-$(ES)) $< > $@
112
113 install-headers:
114 $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/$(esapi_HEADER)
115 $(INSTALL) -m 644 $(TOP)/include/$(esapi_HEADER)/*.h \
116 $(DESTDIR)$(INSTALL_INC_DIR)/$(esapi_HEADER)
117
118 install-pc: $(esapi_PC)
119 $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
120 $(INSTALL) -m 644 $(esapi_PC) $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
121
122 install: default install-headers install-pc
123 $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
124 $(MINSTALL) $(TOP)/$(LIB_DIR)/$(esapi_LIB_GLOB) \
125 $(DESTDIR)$(INSTALL_LIB_DIR)
126
127 depend: $(esapi_SOURCES)
128 @echo "running $(MKDEP)"
129 @touch depend
130 @$(MKDEP) $(MKDEP_OPTIONS) -f- $(DEFINES) $(esapi_CPPFLAGS) \
131 $(esapi_SOURCES) 2>/dev/null | \
132 sed -e 's,^$(GLAPI)/,,' -e 's,^$(MAPI)/,,' > depend
133
134 -include depend