19f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas HellstromTOP = ../../../..
29f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrominclude $(TOP)/configs/current
39f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom
49f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom##### MACROS #####
59f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom
68a4f7d1cdc6f3c9e8a5a6f4a0928c3abdb132541Thomas HellstromXA_MAJOR = 1
78a4f7d1cdc6f3c9e8a5a6f4a0928c3abdb132541Thomas HellstromXA_MINOR = 0
89f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas HellstromXA_TINY = 0
94d04367eca66a85e26f7c0f5d6392823d13880f6Thomas HellstromXA_CFLAGS = -Wall -pedantic
109f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom
119f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas HellstromXA_INCLUDES= -I$(TOP)/src/gallium/ \
129f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	-I$(TOP)/src/gallium/auxiliary \
139f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	-I$(TOP)/src/gallium/include \
149f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	-I$(TOP)/src/gallium/winsys \
159f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	-I$(TOP)/src/gallium/drivers
169f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom
179f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas HellstromXA_LIB = xatracker
189f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas HellstromXA_LIB_NAME = lib$(XA_LIB).so
199f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas HellstromXA_LIB_GLOB = lib$(XA_LIB)*.so*
209f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas HellstromXA_LIB_DEPS = \
219f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	$(TOP)/src/gallium/state_trackers/xa/libxatracker.o \
229f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	$(TOP)/src/gallium/winsys/svga/drm/libsvgadrm.a \
239f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	$(TOP)/src/gallium/drivers/svga/libsvga.a \
249f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	$(TOP)/src/gallium/drivers/trace/libtrace.a \
259f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	$(TOP)/src/gallium/drivers/rbug/librbug.a
269f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom
279f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom
289f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas HellstromCOMMON_GALLIUM_SOURCES=
299f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom
309f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas HellstromSOURCES = vmw_target.c
319f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas HellstromOBJECTS = $(SOURCES:.c=.o)
329f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom
339f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstromifeq ($(MESA_LLVM),1)
349f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas HellstromLDFLAGS += $(LLVM_LDFLAGS)
359f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas HellstromGALLIUM_AUXILIARIES += $(LLVM_LIBS)
36757390491cfa3b861fab76940a8c6e508d1f1a25Marcin SlusarzLD=$(CXX)
379f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstromelse
38757390491cfa3b861fab76940a8c6e508d1f1a25Marcin Slusarz  ifeq ($(LINK_WITH_CXX),1)
39757390491cfa3b861fab76940a8c6e508d1f1a25Marcin Slusarz    LD=$(CXX)
40757390491cfa3b861fab76940a8c6e508d1f1a25Marcin Slusarz  else
41757390491cfa3b861fab76940a8c6e508d1f1a25Marcin Slusarz    LD=$(CC)
42757390491cfa3b861fab76940a8c6e508d1f1a25Marcin Slusarz  endif
439f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstromendif
449f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom
459f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom##### RULES #####
469f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom
479f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom.c.o:
484d04367eca66a85e26f7c0f5d6392823d13880f6Thomas Hellstrom	$(CC) -c $(XA_CFLAGS) $(CFLAGS) $(XA_INCLUDES) $<
499f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom
509f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom
519f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom##### TARGETS #####
529f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom
539f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstromdefault: $(TOP)/$(LIB_DIR)/gallium/$(XA_LIB_NAME)
549f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom
5532b1641a59610d94c0b56bf0494b2fc1cf400e3eThomas Hellstrom# Generate list of library visible symbols
5632b1641a59610d94c0b56bf0494b2fc1cf400e3eThomas Hellstromxa_symbols: $(TOP)/src/gallium/state_trackers/xa/libxatracker.o
5732b1641a59610d94c0b56bf0494b2fc1cf400e3eThomas Hellstrom	$(NM) $< | $(GREP) ' T ' | $(AWK) '{print $$3}' > $@
589f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom
599f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom# Make the library
6032b1641a59610d94c0b56bf0494b2fc1cf400e3eThomas Hellstrom$(TOP)/$(LIB_DIR)/gallium/$(XA_LIB_NAME): depend $(OBJECTS) $(XA_LIB_DEPS) \
6132b1641a59610d94c0b56bf0494b2fc1cf400e3eThomas Hellstrom	xa_symbols
62757390491cfa3b861fab76940a8c6e508d1f1a25Marcin Slusarz	$(MKLIB) -o $(XA_LIB) -linker $(LD) -ldflags '$(LDFLAGS)' \
639f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom		-major $(XA_MAJOR) -minor $(XA_MINOR) -patch $(XA_TINY) \
649f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom		$(MKLIB_OPTIONS) \
6532b1641a59610d94c0b56bf0494b2fc1cf400e3eThomas Hellstrom		-exports xa_symbols \
669f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom		 -install $(TOP)/$(LIB_DIR)/gallium \
679f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom		$(OBJECTS) $(XA_LIB_DEPS) $(GALLIUM_AUXILIARIES)
689f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom
699f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom# xa pkgconfig file
709f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrompcedit = sed \
719f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	-e 's,@INSTALL_DIR@,$(INSTALL_DIR),g' \
729f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	-e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),g' \
739f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	-e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),g' \
749f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	-e 's,@VERSION@,$(XA_MAJOR).$(XA_MINOR).$(XA_TINY),g' \
759f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	-e 's,@XA_PC_REQ_PRIV@,$(XA_PC_REQ_PRIV),g' \
769f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	-e 's,@XA_PC_LIB_PRIV@,$(XA_PC_LIB_PRIV),g' \
779f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	-e 's,@XA_PC_CFLAGS@,$(XA_PC_CFLAGS),g' \
789f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	-e 's,@XA_LIB@,$(XA_LIB),g'
799f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstromxatracker.pc: xatracker.pc.in
809f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	$(pcedit) $< > $@
819f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom
829f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrominstall: xatracker.pc
839f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)
849f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
859f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
869f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	$(INSTALL) -m 644 $(TOP)/src/gallium/state_trackers/xa/xa_tracker.h $(DESTDIR)$(INSTALL_INC_DIR)
879f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	$(INSTALL) -m 644 $(TOP)/src/gallium/state_trackers/xa/xa_context.h $(DESTDIR)$(INSTALL_INC_DIR)
88adf166b6c4f6781fd5e751622e9488e5f834bbc2Thomas Hellstrom	$(INSTALL) -m 644 $(TOP)/src/gallium/state_trackers/xa/xa_composite.h $(DESTDIR)$(INSTALL_INC_DIR)
899f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	$(MINSTALL) -m 755 $(TOP)/$(LIB_DIR)/gallium/$(XA_LIB_GLOB) $(DESTDIR)$(INSTALL_LIB_DIR)
909f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	$(INSTALL) -m 644 xatracker.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
919f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom
929f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstromclean:
939f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	-rm -f *.o *~
949f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	-rm -f *.lo
959f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	-rm -f *.la
969f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	-rm -f *.pc
979f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	-rm -rf .libs
9832b1641a59610d94c0b56bf0494b2fc1cf400e3eThomas Hellstrom	-rm -f depend depend.bak exptmp xa_symbols
999f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom
1009f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom
1019f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstromdepend: $(SOURCES)
1029f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	@ echo "running $(MKDEP)"
1039f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	@ rm -f depend
1049f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	@ touch depend
1059f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom	@ $(MKDEP) $(MKDEP_OPTIONS) -I$(TOP)/include $(XA_INCLUDES) $(SOURCES) \
1069f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom		> /dev/null
1079f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom
1089f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom-include depend
1099f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas Hellstrom
1109f2f5b3d7fd70663b98da5d302fcdfd5bc93db05Thomas HellstromFORCE:
111