scons: Fix SCons build infrastructure for FreeBSD.
[mesa.git] / src / gallium / targets / Makefile.xorg
index c2d00649789f11284760a6d1bbcc1fd3a6f3444b..481e3d6a2b732aa56c650642052e607daab76de1 100644 (file)
@@ -19,21 +19,25 @@ OBJECTS = $(C_SOURCES:.c=.o) \
        $(ASM_SOURCES:.S=.o)
 
 INCLUDES = \
-       $(shell pkg-config --cflags-only-I pixman-1 xorg-server libdrm xproto) \
+       $(shell $(PKG_CONFIG) --cflags-only-I pixman-1 xorg-server libdrm xproto) \
        -I$(TOP)/src/gallium/include \
        -I$(TOP)/src/gallium/drivers \
        -I$(TOP)/src/gallium/auxiliary \
        -I$(TOP)/src/gallium/winsys \
        $(DRIVER_INCLUDES)
 
-LIBNAME_STAGING = $(TOP)/$(LIB_DIR)/gallium/$(TARGET)
+LIBNAME_STAGING = $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME)
 
 ifeq ($(MESA_LLVM),1)
-LD = g++
 LDFLAGS += $(LLVM_LDFLAGS)
-USE_CXX=1
-DRIVER_PIPES += $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
 DRIVER_LINKS += $(LLVM_LIBS) -lm -ldl
+LD=$(CXX)
+else
+  ifeq ($(LINK_WITH_CXX),1)
+    LD=$(CXX)
+  else
+    LD=$(CC)
+  endif
 endif
 
 
@@ -41,8 +45,8 @@ endif
 
 default: depend $(TOP)/$(LIB_DIR)/gallium $(LIBNAME) $(LIBNAME_STAGING)
 
-$(LIBNAME): $(OBJECTS) Makefile ../Makefile.xorg $(LIBS) $(DRIVER_PIPES)
-       $(MKLIB) -noprefix -o $@ $(OBJECTS) $(DRIVER_PIPES) $(GALLIUM_AUXILIARIES) $(DRIVER_LINKS)
+$(LIBNAME): $(OBJECTS) Makefile ../Makefile.xorg $(LIBS) $(DRIVER_PIPES) $(GALLIUM_AUXILIARIES)
+       $(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
@@ -56,7 +60,7 @@ $(TOP)/$(LIB_DIR)/gallium:
        mkdir -p $@
 
 clean:
-       rm -f $(OBJECTS) $(GENERATED_SOURCES) $(LIBNAME).a depend depend.bak
+       rm -f $(OBJECTS) $(GENERATED_SOURCES) $(LIBNAME) depend depend.bak
 
 install:
        $(INSTALL) -d $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR)