SRC = ez-ipupdate-3.0.11b7
TARGETS = build/src/ez-ipupdate

.PHONY: all clean distclean install dist_install
all: install
clean:
	rm -f build/.configured
	make -C build clean

distclean:
	make -C build distclean
	rm -f build/.configured

build/.configured:
	mkdir -p build && cd $(SRC) && aclocal && autoconf && automake -a && \
	cd ../build && LDFLAGS='-s' CFLAGS='-Os' ../$(SRC)/configure \
                        --prefix=$(PREFIX) \
                        --target=$(TARGET_TYPE) \
                        --host=$(HOST_TYPE) \
                        --build=$(BUILD_TYPE) \
			--disable-nls
	touch build/.configured

USR_SBIN := $(SHADOW-DIR)/usr/sbin

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

install: $(TARGETS)
	$(INSTALL) -d $(USR_SBIN)
	$(INSTALL) build/ez-ipupdate $(USR_SBIN)

dist_install: $(TARGETS)
	$(INSTALL) -d $(PREFIX)/usr/bin
	$(INSTALL) build/ez-ipupdate $(PREFIX)/usr/bin
