Break or exit out of user defined procedure

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Break or exit out of user defined procedure

Toan Pham
Hi,


Is it possible to exit a user defined procedure with something like this?


define inner-generic-package

ifneq ($(call strip,$(filter $(1),$(PACKAGES_ALL))),)
$$(warning Package '$(1)' defined a second time in '$(pkgdir)'; \
   previous definition was in '$$($(2)_PKGDIR)')
*return*
endif

<do alot of things>
endef




thanks,

TP
_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make
Reply | Threaded
Open this post in threaded view
|

Re: Break or exit out of user defined procedure

Rakesh Sharma-6
Hi TP ,


You can make use of the $(if ...) construct of GNU make for this scenario.


$(if $(call strip,$(filter $(1),$(PACKAGES_ALL))),true_portion,false_portion)


The true portion you already noted as a warning funtion.


And in case the false portion of the $(if ...) clause is too big and hampers maintainability of the

code, you factor out into another user-defined macro, and have that macro called up in the false portion

in the false portion.


For more info, you can check the manual out:

https://www.gnu.org/software/make/manual/html_node/Conditional-Functions.html#Conditional-Functions


Thanks,

Rakesh

________________________________
From: Help-make <help-make-bounces+sharma__r=[hidden email]> on behalf of Toan Pham <[hidden email]>
Sent: Friday, January 26, 2018 9:43 AM
To: [hidden email]
Subject: Break or exit out of user defined procedure

Hi,


Is it possible to exit a user defined procedure with something like this?


define inner-generic-package

ifneq ($(call strip,$(filter $(1),$(PACKAGES_ALL))),)
$$(warning Package '$(1)' defined a second time in '$(pkgdir)'; \
   previous definition was in '$$($(2)_PKGDIR)')
*return*
endif

<do alot of things>
endef




thanks,

TP
_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make
Help-make -- Users list for the GNU implementation of make<https://lists.gnu.org/mailman/listinfo/help-make>
lists.gnu.org
This list is for users and installers of GNU make to ask for help. Please send bug reports to [hidden email] instead of posting them here. To see the collection of ...



_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make