SRC=ortp-0.9.1

TARGETS = $(SRC)/src/libs/libortp.*

.PHONY: all clean distclean install dist_install
all: install 
clean:
	make -C $(SRC) clean
	rm -f $(SRC)/.configured

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

$(SRC)/.configured:
	cd $(SRC) \
		&& INSTALL='/usr/bin/install -p' LDFLAGS='-s' CFLAGS='-Os' ./configure \
                        --prefix=$(PREFIX) \
                        --target=$(TARGETS_TYPE) \
                        --host=$(HOST_TYPE) \
                        --build=$(BUILD_TYPE) \
			--disable-ipv6 \
			--disable-mode64bit \
			--disable-debug \
			--disable-ewarning \
			--disable-shared \
			--enable-static \
		&& sed -re 's/ docs//' -i Makefile \
		&& sed -re 's/^#define HAVE_SYS_UIO_H.*//' -i ortp-config.h
	touch $(SRC)/.configured

$(TARGETS): $(SRC)/.configured
	$(MAKE) -C $(SRC)

install: $(TARGETS)
	$(MAKE) -C $(SRC) install-strip
	
dist_install: $(TARGETS)
	$(MAKE) -C $(SRC) install-strip
