# Name of the Tool DSO
TARGETS  = TemplateTool.so

# Name of the Tool icon
ICONNAME = TemplateTool.icon

# Compilation flags
CCFLAGS  = +w -g -woff 3262 -DIRIX5_0  -DFUNCPROTO -DBIT_8 -no_prelink
DSOFLAGS = -shared -all
INCLUDE  = -I$(EDDIE3DIR)/dkit/3.5/include -I/usr/include -I/usr/include/CC
LIBS     = -L$(EDDIE3DIR)/dkit/3.5/lib -leddiedkit -lvk -lXm -lXt -lX11 -lm -lgl

.ORDER :  $(TARGETS) icon

default : $(TARGETS) icon

icon : $(EDDIE3DIR)/icons/$(ICONNAME)

depend :
	@touch depend_info
	@makedepend -o.so $(INCLUDE) -fdepend_info -DGENERICH *.C
	@cut -f1 -d: depend_info | sort -u | grep -v \# | sed s/\^/ohs\:\ /g > depend_info.tmp
	@cat depend_info.tmp >> depend_info
	@rm depend_info.tmp

clean :
	-@rm -f core so_locations $(TARGETS) $(TARGETS:.so=.o)
	-@rm -rf ii_files ILDUMPS

# The DSO's dependencies
TemplateTool.so: TemplateTool.o

ohs :
	echo $(MAKE)

.SUFFIXES : .C .o .so

.C.o:
	@echo "--- Compiling C++ : $(.TARGET)"
	@CC $(CCFLAGS) $(INCLUDE) -c $(.ALLSRC)

# Make sure permissions are appropriate for writing into the
# $($EDDIE3DIR)/plugins directory 
.o.so:
	@echo "--- Building DSO : $(.TARGET)"
	@CC -check_registry so_locations $(CCFLAGS) $(DSOFLAGS) -o $(.TARGET) $(.ALLSRC) $(LIBS)
	@echo "--- Copying DSO : $(.TARGET) to $(EDDIE3DIR)/plugins"
	@cp $(.TARGET) $(EDDIE3DIR)/plugins

# Make sure permissions are appropriate for writing into the
# $($EDDIE3DIR)/icons directory 
$(EDDIE3DIR)/icons/$(ICONNAME): ./$(ICONNAME)
	@echo "--- Copying $(ICONNAME) to $(.TARGET)"
	-@/bin/rm -f $(.TARGET)
	-@/bin/cp  ./$(ICONNAME) $(.TARGET)
	-@chmod g+rw $(EDDIE3DIR)/icons/$(ICONNAME)
