SOURCE=updatedd-2.6
TARGET=arm-linux
#TARGET=mipsel-linux-uclibc

.PHONY: all clean distclean openSource install
all: openSource
clean:
	make -C $(SOURCE) clean

distclean:
	make -C $(SOURCE) distclean
	rm -f $(SOURCE)/.configured

openSource: $(SOURCE)/.configured
	make CC=$(TARGET)-gcc -C $(SOURCE)

$(SOURCE)/.configured:
	cd $(SOURCE) \
		&& ./configure \
			--host=$(TARGET) \
			CFLAGS='-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64'
	touch $(SOURCE)/.configured

install: $(SOURCE)/.configured
	#make -C $(SOURCE) install-strip
	install -d -m 755 $(prefix)/usr/sbin
	$(TARGET)-strip updatedd/src/updatedd
	cp updatedd/src/updatedd $(prefix)/usr/sbin
	install -d m 755 $(prefix)/usr/local/lib/updatedd
	$(TARGET)-strip updatedd/src/plugins/.libs/*.so.0.0.0
	cp updatedd/src/plugins/.libs/libeurodyndns.la $(prefix)/usr/local/lib/updatedd/
	cp updatedd/src/plugins/.libs/libnoip.la $(prefix)/usr/local/lib/updatedd/
	cp updatedd/src/plugins/.libs/libovh.la $(prefix)/usr/local/lib/updatedd/
	cp updatedd/src/plugins/.libs/libregfish.la $(prefix)/usr/local/lib/updatedd/
	cp -a updatedd/src/plugins/.libs/libeurodyndns.so* $(prefix)/usr/local/lib/updatedd/
	cp -a updatedd/src/plugins/.libs/libnoip.so* $(prefix)/usr/local/lib/updatedd/
	cp -a updatedd/src/plugins/.libs/libovh.so* $(prefix)/usr/local/lib/updatedd/
	cp -a updatedd/src/plugins/.libs/libregfish.so* $(prefix)/usr/local/lib/updatedd/

