Changeset 488


Ignore:
Timestamp:
Nov 7, 2012, 7:58:00 AM (10 years ago)
Author:
ehem
Message:

Minor adjustment to the sample configuration. The enable/disable option is
outside the menu, and the entire menu disappears if the plugin is disabled.
I've set the example disabled by default, which is unusual for a normal plugin,
but works better for a mere example. plugin.mk now takes care of
enabling/disabling itself.

Location:
branches/contrib/plugins/example
Files:
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • branches/contrib/plugins/example/Config.in

    r482 r488  
    2727# full override by the plugin.
    2828
    29 menu "Plugin Example"
    30 
    31 ## this config would be removed for USE_ALT_CONF
    3229config PLUGIN_EXAMPLE_ENABLE
     30#config PLUGIN_%_ENABLE
    3331        bool "Support for new target example"
    3432        deselect DO_CONF_TARGETS
    3533        select TARGET_example
     34        default n
     35
     36if PLUGIN_EXAMPLE_ENABLE
     37#if PLUGIN_%_ENABLE
     38
     39# These can be used to ensure someone doesn't do something silly, such as
     40# moving directories around without updating the configuration.  While these
     41# will produce CONFIG_PLUGIN values in the output, they can't be changed and
     42# are normally hidden.
     43config PLUGIN_EXAMPLE_UUID
     44#config PLUGIN_%_UUID
     45        string
     46        default "50b4589d-6e13-4514-b57e-a7ec36e056b3"
     47config PLUGIN_EXAMPLE_CONFVER
     48#config PLUGIN_%_CONRVER
     49        string
     50        default "1.0"
     51
     52menu "Plugin Example"
    3653
    3754config TARGET_example
     
    7491        bool "Option A"
    7592        default y
    76         depends PLUGIN_EXAMPLE_ENABLE
    77 #       depends PLUGIN_%_ENABLE
     93        depends TARGET_example_subsysA
     94#       depends PLUGIN_%_TARGET_subsysA
    7895
    7996endmenu
     97
     98endif
     99
  • branches/contrib/plugins/example/plugin.mk

    r487 r488  
    1717# along with this program.  If not, see <http://www.gnu.org/licenses/>.
    1818
    19 
    2019#
    2120# This is an example plugin.mk file.  I'm giving examples of some conventional
    2221# Make constructs, rename this file to "plugin.mk" to see them in action.
    2322#
     23
     24
     25#
     26# This handles enabling/disabling the example plugin
     27#
     28ifeq($(CONFIG_$(PLUGIN_VAR)_ENABLE),y)
     29
     30#
     31# TODO: check UUID and CONFVER
     32#
     33# "50b4589d-6e13-4514-b57e-a7ec36e056b3" and "1.0"
     34
     35#
     36# This makes us a prerequisite of the "clean" rule, so `make clean` will cause
     37# us to be invoked.
     38#
     39clean: $(PLUGIN_RULE)/test
     40
     41#
     42# The end of the enable/disable construct.  Everything follows from the above,
     43# pieces, disabling these two portions completely removes us from action.  Our
     44# variable will still be known to Make, but unless another plugin touches it...
     45#
     46endif
    2447
    2548
     
    4467        @echo I\'m located in the directory \"$(PLUGIN_NAME)\", the variable is \"$($(PLUGIN_VAR)_TESTVAR)\", my id is $(PLUGIN_ID) you are number 6
    4568
    46 #
    47 # This makes us a prerequisite of the "clean" rule, so `make clean` will cause
    48 # us to be invoked.
    49 #
    50 clean: $(PLUGIN_RULE)/test
    51 
Note: See TracChangeset for help on using the changeset viewer.