1# This makefile template is used to build libXvMC*.so
2
3LIBNAME = lib$(LIBBASENAME).so
4XVMC_LIB_GLOB=lib$(LIBBASENAME).*so*
5XVMC_MAJOR = 1
6XVMC_MINOR = 0
7INCLUDES = -I$(TOP)/src/gallium/include \
8	   -I$(TOP)/src/gallium/drivers \
9	   -I$(TOP)/src/gallium/auxiliary \
10	   -I$(TOP)/src/gallium/winsys \
11	   $(DRIVER_INCLUDES)
12DEFINES = -DGALLIUM_TRACE $(DRIVER_DEFINES)
13LIBS = $(DRIVER_LIBS) -lXv -lX11-xcb -lxcb-dri2 -lm
14STATE_TRACKER_LIB = $(TOP)/src/gallium/state_trackers/xvmc/libxvmctracker.a
15
16ifeq ($(MESA_LLVM),1)
17LDFLAGS += $(LLVM_LDFLAGS)
18DRIVER_EXTRAS = $(LLVM_LIBS)
19LD=$(CXX)
20else
21  ifeq ($(LINK_WITH_CXX),1)
22    LD=$(CXX)
23  else
24    LD=$(CC)
25  endif
26endif
27
28# XXX: Hack, XvMC public funcs aren't exported if we link to libxvmctracker.a :(
29C_SOURCES += $(wildcard $(TOP)/src/gallium/state_trackers/xvmc/*.c)
30OBJECTS = $(C_SOURCES:.c=.o) \
31	  $(ASM_SOURCES:.S=.o)
32
33##### RULES #####
34
35.c.o:
36	$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
37
38.S.o:
39	$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
40
41##### TARGETS #####
42
43default: depend symlinks $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME)
44
45$(TOP)/$(LIB_DIR)/gallium/$(LIBNAME): $(OBJECTS) $(PIPE_DRIVERS) $(STATE_TRACKER_LIB) Makefile
46	$(MKLIB) -o $(LIBBASENAME) -linker '$(LD)' -ldflags '$(LDFLAGS)' \
47		-major $(XVMC_MAJOR) -minor $(XVMC_MINOR) $(MKLIB_OPTIONS) \
48		-install $(TOP)/$(LIB_DIR)/gallium \
49		$(OBJECTS) $(STATE_TRACKER_LIB) $(PIPE_DRIVERS) $(LIBS) $(DRIVER_EXTRAS)
50
51$(TOP)/$(LIB_DIR)/gallium:
52	mkdir -p $@
53
54depend: $(C_SOURCES) $(ASM_SOURCES) $(SYMLINKS)
55	rm -f depend
56	touch depend
57	$(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDES) $(C_SOURCES) \
58		$(ASM_SOURCES) 2> /dev/null
59
60# Emacs tags
61tags:
62	etags `find . -name \*.[ch]` `find ../include`
63
64# Remove .o and backup files
65clean:
66	-rm -f $(OBJECTS) *~ *.so $(SYMLINKS)
67	-rm -f depend depend.bak
68
69install: default
70	$(INSTALL) -d $(DESTDIR)$(XVMC_LIB_INSTALL_DIR)
71	$(MINSTALL) -m 755 $(TOP)/$(LIB_DIR)/gallium/$(XVMC_LIB_GLOB) $(DESTDIR)$(XVMC_LIB_INSTALL_DIR)
72
73include depend
74