]> 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_FILE    = $(L4DIR_ABS)/mk/Kconfig
42 KCONFIG_OBJ_DIR = $(OBJ_BASE)/tool/kconfig
43
44 kconfig_call = $(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 $(OBJ_BASE)/include/l4
84
85 $(DIRS_FOR_CONFIG):
86         $(VERBOSE)install -d $@
87         
88
89 menuconfig config: $(KCONFIG_FILE) $(DIRS_FOR_CONFIG)
90         $(VERBOSE)$(kconfig_call) menuconfig silentoldconfig
91         $(VERBOSE)test ! -r $(DROPSCONF_CONFIG) -o \
92                 ! $(DROPSCONF_CONFIG) -nt $(DROPSCONF_CONFIG_MK) || \
93                 $(MAKE) $(DROPSCONF_CONFIG_MK)
94
95 oldconfig xconfig gconfig nconfig randconfig allyesconfig allnoconfig: $(DIRS_FOR_CONFIG)
96         $(VERBOSE)$(kconfig_call) $@ silentoldconfig
97         @$(MAKE) $(DROPSCONF_CONFIG_MK)
98
99 $(DROPSCONF_CONFIG): $(DIRS_FOR_CONFIG)
100         $(VERBOSE)$(kconfig_call) silentoldconfig
101         
102
103 #$(DROPSCONF_CONFIG_H): $(DROPSCONF_CONFIG)
104
105 #$(DROPSCONF_CONFIG_H) $(DROPSCONF_CONFIG): $(DROPSCONF_CONFIG_IN)
106 #       @$(GEN_MESSAGE)
107 #       $(VERBOSE)install -d $(dir $(DROPSCONF_CONFIG))
108 #       $(VERBOSE)install -d $(dir $(DROPSCONF_CONFIG_H))
109 #       $(VERBOSE)if tty >/dev/null; then \
110 #         $(DROPSCONF_VARDEFS) $(DROPSCONF_TOOL_OLD); \
111 #        else \
112 #         true | $(DROPSCONF_VARDEFS) $(DROPSCONF_TOOL_OLD) \
113 #         $(if $(VERBOSE),>/dev/null,) || \
114 #         ( echo -e "\nError: Unattended mode -- Some defaults for config options are missing." ; \
115 #           false ) \
116 #        fi
117
118 $(DROPSCONF_CONFIG_MK): $(DROPSCONF_CONFIG)
119         $(VERBOSE)sed -e "s/\(^[^= ]*=\)'\([^']*\)'/\1\2/" \
120                 <$(DROPSCONF_CONFIG) >$@
121         $(VERBOSE)$(MAKE) DROPSCONF_CONFIG_MK_POST_HOOK
122
123 DROPSCONF_CONFIG_MK_POST_HOOK::
124         
125 #config:: $(DROPSCONF_LXDIALOG)
126 #       $(VERBOSE)install -d $(dir $(DROPSCONF_CONFIG_H))
127 #       $(VERBOSE)$(DROPSCONF_VARDEFS) $(DROPSCONF_TOOL)
128 #       $(VERBOSE)test ! -r $(DROPSCONF_CONFIG) -o \
129 #               ! $(DROPSCONF_CONFIG) -nt $(DROPSCONF_CONFIG_MK) || \
130 #               $(MAKE) $(DROPSCONF_CONFIG_MK)
131
132 #txtconfig::
133 #       $(VERBOSE)install -d $(dir $(DROPSCONF_CONFIG_H))
134 #       $(VERBOSE)$(DROPSCONF_VARDEFS) $(DROPSCONF_TOOL_TXT)
135 #       @$(MAKE) $(DROPSCONF_CONFIG_MK)
136 #
137 #oldconfig::
138 #       $(VERBOSE)install -d $(dir $(DROPSCONF_CONFIG_H))
139 #       $(VERBOSE)$(DROPSCONF_VARDEFS) $(DROPSCONF_TOOL_OLD)
140 #       @$(MAKE) $(DROPSCONF_CONFIG_MK)
141 #
142 #$(DROPSCONF_LXDIALOG):
143 #       $(VERBOSE)install -d $(@D)
144 #       $(VERBOSE)PWD=$(call absfilename,$(L4DIR)/tool/config) $(MAKE) -C $(L4DIR)/tool/config
145 #
146 clean::
147
148 cleanall::
149         $(VERBOSE)$(RM) $(DROPSCONF_CONFIG) $(DROPSCONF_CONFIG_H) \
150                         $(DROPSCONF_CONFIG_MK) .menuconfig.log \
151                         $(DROPSCONF_CONFIG).old
152
153 help::
154         @echo
155         @echo "Configuration targets:"
156         @echo "  config           - run the menu-driven configuration tool"
157         @echo "  gconfig          - run a graphical configuration tool"
158         @echo "  xconfig          - run a graphical configuration tool"
159         @echo "  oldconfig        - (re)create the configuration header based on a prior"
160         @echo "                     configuration or default values"
161
162 # special switch not to include DROPSCONF_CONFIG_MK
163 ifeq ($(DROPSCONF_DONTINC_MK),)
164 # do not prebuild the config file on "make config"
165 ifeq ($(filter config oldconfig txtconfig help scrub clean cleanall $(DROPSCONF_CONFIG_MK),$(MAKECMDGOALS)),)
166 $(info INCLUDING $(DROPSCONF_CONFIG_MK) config.inc)
167 -include $(DROPSCONF_CONFIG_MK)
168 endif
169 endif
170
171 # end of DROPSCONF defined
172 else
173 config txtconfig oldconfig::
174 endif
175
176 .PHONY: config oldconfig txtconfig