[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [patches] First cut at simple option group support
- To: rsandifo@xxxxxxxxxxxxx
- Subject: Re: [patches] First cut at simple option group support
- From: Jim Blandy <jimb@xxxxxxxxxxxxxxxx>
- Date: Tue, 12 Dec 2006 01:16:03 -0800
Richard, here's a revision of the patch that implements (my
understanding of) your suggestion. Does this look better?
I've made some other minor changes:
- I renamed the config file to 'option-groups.config'. Naming some
part of EGLIBC 'eglibc' is only meaningful when one is trying to
draw a contrast with something else, as is the case with
'ChangeLog.eglibc' opposing itself to GLIBC's 'ChangeLog'.
Otherwise, it's a wasted opportunity to say something more
meaningful.
- I renamed our toy catgets option group OPTION_EGLIBC_CATGETS.
The groups suggested by POSIX will have names like
OPTION_POSIX_NETWORKING and OPTION_XSI_I18N; since the catgets
option is our own invention, it seems appropriate for the name to
live in an 'EGLIBC' namespace.
- I expanded the comments in option-groups.def.
ChangeLog.eglibc:
2006-12-08 Jim Blandy <jimb@xxxxxxxxxxxxxxxx>
Add rudimentary option group support.
* option-groups.mak, option-groups.def, option-groups.defaults:
New files.
* Makerules: Add contents of enabled option groups to the values
of the variables 'routines', 'others', 'install-bin',
'install-sbin', 'extra-objs', 'tests', and 'test-srcs'.
* catgets/Makefile: Add the catgets directory's routines and
programs to the OPTION_EGLIBC_CATGETS option group.
Index: option-groups.def
===================================================================
--- option-groups.def (revision 0)
+++ option-groups.def (revision 0)
@@ -0,0 +1,44 @@
+# This file documents the option groups EGLIBC currently supports, in
+# a format akin to the Linux Kconfig system's. The syntax may change
+# over time.
+#
+# An entry of the form:
+#
+# config OPTION_GROUP_NAME
+# bool "one-line explanation of what this option group controls"
+# help
+# Multi-line help explaining the option group's meaning in
+# some detail, terminated by indentation level.
+#
+# defines an option group whose variable is OPTION_GROUP_NAME, with
+# meaningful values 'y' (enabled) and 'n' (disabled). The
+# documentation is formatted to be consumed by some sort of
+# interactive configuration interface, but EGLIBC doesn't have such an
+# interface yet.
+#
+# Option group variables get their default values from the file
+# 'option-groups.defaults', in the top directory of the EGLIBC source
+# tree. By default, all EGLIBC option groups are enabled --- their
+# variables are set to 'y'.
+#
+# After including 'option-groups.defaults', the EGLIBC make machinery
+# includes the file 'option-groups.config' from the top of the build
+# tree, if it is present. Developers can place assignments to option
+# group variables in that file to override the defaults. For example,
+# to disable an option group, place a line of the form:
+#
+# OPTION_GROUP_NAME = n
+#
+# in 'option-groups.config' at the top of your build tree. To
+# explicitly enable an option group, you may also write:
+#
+# OPTION_GROUP_NAME = y
+#
+# although this simply reestablishes the value already set by
+# 'option-groups.defaults'.
+
+config OPTION_EGLIBC_CATGETS
+ bool "Functions for accessing message catalogs"
+ help
+ This option group includes functions for accessing message
+ catalogs: catopen, catclose, and catgets.
Index: catgets/Makefile
===================================================================
--- catgets/Makefile (revision 157175)
+++ catgets/Makefile (working copy)
@@ -21,16 +21,18 @@
#
subdir := catgets
+include ../option-groups.mak
+
headers = nl_types.h
distribute = catgetsinfo.h config.h xopen-msg.sed test1.msg test2.msg \
test-gencat.sh sample.SJIS
-routines = catgets open_catalog
-others = gencat
-install-bin = gencat
-extra-objs = $(gencat-modules:=.o)
+routines-$(OPTION_EGLIBC_CATGETS) := catgets open_catalog
+others-$(OPTION_EGLIBC_CATGETS) := gencat
+install-bin-$(OPTION_EGLIBC_CATGETS) := gencat
+extra-objs-$(OPTION_EGLIBC_CATGETS) := $(gencat-modules:=.o)
-tests = tst-catgets
-test-srcs = test-gencat
+tests-$(OPTION_EGLIBC_CATGETS) := tst-catgets
+test-srcs-$(OPTION_EGLIBC_CATGETS) := test-gencat
gencat-modules = xmalloc
Index: option-groups.mak
===================================================================
--- option-groups.mak (revision 0)
+++ option-groups.mak (revision 0)
@@ -0,0 +1,17 @@
+# Setup file for subdirectory Makefiles that define EGLIBC option groups.
+
+# Read the default settings for all options.
+include $(..)option-groups.defaults
+
+# Read the developer's option group selections, overriding the
+# defaults from option-groups.defaults.
+-include $(objdir)/option-groups.config
+
+# Establish 'routines-y', etc. as simply expanded variables.
+routines-y :=
+others-y :=
+install-bin-y :=
+install-sbin-y :=
+extra-objs-y :=
+tests-y :=
+test-srcs-y :=
Index: Makerules
===================================================================
--- Makerules (revision 157175)
+++ Makerules (working copy)
@@ -405,6 +405,16 @@
endef
endif
+# Include targets in the selected option groups.
+routines += $(routines-y)
+others += $(others-y)
+install-bin += $(install-bin-y)
+install-sbin += $(install-sbin-y)
+extra-objs += $(extra-objs-y)
+tests += $(tests-y)
+test-srcs += $(test-srcs-y)
+
+
# Modify the list of routines we build for different targets
ifeq (yesyes,$(build-shared)$(elf))
Index: option-groups.defaults
===================================================================
--- option-groups.defaults (revision 0)
+++ option-groups.defaults (revision 0)
@@ -0,0 +1,11 @@
+# This file sets default values for all option group variables
+# mentioned in option-groups.def; see that file for a description of
+# each option group.
+#
+# Subdirectory makefiles include this file before including the user's
+# settings from option-groups.config at the top of the build tree;
+# that file need only refer to those options whose default settings
+# are to be changed.
+#
+# By default, all option groups are enabled.
+OPTION_EGLIBC_CATGETS = y