POSEMATHSRCS := $(addprefix libposemath/, _posemath.c posemath.cc gomath.c sincos.c)
$(call TOOBJSDEPS, $(POSEMATHSRCS)) : EXTRAFLAGS=-fPIC
USERSRCS += $(POSEMATHSRCS) 
TARGETS += ../lib/libposemath.so ../lib/libposemath.so.0

../lib/libposemath.so.0: $(call TOOBJS,$(POSEMATHSRCS))
	$(ECHO) Creating shared library $(notdir $@)
	@mkdir -p ../lib
	@rm -f $@
	@$(CXX) $(LDFLAGS) -Wl,-soname,$(notdir $@) -shared -o $@ $^

POSEMATHINCS = \
    ./libposemath/gomath.h \
    ./libposemath/gotypes.h \
    ./libposemath/posemath.h \
    ./libposemath/sincos.h

$(patsubst ./libposemath/%,../include/%,$(POSEMATHINCS)): ../include/%.h: ./libposemath/%.h
	cp $^ $@
