summaryrefslogtreecommitdiffstats
path: root/src/mapi/vgapi/Makefile
blob: f2d3eb12a413ced64b858356a06155cbc4104905 (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
# src/mapi/vgapi/Makefile

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

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

include $(MAPI)/sources.mak
VGAPI_SOURCES := $(addprefix $(MAPI)/, $(MAPI_SOURCES))
VGAPI_OBJECTS := $(MAPI_SOURCES:.c=.o)

VGAPI_CPPFLAGS := -DMAPI_ABI_HEADER=\"vgapi/vgapi_tmp.h\"

GENERATED_SOURCES := vgapi_tmp.h

INCLUDE_DIRS := \
	-I$(TOP)/include \
	-I$(TOP)/src/mapi

.PHONY: default
default: depend libvgapi.a

libvgapi.a: $(VGAPI_OBJECTS)
	@$(MKLIB) -o vgapi -static $(VGAPI_OBJECTS)

$(VGAPI_SOURCES): | $(GENERATED_SOURCES)

$(VGAPI_OBJECTS): %.o: $(MAPI)/%.c
	$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $(VGAPI_CPPFLAGS) $< -o $@

vgapi_tmp.h: vgapi.csv $(MAPI)/mapi_abi.py
	$(PYTHON2) $(PYTHON_FLAGS) $(MAPI)/mapi_abi.py \
		-i vgapi/vgapi_defines.h $< > $@

.PHONY: clean
clean:
	-rm -f libvgapi.a
	-rm -f $(VGAPI_OBJECTS)
	-rm -f depend depend.bak
	-rm -f $(GENERATED_SOURCES)

# nothing to install
install:

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