if test "x$LLVM_CONFIG" != xno; then
LLVM_VERSION=`$LLVM_CONFIG --version`
LLVM_CFLAGS=`$LLVM_CONFIG --cppflags|sed 's/-DNDEBUG\>//g'`
- LLVM_LIBS="`$LLVM_CONFIG --libs` -lstdc++"
+ LLVM_LIBS="`$LLVM_CONFIG --libs`"
LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
DEFINES="$DEFINES -D__STDC_CONSTANT_MACROS"
ifeq ($(MESA_LLVM),1)
LDFLAGS += $(LLVM_LDFLAGS)
DRIVER_EXTRAS = $(LLVM_LIBS)
-else
-LDFLAGS += -lstdc++
endif
MESA_MODULES = \
ifeq ($(MESA_LLVM),1)
LDFLAGS += $(LLVM_LDFLAGS)
DRIVER_EXTRAS = $(LLVM_LIBS)
+LD=$(CXX)
else
-LDFLAGS += -lstdc++
+ ifeq ($(LINK_WITH_CXX),1)
+ LD=$(CXX)
+ else
+ LD=$(CC)
+ endif
endif
# XXX: Hack, VA public funcs aren't exported
default: depend symlinks $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME)
$(TOP)/$(LIB_DIR)/gallium/$(LIBNAME): $(OBJECTS) $(PIPE_DRIVERS) $(STATE_TRACKER_LIB) $(TOP)/$(LIB_DIR)/gallium Makefile
- $(MKLIB) -o $(LIBBASENAME) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
+ $(MKLIB) -o $(LIBBASENAME) -linker '$(LD)' -ldflags '$(LDFLAGS)' \
-major $(VA_MAJOR) -minor $(VA_MINOR) $(MKLIB_OPTIONS) \
-install $(TOP)/$(LIB_DIR)/gallium \
$(OBJECTS) $(STATE_TRACKER_LIB) $(PIPE_DRIVERS) $(LIBS) $(DRIVER_EXTRAS)
ifeq ($(MESA_LLVM),1)
LDFLAGS += $(LLVM_LDFLAGS)
DRIVER_EXTRAS = $(LLVM_LIBS)
+LD=$(CXX)
else
-LDFLAGS += -lstdc++
+ ifeq ($(LINK_WITH_CXX),1)
+ LD=$(CXX)
+ else
+ LD=$(CC)
+ endif
endif
# XXX: Hack, VDPAU public funcs aren't exported if we link to libvdpautracker.a :(
default: depend symlinks $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME)
$(TOP)/$(LIB_DIR)/gallium/$(LIBNAME): $(OBJECTS) $(PIPE_DRIVERS) $(STATE_TRACKER_LIB) $(TOP)/$(LIB_DIR)/gallium Makefile
- $(MKLIB) -o $(LIBBASENAME) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
+ $(MKLIB) -o $(LIBBASENAME) -linker '$(LD)' -ldflags '$(LDFLAGS)' \
-major $(VDPAU_MAJOR) -minor $(VDPAU_MINOR) $(MKLIB_OPTIONS) \
-install $(TOP)/$(LIB_DIR)/gallium \
$(OBJECTS) $(STATE_TRACKER_LIB) $(PIPE_DRIVERS) $(LIBS) $(DRIVER_EXTRAS)
LIBNAME_STAGING = $(TOP)/$(LIB_DIR)/gallium/$(TARGET)
ifeq ($(MESA_LLVM),1)
-LD = $(CXX)
LDFLAGS += $(LLVM_LDFLAGS)
-USE_CXX=1
DRIVER_LINKS += $(LLVM_LIBS) -lm -ldl
+LD=$(CXX)
else
-LDFLAGS += -lstdc++
+ ifeq ($(LINK_WITH_CXX),1)
+ LD=$(CXX)
+ else
+ LD=$(CC)
+ endif
endif
default: depend $(TOP)/$(LIB_DIR)/gallium $(LIBNAME) $(LIBNAME_STAGING)
$(LIBNAME): $(OBJECTS) Makefile ../Makefile.xorg $(LIBS) $(DRIVER_PIPES) $(GALLIUM_AUXILIARIES)
- $(MKLIB) -linker '$(CC)' -noprefix -o $@ $(LDFLAGS) $(OBJECTS) $(DRIVER_PIPES) $(GALLIUM_AUXILIARIES) $(DRIVER_LINKS)
+ $(MKLIB) -linker '$(LD)' -noprefix -o $@ $(LDFLAGS) $(OBJECTS) $(DRIVER_PIPES) $(GALLIUM_AUXILIARIES) $(DRIVER_LINKS)
depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(SYMLINKS) $(GENERATED_SOURCES)
rm -f depend
ifeq ($(MESA_LLVM),1)
LDFLAGS += $(LLVM_LDFLAGS)
DRIVER_EXTRAS = $(LLVM_LIBS)
+LD=$(CXX)
else
-LDFLAGS += -lstdc++
+ ifeq ($(LINK_WITH_CXX),1)
+ LD=$(CXX)
+ else
+ LD=$(CC)
+ endif
endif
-
# XXX: Hack, XvMC public funcs aren't exported if we link to libxvmctracker.a :(
OBJECTS = $(C_SOURCES:.c=.o) \
$(ASM_SOURCES:.S=.o) \
default: depend symlinks $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME)
$(TOP)/$(LIB_DIR)/gallium/$(LIBNAME): $(OBJECTS) $(PIPE_DRIVERS) $(STATE_TRACKER_LIB) $(TOP)/$(LIB_DIR)/gallium Makefile
- $(MKLIB) -o $(LIBBASENAME) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
+ $(MKLIB) -o $(LIBBASENAME) -linker '$(LD)' -ldflags '$(LDFLAGS)' \
-major $(XVMC_MAJOR) -minor $(XVMC_MINOR) $(MKLIB_OPTIONS) \
-install $(TOP)/$(LIB_DIR)/gallium \
$(OBJECTS) $(STATE_TRACKER_LIB) $(PIPE_DRIVERS) $(LIBS) $(DRIVER_EXTRAS)
endif
# determine the targets/sources
-pipe_TARGETS =
+_pipe_TARGETS_CC =
+_pipe_TARGETS_CXX =
pipe_SOURCES =
ifneq ($(findstring i915/drm,$(GALLIUM_WINSYS_DIRS)),)
-pipe_TARGETS += $(PIPE_PREFIX)i915.so
+_pipe_TARGETS_CC += $(PIPE_PREFIX)i915.so
pipe_SOURCES += pipe_i915.c
endif
ifneq ($(findstring i965/drm,$(GALLIUM_WINSYS_DIRS)),)
-pipe_TARGETS += $(PIPE_PREFIX)i965.so
+_pipe_TARGETS_CC += $(PIPE_PREFIX)i965.so
pipe_SOURCES += pipe_i965.c
endif
ifneq ($(findstring nouveau/drm,$(GALLIUM_WINSYS_DIRS)),)
-LDFLAGS += -lstdc++
-pipe_TARGETS += $(PIPE_PREFIX)nouveau.so
+_pipe_TARGETS_CXX += $(PIPE_PREFIX)nouveau.so
pipe_SOURCES += pipe_nouveau.c
endif
ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
ifneq ($(findstring r300,$(GALLIUM_DRIVERS_DIRS)),)
-pipe_TARGETS += $(PIPE_PREFIX)r300.so
+_pipe_TARGETS_CC += $(PIPE_PREFIX)r300.so
pipe_SOURCES += pipe_r300.c
endif
endif
ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
ifneq ($(findstring r600,$(GALLIUM_DRIVERS_DIRS)),)
-pipe_TARGETS += $(PIPE_PREFIX)r600.so
+_pipe_TARGETS_CC += $(PIPE_PREFIX)r600.so
pipe_SOURCES += pipe_r600.c
endif
endif
ifneq ($(findstring svga/drm,$(GALLIUM_WINSYS_DIRS)),)
-pipe_TARGETS += $(PIPE_PREFIX)vmwgfx.so
+_pipe_TARGETS_CC += $(PIPE_PREFIX)vmwgfx.so
pipe_SOURCES += pipe_vmwgfx.c
endif
pipe_OBJECTS = $(pipe_SOURCES:.c=.o)
+ifeq ($(MESA_LLVM),1)
+pipe_TARGETS_CXX = $(_pipe_TARGETS_CXX) $(_pipe_TARGETS_CC)
+pipe_TARGETS_CC =
+else
+pipe_TARGETS_CXX = $(_pipe_TARGETS_CXX)
+pipe_TARGETS_CC = $(_pipe_TARGETS_CC)
+endif
-GBM_EXTRA_TARGETS = $(addprefix $(TOP)/$(LIB_DIR)/gbm/, $(pipe_TARGETS))
+GBM_EXTRA_TARGETS = $(addprefix $(TOP)/$(LIB_DIR)/gbm/, $(pipe_TARGETS_CC)) $(addprefix $(TOP)/$(LIB_DIR)/gbm/, $(pipe_TARGETS_CXX))
GBM_EXTRA_INSTALL = install-pipes
GBM_EXTRA_CLEAN = clean-pipes
GBM_EXTRA_SOURCES = $(pipe_SOURCES)
@$(INSTALL) -d $(dir $@)
$(INSTALL) $< $(dir $@)
-$(pipe_TARGETS): $(PIPE_PREFIX)%.so: pipe_%.o $(pipe_LIBS) $($*_LIBS)
+$(pipe_TARGETS_CC): $(PIPE_PREFIX)%.so: pipe_%.o $(pipe_LIBS) $($*_LIBS)
$(MKLIB) -o $@ -noprefix -linker '$(CC)' \
-ldflags '-L$(TOP)/$(LIB_DIR) $(pipe_LDFLAGS) $(LDFLAGS)' \
$(MKLIB_OPTIONS) $< \
-Wl,--start-group $(pipe_LIBS) $($*_LIBS) -Wl,--end-group \
$(pipe_SYS) $($*_SYS)
+$(pipe_TARGETS_CXX): $(PIPE_PREFIX)%.so: pipe_%.o $(pipe_LIBS) $($*_LIBS)
+ $(MKLIB) -o $@ -noprefix -linker '$(CXX)' \
+ -ldflags '-L$(TOP)/$(LIB_DIR) $(pipe_LDFLAGS) $(LDFLAGS)' \
+ $(MKLIB_OPTIONS) $< \
+ -Wl,--start-group $(pipe_LIBS) $($*_LIBS) -Wl,--end-group \
+ $(pipe_SYS) $($*_SYS)
+
$(pipe_OBJECTS): %.o: %.c
$(CC) -c -o $@ $< $(pipe_INCLUDES) $(pipe_CFLAGS) $(CFLAGS)
ifeq ($(MESA_LLVM),1)
LDFLAGS += $(LLVM_LDFLAGS)
GALLIUM_AUXILIARIES += $(LLVM_LIBS)
+LD=$(CXX)
else
-LDFLAGS += -lstdc++
+ ifeq ($(LINK_WITH_CXX),1)
+ LD=$(CXX)
+ else
+ LD=$(CC)
+ endif
endif
##### RULES #####
# Make the library
$(TOP)/$(LIB_DIR)/gallium/$(XA_LIB_NAME): depend $(OBJECTS) $(XA_LIB_DEPS)
- $(MKLIB) -o $(XA_LIB) -linker $(CC) -ldflags '$(LDFLAGS)' \
+ $(MKLIB) -o $(XA_LIB) -linker $(LD) -ldflags '$(LDFLAGS)' \
-major $(XA_MAJOR) -minor $(XA_MINOR) -patch $(XA_TINY) \
$(MKLIB_OPTIONS) \
-exports $(TOP)/src/gallium/state_trackers/xa/xa_symbols\
DRIVER_INCLUDES = \
$(shell $(PKG_CONFIG) --cflags-only-I libdrm libdrm_nouveau xf86driproto)
+LINK_WITH_CXX=1
+
include ../Makefile.xorg
DRIVER_LIBS = $(shell $(PKG_CONFIG) libdrm_nouveau --libs) -lXfixes
+LINK_WITH_CXX=1
+
include ../Makefile.xvmc
symlinks: