include ../../config.mak

VPATH=$(SRC_PATH)/M4Systems/SceneGraph

# NOTE: -I.. is needed to include config.h
CFLAGS= $(OPTFLAGS) -Wall -I.. -I$(SRC_PATH)/include

ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
LDFLAGS+=-g
endif


#common obj
OBJS= Commands.o \
	Interpolators.o \
	NDT_dec.o \
	NDT_enc.o \
	Nodes.o \
	Proto.o \
	Route.o \
	SceneGraph.o \
	Script.o \
	Script_SpiderMonkey.o \
	sg_tools.o \
	valuator.o


ifeq ($(CONFIG_JS), no)
else
#add spiderMonkey - platform ID (XP_PC, XP_UNIX, ..) is in the global OS config file
CFLAGS+=-DM4_USE_SPIDERMONKEY $(JS_FLAGS)
endif


SRCS := $(OBJS:.o=.c) 

LIB=../../bin/gcc/temp/libm4systems_sg.a

all: $(LIB)


$(LIB): $(OBJS)
	$(AR) rc $@ $(OBJS)
	$(RANLIB) $@


%.o: %.c
	$(CC) $(CFLAGS) -c -o $@ $< 


clean: 
	rm -f *.o $(LIB)

dep: depend

depend:
	rm -f .depend	
	$(CC) -MM $(CFLAGS) $(SRCS) 1>.depend

distclean: clean
	rm -f Makefile.bak .depend



# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif
