# Shave and a Haircut # (c) 2019 Epic Games # US Patent 6720962 #################################################################### # # Maya/V-Ray Version & Location # #################################################################### ifndef MAYA_LOCATION $(error "MAYA_LOCATION is not defined") endif ifeq ($(wildcard $(MAYA_LOCATION)),) $(error "MAYA_LOCATION contains '$(MAYA_LOCATION)', which does not exist.") endif ifndef SHAVE_VRAY_SDKS $(error "SHAVE_VRAY_SDKS is not defined") endif ifndef VRAY_VERSION $(error "VRAY_VERSION is not defined") endif # We use two-digit tags to identify build products which serve a range # of V-Ray versions. # vrayTag := $(shell ../vrayPlug/getVersionTag.sh $(VRAY_VERSION)) ifeq ($(vrayTag),) $(error "Unrecognized V-Ray version '$(VRAY_VERSION)'.") endif versionInfo := $(shell ../utils/getMayaAPIVersion.sh) mayaAPI := $(word 1,$(versionInfo)) mayaVersion := $(word 2,$(versionInfo)) mayaMajorVersion := $(word 3, $(versionInfo)) mayaMinorVersion := $(word 4, $(versionInfo)) mayaDirVersion := $(word 6, $(versionInfo)) bits := 64 #################################################################### # # Linux Version # #################################################################### osVersion := $(shell ../utils/getos.sh) ifeq ($(osVersion),) $(error "Operating system type not recognized. Is /etc/issue present?") endif arch := $(shell ../utils/getarch.sh) #################################################################### # # Compiler & Linker # #################################################################### # # Some versions of Maya use non-standard versions of gcc, which are # expected to be installed in /opt (e.g. /opt/gcc322) # CFLAGS = -pipe -D_BOOL -DUNIX -DLINUX -DFUNCPROTO -D_GNU_SOURCE \ -DREQUIRE_IOSTREAM -Wall -Wall \ -Wno-deprecated -fno-gnu-keywords C++ = $(shell ../utils/getg++vray.sh $(mayaVersion) $(vrayTag)) ifeq ($(C++),) $(error "Maya version $(mayaVersion) not supported.") endif CFLAGS += -fPIC -DBits64_ -DLINUX_64 -march=athlon64 -m64 -fpermissive \ -Dnullptr=0 ifdef debug _DEBUG=1 endif ifdef DEBUG _DEBUG=1 endif ifdef _DEBUG # It's tempting to add -gstabs+ here to get more C++ specific info, but # that confuses gdb with the result that it gives 'Cannot access memory' # errors when you try to print local vars or member vars. CFLAGS += -D_DEBUG -O0 -g -ggdb -fno-inline else CFLAGS += -O3 endif ifdef _INSECURE CFLAGS += -D_INSECURE endif ifdef _BETA CFLAGS += -D_BETA endif ifdef SHAVE_PROFILE profile = 1 endif ifdef profile CFLAGS += -g endif C++FLAGS = $(CFLAGS) $(WARNFLAGS) ifeq ($(vrayTag),40) CFLAGS += -std=c++11 else ifeq ($(shell echo '$(mayaAPI) >= 20180000' | bc),1) C++FLAGS += -std=c++0x endif endif INCLUDES = -I. -isystem $(MAYA_LOCATION)/include -isystem /usr/X11R6/include LD = $(C++) -shared $(C++FLAGS) LIBS = -L$(MAYA_LOCATION)/lib -L/usr/X11R6/lib -lOpenMaya -lOpenMayaFX -lOpenMayaRender -lOpenMayaUI -lOpenMayaAnim -lFoundation -lGLU -lGL -lpthread ####################### Vray stuff ################################# # vlad |23Apr2010 # INCLUDES += -I$(SHAVE_VRAY_SDKS)/$(VRAY_VERSION)/include VRAY_LIBS := $(firstword $(wildcard ../vrayPlug/libs/vray$(vrayTag)/linux_x64/*)) LIBS += -L$(SHAVE_VRAY_SDKS)/$(VRAY_VERSION)/lib/linux -l plugman_s -lvutils_s #################################################################### #################################################################### # # Specific Build Rules # #################################################################### OBJFILE := shaveVray$(vrayTag)Exporter.o TARGET := vray/libShaveVray$(vrayTag)Exporter.so all: $(TARGET) $(TARGET): $(OBJFILE) -rm -f $@ $(LD) -o $@ $(OBJFILE) \ -Wl,-Bsymbolic -Wl,--allow-shlib-undefined \ $(LIBS) $(OBJFILE): shaveVrayExporterImpl.cpp $(C++) -c $(INCLUDES) $(C++FLAGS) -o $(OBJFILE) $< #################################################################### # # Cleanup # #################################################################### clean: -rm -f *.o Clean: -rm -f *.o *.so *.bak