.PHONY: all clean

ifndef PRODUCT
$(error PRODUCT is not defined!)
endif

ifndef PRODUCT_VERSION
$(error PRODUCT_VERSION is not defined!)
endif

ifndef build_install_directory
$(warning build_install_directory is not defined - will use ../ROOT directory!)
build_install_directory := ../ROOT
endif

preinstall:
	@echo "Installing $(PRODUCT) specific filesystem to ${instdir}"
	make -C ../ls5
	if [ -d preinst ]; then \
		cd preinst && tar -X ../.exclude -cf - * | tar -C ${build_install_directory} -vx; \
	else \
		echo "No preinst directory for $(PRODUCT)"; \
	fi;

postinstall:
	@echo "Doing postinstall of $(PRODUCT) specific files to ${instdir}"
	if [ -d postinst ]; then \
		cd postinst && tar -X ../.exclude -cf - * | tar -C ${build_install_directory} -vx; \
	else \
		echo "No postinst directory for $(PRODUCT)"; \
	fi;

clean:
	find -name "*~" -exec rm {} \;
