
include ../Common


#objects := $(patsubst %.cc,%.o,$(wildcard *.cc))
#objects := $(patsubst %.cpp,%.o,$(wildcard *.cpp))

headers := $(wildcard ../include/*.h)
objects := DiscreteSegCurve.o DiscreteShape.o LineSeg.o CircSeg.o \
	   SimpleShapeMaker.o SplineSmooth.o DivergenceMap.o \
           DivergenceSkeletonMaker.o
cobjects:= #spline_smooth.o
sources := $(wildcard *.cpp)

CPPFLAGS := $(CPPFLAGS) 

.PHONY: clean

all: libsg.a
include $(sources:.cpp=.d)

%.d: %.cpp
	$(CC) -MM $(CPPFLAGS) $< | sed 's/$*.o/& $@/g' > $@


libsg.a: $(objects) $(cobjects)
	@echo "Making libsg.a [" $(objects) "] ..."
	@$(RM) libsg.a
	@$(AR) cru libsg.a $(objects) $(cobjects)
	@$(RANLIB) libsg.a
	$(CP) libsg.a ../lib


aa:
	bash "for f in `ls *.h`; do echo $f; done"

test: $(tests)

clean:
	@echo "Cleaning src directory..."
	@$(RM) *.o *~ libsg.a


tidy:
	@echo "Cleaning src directory..."
	@$(MAKE) -C . clean
	@$(RM) *.cc libsg.a


$(objects): %.o: %.cpp

$(cobjects): %.o: %.c
