summaryrefslogtreecommitdiffstats
path: root/src/mapi/shared-glapi/Makefile
blob: b89c458f501ee344aef42472791a383d0ecdd6f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# src/mapi/shared-glapi/Makefile
#
# Used by OpenGL ES
#

TOP := ../../..
include $(TOP)/configs/current

GLAPI := $(TOP)/src/mapi/glapi
MAPI := $(TOP)/src/mapi/mapi

glapi_CPPFLAGS := \
	-I$(TOP)/include \
	-I$(TOP)/src/mapi \
	-DMAPI_MODE_GLAPI \
	-DMAPI_ABI_HEADER=\"shared-glapi/glapi_mapi_tmp.h\"

include $(MAPI)/sources.mak
glapi_SOURCES := $(addprefix $(MAPI)/, $(MAPI_GLAPI_SOURCES))
glapi_OBJECTS := $(MAPI_GLAPI_SOURCES:.c=.o)

.PHONY: default
default: depend $(TOP)/$(LIB_DIR)/$(GLAPI_LIB_NAME)

$(TOP)/$(LIB_DIR)/$(GLAPI_LIB_NAME): $(glapi_OBJECTS)
	$(MKLIB) -o $(GLAPI_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
		-major 0 -minor 0 -patch 0 \
		-id $(INSTALL_LIB_DIR)/lib$(GLAPI_LIB).0.dylib \
		$(MKLIB_OPTIONS) -install $(TOP)/$(LIB_DIR) \
		$(glapi_OBJECTS) $(GLAPI_LIB_DEPS)

$(glapi_OBJECTS): %.o: $(MAPI)/%.c
	$(CC) -c $(glapi_CPPFLAGS) $(CFLAGS) $< -o $@

$(glapi_SOURCES): glapi_mapi_tmp.h

.PHONY: glapi_mapi_tmp.h
glapi_mapi_tmp.h:
	@$(MAKE) -C $(GLAPI)/gen-es shared-glapi

.PHONY: clean
clean:
	-rm -f $(TOP)/$(LIB_DIR)/$(GLAPI_LIB_NAME)
	-rm -f $(glapi_OBJECTS)
	-rm -f depend depend.bak
	@# clean generated sources/headers
	@$(MAKE) -C $(GLAPI)/gen-es clean-shared-glapi

install:
	$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
	$(MINSTALL) $(TOP)/$(LIB_DIR)/$(GLAPI_LIB_GLOB) \
		$(DESTDIR)$(INSTALL_LIB_DIR)

depend: $(glapi_SOURCES)
	@echo "running $(MKDEP)"
	@touch depend
	@$(MKDEP) $(MKDEP_OPTIONS) -f- $(DEFINES) $(glapi_CPPFLAGS) \
		$(glapi_SOURCES) 2>/dev/null | sed -e 's,^$(MAPI)/,,' \
		> depend

-include depend