Makefile variable shared between custom packages for openwrt.

While adding custom packages, package A is using Makefile variable that needs to be updated (or not) by other package B, however package B is not mandatory for compiling package A. In other words, if configuration selects package B in that case shared Makefile variable be populated and values can be seen by other packages.

Package A package B
$(variable1) variable1 := "-Dxyz -Dabc"

I tried with setting empty "variable1" in which is not working. Appreciate if anyone can point me existing examples for same