]> rtime.felk.cvut.cz Git - l4.git/blob - l4/mk/config.inc
Update
[l4.git] / l4 / mk / config.inc
1 # -*- Makefile -*-
2 # vim:set ft=make:
3 # DROPS (Dresden Realtime OPerating System) Component
4 #
5 # Makefile-Include for compiling templates (prog.mk, lib.mk)
6 #
7
8 # Makefile-Include for binary, lib, subdir and other directories.
9 # Definitions and rules for the DROPS configuration tool.
10
11 # Supported targets:
12 #
13 # config::              - run the menu-driven configuration tool
14 # menuconfig xconfig::  - run the configuration tool
15 # oldconfig::           - (re)create the configuration header
16 #                         based on a prior configuration
17 #                         or default values
18 #
19 # Required Parameters:
20 #
21 # PKGDIR
22 #
23 #
24 # Optional Parameters:
25 #
26 # DROPSCONF             - if nonempty, the configuration tool is run for
27 #                         target config::. If empty, the configuration tool
28 #                         is not run.
29 # DROPSCONF_TITLE       - the main title in the configuration tool.
30 # DROPSCONF_DEFCONFIG   - default config file
31 # DROPSCONF_CONFIG_IN   - configuration defintion file
32 # DROPSCONF_CONFIG      - config file
33 # DROPSCONF_CONFIG_H    - generated config header file
34 # DROPSCONF_MACRO       - macro to indicate inclusion of config header file
35 # DROPSCONF_HELPFILE    - options help file
36 # DROPSCONF_TOOL        - the menudriven configuration tool
37 # DROPSCONF_TOOL_TXT    - the configuration tool
38 # DROPSCONF_TOOL_OLD    - helper for recreating the config header file
39
40
41 KCONFIG_OBJ_DIR  = $(OBJ_BASE)/tool/kconfig
42
43 kconfig_call = [ -d $@ ] || install -d $(OBJ_BASE)/include/l4; \
44                $(MAKE) -C $(L4DIR)/tool/kconfig O=$(OBJ_BASE) \
45                Kconfig=$(KCONFIG_FILE) \
46                KCONFIG_AUTOHEADER=include/l4/bid_config.h \
47                KCONFIG_CONFIG=.kconfig \
48                KCONFIG_AUTOCONFIG=.kconfig.auto \
49                KCONFIG_TRISTATE=.kconfig.tristate \
50                KERNELVERSION=SVN \
51                l4re_srcdir=$(L4DIR_ABS)
52
53
54 DROPSCONF               ?=
55 #DROPSCONF_TITLE                ?= DROPS Configuration Tool
56 #DROPSCONF_DEFCONFIG    ?= defconfig
57 #DROPSCONF_CONFIG_IN    ?= config.in
58 #DROPSCONF_CONFIG       ?= $(OBJ_DIR)/.config
59 #DROPSCONF_CONFIG_H     ?= $(OBJ_DIR)/config.h
60 #DROPSCONF_CONFIG_MK    ?= $(OBJ_DIR)/Makeconf.bid.local
61 DROPSCONF_DONTINC_MK    ?=
62 #DROPSCONF_MACRO                ?= CONFIG_H_INCLUDED
63 #DROPSCONF_HELPFILE     ?= config.help
64 #DROPSCONF_LXDIALOG     ?= $(OBJ_BASE)/tool/config/lxdialog/lxdialog
65 #DROPSCONF_TOOL         ?= $(firstword $(wildcard \
66 #                                       $(L4DIR)/tool/config/Menuconfig \
67 #                                       $(DROPS_STDDIR)/tool/bin/Menuconfig) \
68 #                                       did_not_find_BID_Menuconfig)
69 #DROPSCONF_TOOL_TXT     ?= $(firstword $(wildcard \
70 #                                       $(L4DIR)/tool/config/Configure \
71 #                                       $(DROPS_STDDIR)/tool/bin/Configure) \
72 #                                       did_not_find_BID_Configure)
73 #DROPSCONF_TOOL_OLD     ?= $(firstword $(wildcard \
74 #                                       $(L4DIR)/tool/config/Configure \
75 #                                       $(DROPS_STDDIR)/tool/bin/Configure) \
76 #                                       did_not_find_BID_Configure) -d
77 #DROPSCONF_VARDEFS = $(foreach v,TITLE DEFCONFIG CONFIG_IN CONFIG CONFIG_H \
78 #       MACRO HELPFILE UNDEF LXDIALOG,DROPSCONF_$v='$(DROPSCONF_$v)')
79
80 ifneq ($(DROPSCONF),)
81 .o:     $(DROPSCONF_CONFIG_H)
82
83 DIRS_FOR_CONFIG = $(KCONFIG_OBJ_DIR) $(OBJ_BASE)/config
84
85 $(DIRS_FOR_CONFIG): $(KCONFIG_FILE)
86         $(VERBOSE)[ -d $@ ] || install -d $@
87
88 menuconfig config: $(DIRS_FOR_CONFIG)
89         $(VERBOSE)+$(kconfig_call) menuconfig silentoldconfig
90         $(VERBOSE)test ! -r $(DROPSCONF_CONFIG) -o \
91                 ! $(DROPSCONF_CONFIG) -nt $(DROPSCONF_CONFIG_MK) || \
92                 $(MAKE) $(DROPSCONF_CONFIG_MK)
93
94 textconfig: $(DIRS_FOR_CONFIG)
95         $(VERBOSE)+$(kconfig_call) config silentoldconfig
96         @$(MAKE) $(DROPSCONF_CONFIG_MK)
97
98 oldconfig xconfig gconfig nconfig randconfig allyesconfig allnoconfig: $(DIRS_FOR_CONFIG)
99         $(VERBOSE)+$(kconfig_call) $@ silentoldconfig
100         @$(MAKE) $(DROPSCONF_CONFIG_MK)
101
102 $(DROPSCONF_CONFIG) silentoldconfig: $(DIRS_FOR_CONFIG)
103         $(VERBOSE)+$(kconfig_call) silentoldconfig
104         
105
106 #$(DROPSCONF_CONFIG_H): $(DROPSCONF_CONFIG)
107
108 #$(DROPSCONF_CONFIG_H) $(DROPSCONF_CONFIG): $(DROPSCONF_CONFIG_IN)
109 #       @$(GEN_MESSAGE)
110 #       $(VERBOSE)install -d $(dir $(DROPSCONF_CONFIG))
111 #       $(VERBOSE)install -d $(dir $(DROPSCONF_CONFIG_H))
112 #       $(VERBOSE)if tty >/dev/null; then \
113 #         $(DROPSCONF_VARDEFS) $(DROPSCONF_TOOL_OLD); \
114 #        else \
115 #         true | $(DROPSCONF_VARDEFS) $(DROPSCONF_TOOL_OLD) \
116 #         $(if $(VERBOSE),>/dev/null,) || \
117 #         ( echo -e "\nError: Unattended mode -- Some defaults for config options are missing." ; \
118 #           false ) \
119 #        fi
120
121 $(DROPSCONF_CONFIG_MK): $(DROPSCONF_CONFIG)
122         $(VERBOSE)sed -e "s/\(^[^= ]*=\)'\([^']*\)'/\1\2/" \
123                 <$(DROPSCONF_CONFIG) >$@
124         $(VERBOSE)$(MAKE) DROPSCONF_CONFIG_MK_POST_HOOK
125
126 DROPSCONF_CONFIG_MK_POST_HOOK::
127         
128 #config:: $(DROPSCONF_LXDIALOG)
129 #       $(VERBOSE)install -d $(dir $(DROPSCONF_CONFIG_H))
130 #       $(VERBOSE)$(DROPSCONF_VARDEFS) $(DROPSCONF_TOOL)
131 #       $(VERBOSE)test ! -r $(DROPSCONF_CONFIG) -o \
132 #               ! $(DROPSCONF_CONFIG) -nt $(DROPSCONF_CONFIG_MK) || \
133 #               $(MAKE) $(DROPSCONF_CONFIG_MK)
134
135 #txtconfig::
136 #       $(VERBOSE)install -d $(dir $(DROPSCONF_CONFIG_H))
137 #       $(VERBOSE)$(DROPSCONF_VARDEFS) $(DROPSCONF_TOOL_TXT)
138 #       @$(MAKE) $(DROPSCONF_CONFIG_MK)
139 #
140 #oldconfig::
141 #       $(VERBOSE)install -d $(dir $(DROPSCONF_CONFIG_H))
142 #       $(VERBOSE)$(DROPSCONF_VARDEFS) $(DROPSCONF_TOOL_OLD)
143 #       @$(MAKE) $(DROPSCONF_CONFIG_MK)
144 #
145 #$(DROPSCONF_LXDIALOG):
146 #       $(VERBOSE)install -d $(@D)
147 #       $(VERBOSE)PWD=$(call absfilename,$(L4DIR)/tool/config) $(MAKE) -C $(L4DIR)/tool/config
148 #
149 clean::
150
151 ifeq ($(S),)
152 cleanall::
153         $(VERBOSE)$(RM) $(DROPSCONF_CONFIG) $(DROPSCONF_CONFIG_H) \
154                         $(DROPSCONF_CONFIG_MK) .menuconfig.log \
155                         $(DROPSCONF_CONFIG).old
156 endif
157
158 help::
159         @echo
160         @echo "Configuration targets:"
161         @echo "  config           - run the menu-driven configuration tool"
162         @echo "  gconfig          - run a graphical configuration tool"
163         @echo "  xconfig          - run a graphical configuration tool"
164         @echo "  oldconfig        - (re)create the configuration header based on a prior"
165         @echo "                     configuration or default values"
166
167 # special switch not to include DROPSCONF_CONFIG_MK
168 ifeq ($(DROPSCONF_DONTINC_MK),)
169 # do not prebuild the config file on "make config"
170 ifeq ($(filter config oldconfig silentoldconfig txtconfig help scrub clean cleanall $(DROPSCONF_CONFIG_MK),$(MAKECMDGOALS)),)
171 $(info INCLUDING $(DROPSCONF_CONFIG_MK) config.inc)
172 -include $(DROPSCONF_CONFIG_MK)
173 endif
174 endif
175
176 # end of DROPSCONF defined
177 else
178 config txtconfig oldconfig silentoldconfig::
179 endif
180
181 .PHONY: config oldconfig silentoldconfig txtconfig menuconfig \
182         xconfig gconfig nconfig randconfig allyesconfig allnoconfig