1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
|
# Shave and a Haircut
# (c) 2019 Epic Games
# US Patent 6720962
include ../config-osx.mak
####################################################################
#
# OSX Version
#
####################################################################
osVersion := $(shell ../utils/getos.sh)
ifeq ($(findstring osx,$(osVersion)),)
$(error This Makefile is only for use on OSX)
endif
osVersion := $(subst osx,,$(osVersion))
osVersionMajor := $(word 1,$(subst ., ,$(osVersion)))
osVersionMinor := $(word 2,$(subst ., ,$(osVersion)))
osVersion := $(osVersionMajor).$(osVersionMinor)
####################################################################
#
# Maya Version & Location
#
####################################################################
versionInfo := $(shell ../utils/getMayaAPIVersion.sh)
mayaAPI := $(word 1,$(versionInfo))
mayaVersion := $(word 2,$(versionInfo))
mayaMajorVersion := $(word 3, $(versionInfo))
mayaMinorVersion := $(word 4, $(versionInfo))
# Maya requires OSX 10.4 or better.
ifeq ($(osVersionMajor),10)
ifeq ($(filter-out 0 1 2 3,$(osVersionMinor)),)
$(error Maya $(mayaVersion) requires OSX 10.4 or better)
endif
endif
####################################################################
#
# Compiler & Linker
#
####################################################################
mayaShared = /Users/Shared/Autodesk/maya/$(mayaVersion)
#
# From Maya 2012 onward we use Qt.
#
useQt := y
EXT = bundle
LPLUGINFLAGS = -bundle
mayaIncludeDir = $(MAYA_LOCATION)/include
apiPreInclude =
ifdef DEBUG
_DEBUG=1
endif
ifdef _DEBUG
CFLAGS += -D_DEBUG -g
LDFLAGS += -g
else
CFLAGS += -O3
endif
ifdef _INSECURE
CFLAGS += -D_INSECURE
endif
ifdef _BETA
CFLAGS += -D_BETA
endif
LDYLIBFLAGS = -dynamiclib -single_module
CFLAGS += -DCC_GNU_ -DOSMac_ -DOSMacOSX_ \
-DOSMac_MachO_ -fno-gnu-keywords -fpascal-strings $(apiPreInclude)
C++FLAGS += $(CFLAGS) $(WARNFLAGS) $(ERROR_FLAGS) \
-D_LANGUAGE_C_PLUS_PLUS -DREQUIRE_IOSTREAM
ifeq ($(shell echo '$(mayaMajorVersion) < 2017' | bc),1)
C++FLAGS += -Dnullptr=0
endif
ifndef SHAVE_RMAN_SDKS
$(error "SHAVE_RMAN_SDKS not defined.")
endif
PRMAN = $(SHAVE_RMAN_SDKS)/21.7/maya$(mayaVersion)/osx
INCLUDES = -I. -I../libexe/sample/include -I"$(mayaIncludeDir)"
####################### Vray stuff #################################
# vlad |23Apr2010
#
INCLUDES += -I../vrayPlug/include36 -I../vrayPlug/plugin
####################################################################
DYNLIB_LOCATION = $(MAYA_LOCATION)/Maya.app/Contents/MacOS
FWORKS = -framework CoreFoundation \
-framework CoreServices \
-framework System \
-framework Carbon \
-framework ApplicationServices \
-framework AGL \
-framework OpenGL \
-framework IOKit
# -framework AppKit
ifeq ($(useQt),y)
FWORKS += -framework Cocoa
endif
LREMAP = -Wl,-executable_path,"$(DYNLIB_LOCATION)"
LDFLAGS += -fno-gnu-keywords -fpascal-strings $(FWORKS) -multiply_defined suppress
LIBS = -L$(DYNLIB_LOCATION) $(LREMAP) -lFoundation -lOpenMaya \
-lOpenMayaFX -lOpenMayaRender -lOpenMayaUI \
-lOpenMayaAnim
ifeq ($(useQt),y)
# Maya uses a customized version of Qt so we have to build with the Qt headers
# provided by Maya.
#
INCLUDES += -I$(MAYA_LOCATION)/include/qt
#use distribyted with maya libs, they have weird names a bit - no 'lib' prefix and .a or .dynlib suffix
#so should be included explicitly
#
LIBS += -dead_strip -lz
ifeq ($(shell echo "${mayaVersion} < 2017" | bc),1)
LIBS += $(DYNLIB_LOCATION)/QtCore \
$(DYNLIB_LOCATION)/QtGui \
$(DYNLIB_LOCATION)/QtOpenGL
else
LIBS += $(DYNLIB_LOCATION)/libQt5Core.dylib \
$(DYNLIB_LOCATION)/libQt5Gui.dylib \
$(DYNLIB_LOCATION)/libQt5OpenGL.dylib \
$(DYNLIB_LOCATION)/libQt5Widgets.dylib
endif
# static Qt libs make MEL crashy
#
#LIBS += -dead_strip -L/qt-mac-opensource-src-4.7.1/lib -lz -lQtCore -lQtGui
endif
X86_64_CFLAGS = $(CFLAGS) -DBits64_ -arch x86_64
X86_64_C++FLAGS = $(C++FLAGS) -DBits64_ -arch x86_64
X86_64_INCLUDES = -I"$(PRMAN)/include" $(INCLUDES)
X86_64_LFLAGS = $(LDFLAGS) -DBits64_ -arch x86_64
X86_64_LIBS = $(LIBS)
X86_64_SHAVELIB = ../libexe/shaveLibAW-x86_64.a
####################################################################
#
# Generic Build Rules
#
####################################################################
.SUFFIXES: .c .cpp .o .io .po .xo
.c.o:
$(error Attempt to build $< into a .o file: should be .io or .po or .xo)
.cpp.o:
$(error Attempt to build $< into a .o file: should be .io or .po or .xo)
.cpp.xo:
$(C++) -c -o $@ $(X86_64_INCLUDES) $(X86_64_C++FLAGS) $<
####################################################################
#
# Specific Build Rules
#
####################################################################
SHAVEFILES = shaveNode.o shaveShadowNode.o shaveObjExporter.o \
shaveRenderCallback.o shaveRender.o shaveTextureStore.o \
shaveGlobals.o shaveMaya.o shaveWriteRib.o shaveBlindData.o \
shaveUtil.o shaveCheckObjectVisibility.o shaveInfo.o \
isSharedCmd.o shaveVertexShader.o shaveNodeCmd.o \
shaveRenderCmd.o shaveAPIimpl.o \
pluginImpl.o shaveXPM.o shaveIcon.o shaveIconCmd.o \
shaveBackgroundShader.o shaveVolumeShader.o shaveItHairImpl.o \
shaveMacCarbon.o \
shaveRenderer.o shaveMayaRenderer.o \
shaveSDKCALLBACKS.o shavePadCmd.o \
shaveHairShape.o shaveHairUI.o shaveCallbacks.o shaveUtilCmd.o \
shaveHairGeomIt.o shaveHairShapeAttrs.o shaveBrushCtx.o \
shaveBrushCtxCmd.o shaveBrushManip.o shaveStyleCmd.o \
shaveCursorCtx.o shaveCursorCtxCmd.o shaveCutCtx.o shaveCutCtxCmd.o \
shaveWriteHairCmd.o ShavePerVertTexInfo.o \
shaveVrayRenderer.o shaveVraySharedFunctions.o shaveVrayNode.o \
shaveVrayCmd.o shavePack2TexCmd.o shaveExportGame.o \
shaveGeometryOverride.o
ifdef _DEBUG
SHAVEFILES += shaveDebug.o
endif
X86_64_SHAVEFILES = $(SHAVEFILES:.o=.xo)
.PHONY: all
.PHONY: shaveNode-lib
all: shaveNode-lib libShave.dylib libShaveAPI.dylib
shaveNode-lib: shaveNode.$(EXT)
libShave.dylib: $(X86_64_SHAVEFILES)
-rm -f $@
$(LD) -o $@ \
-install_name @executable_path/libShave.dylib \
$(X86_64_SHAVEFILES) $(X86_64_SHAVELIB) $(X86_64_LFLAGS) \
$(LDYLIBFLAGS) $(X86_64_LIBS)
shaveNode.$(EXT): plugin.xo libShave.dylib
-rm -f $@
$(LD) -o $@ plugin.xo -L. -lShave $(X86_64_LFLAGS) \
$(LPLUGINFLAGS) $(X86_64_LIBS)
libShaveAPI.dylib: shaveAPI.xo shaveItHair.xo libShave.dylib
-rm -f $@
$(LD) -o $@ \
-install_name @executable_path/libShaveAPI.dylib \
shaveAPI.xo shaveItHair.xo -L. -lShave $(X86_64_LFLAGS) \
$(LDYLIBFLAGS) $(X86_64_LIBS)
#
# This is annoying. The linker won't accept a static lib whose
# modification date is later than when its internal table was last updated
# with 'ranlib'. So whenever we get a fresh copy of the lib from cvs, it
# gets a new date, making it invalid for linking. We can run ranlib on the
# lib, but then cvs will think it changed and get a bounce next time we
# update. So we have to copy the libs into a temp dir, run ranlib on them,
# then use from there.
#
PRMAN_LIBS=$(wildcard $(PRMAN)/lib/*.a)
PRMAN_RANLIBS=$(addprefix $(PRMAN)/lib/ranlib/,$(notdir $(PRMAN_LIBS)))
.PHONY: prman-ranlib
prman-ranlib: $(PRMAN)/lib/ranlib $(PRMAN_RANLIBS)
$(PRMAN)/lib/ranlib:
mkdir $(PRMAN)/lib/ranlib
@echo '$(PRMAN_LIBS)'
@echo '$(PRMAN_RANLIBS)'
$(PRMAN_RANLIBS): $(PRMAN)/lib/ranlib/%: $(PRMAN)/lib/%
cp $< $@
ranlib $@
depend:
makedepend $(INCLUDES) -I/usr/include/CC *.cpp
####################################################################
#
# Cleanup
#
####################################################################
.PHONY: clean
clean:
-rm -f *.io *.po *.xo
.PHONY: Clean
Clean: clean
-rm -f *.so *.bak *.$(EXT)
|