# $FreeWRT$
#-
# This file is part of the FreeWRT project. FreeWRT is copyrighted
# material, please see the LICENCE file in the top-level directory
# or at http://www.freewrt.org/licence for details.

include $(TOPDIR)/rules.mk

PKG_NAME:=		webif
PKG_VERSION:=		0.2
PKG_RELEASE:=		3

include $(TOPDIR)/mk/package.mk

$(eval $(call PKG_template,WEBIF,webif,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))

$(WRKBUILD)/.prepared:
	mkdir -p ${WRKBUILD}
	touch $@

$(WRKBUILD)/.configured:
	touch $@

$(WRKBUILD)/.built:
	$(TARGET_CC) $(TARGET_CFLAGS) -o $(WRKBUILD)/webif-page src/webif-page.c
	$(TARGET_CC) $(TARGET_CFLAGS) -o $(WRKBUILD)/bstrip src/bstrip.c
	$(STRIP) $(WRKBUILD)/webif-page $(WRKBUILD)/bstrip
	touch $@

$(IPKG_WEBIF):
	cd files; pax -rw www usr $(IDIR_WEBIF)/
	install -d $(IDIR_WEBIF)/usr/bin
	install -m0755 $(WRKBUILD)/webif-page $(IDIR_WEBIF)/usr/bin/webif-page
	install -m0755 $(WRKBUILD)/bstrip $(IDIR_WEBIF)/usr/bin/bstrip
	ln -sf /www/index.html $(IDIR_WEBIF)/www/index.asp
	install -d $(IDIR_WEBIF)/etc/init.d
	install -m0755 ./files/httpd.init $(IDIR_WEBIF)/etc/init.d/S50httpd
	find $(IDIR_WEBIF) -name CVS -o -name .svn | xargs rm -rf
	$(IPKG_BUILD) $(IDIR_WEBIF) $(PACKAGE_DIR)
