Tuesday, August 24, 2010

Not bloody makefiles again ?

Replacing symlinks at compile time, so that republished shadeop DSOs don't fuck with existing shaders:

Makefile :
# here's the symlink path
MY_SO = $(PRMAN_PLUGDIR)MY.so

# resolve that to what the symlink points at
_MY_SOA := $(shell readlink $(MY_SO))

# double slashes in the path will mess up my shader macro's, so remove them
_MY_SO := $(subst //,/,$(_MY_SOA))

#now we can pass that into SL file scope using the pre-processor define flag, -D
shader .... -D_MYSO=$(_MY_SO)

Eat it, Makey - in your face, ha!