Help fixing a feed package

HI, i am trying to create a feed for a package the i use.
My problem is that the feed requires a variable OPENSSL_PREFIX points to the crosscompiled openssl version. If i run make V=99 for the first time, the build will fail. If i rerun like
"make OPENSSL_PREFIX=/tmp/source/build_dir/target-mips_24kc_musl/openssl-1.0.2o/ V=99" it will work. So i need to know how can i get this path ( the version usually changes) from openwrt/lede build image system and set this variable in my Makefile.

This is my basic Makefile

include $(TOPDIR)/rules.mk


PKG_NAME:=perl-net-ssleay
PKG_VERSION:=1.85

PKG_SOURCE:=Net-SSLeay-1.85.tar.gz
PKG_SOURCE_URL:=https://cpan.metacpan.org/authors/id/M/MI/MIKEM/
PKG_BUILD_DIR:=$(BUILD_DIR)/Net-SSLeay-1.85
PKG_MD5SUM:=d602bdce4e0531c6efc276e3e429ca69

include $(INCLUDE_DIR)/package.mk

include $(TOPDIR)/feeds/packages/lang/perl/perlmod.mk

define Package/perl-net-ssleay
	SUBMENU:=Perl
	SECTION:=lang
	CATEGORY:=Languages
	TITLE:=Perl extension for using OpenSSL
	DEPENDS:=perl +libopenssl +zlib +perlbase-thread +perlbase-base +perlbase-net +perl-io-socket-ssl +perl-date-calc +perl-carp-clan
	URL:=http://search.cpan.org/dist/Net-SSLeay
endef

define Build/Configure
	$(call perlmod/Configure,,)
endef

define Build/Compile
	$(call perlmod/Compile,,)
endef

define Package/perl-net-ssleay/install
	$(call perlmod/Install,$(1),Net auto)
endef


$(eval $(call BuildPackage,perl-net-ssleay))