drivers/pc80/Kconfig: Revert PS/2 initialization defaults
[coreboot.git] / Makefile
blobcc2d27ce7f9447bb44ee1a2f6dc967699e129df2
1 ##
2 ## This file is part of the coreboot project.
3 ##
4 ## Copyright (C) 2008 Advanced Micro Devices, Inc.
5 ## Copyright (C) 2008 Uwe Hermann <uwe@hermann-uwe.de>
6 ## Copyright (C) 2009-2010 coresystems GmbH
7 ## Copyright (C) 2011 secunet Security Networks AG
8 ##
9 ## Redistribution and use in source and binary forms, with or without
10 ## modification, are permitted provided that the following conditions
11 ## are met:
12 ## 1. Redistributions of source code must retain the above copyright
13 ## notice, this list of conditions and the following disclaimer.
14 ## 2. Redistributions in binary form must reproduce the above copyright
15 ## notice, this list of conditions and the following disclaimer in the
16 ## documentation and/or other materials provided with the distribution.
17 ## 3. The name of the author may not be used to endorse or promote products
18 ## derived from this software without specific prior written permission.
20 ## THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21 ## ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 ## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 ## ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24 ## FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 ## DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 ## OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 ## HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 ## LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 ## OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 ## SUCH DAMAGE.
33 $(if $(wildcard .xcompile),,$(eval $(shell bash util/xcompile/xcompile $(XGCCPATH) > .xcompile)))
34 include .xcompile
36 export top := $(CURDIR)
37 export src := src
38 export srck := $(top)/util/kconfig
39 export obj ?= build
40 export objutil ?= $(obj)/util
41 export objk := $(objutil)/kconfig
44 export KCONFIG_AUTOHEADER := $(obj)/config.h
45 export KCONFIG_AUTOCONFIG := $(obj)/auto.conf
46 export KCONFIG_DEPENDENCIES := $(obj)/auto.conf.cmd
47 export KCONFIG_SPLITCONFIG := $(obj)/config
48 export KCONFIG_TRISTATE := $(obj)/tristate.conf
49 export KCONFIG_NEGATIVES := 1
51 # directory containing the toplevel Makefile.inc
52 TOPLEVEL := .
54 CONFIG_SHELL := sh
55 KBUILD_DEFCONFIG := configs/defconfig
56 UNAME_RELEASE := $(shell uname -r)
57 DOTCONFIG ?= .config
58 KCONFIG_CONFIG = $(DOTCONFIG)
59 export KCONFIG_CONFIG
60 HAVE_DOTCONFIG := $(wildcard $(DOTCONFIG))
61 MAKEFLAGS += -rR --no-print-directory
63 # Make is silent per default, but 'make V=1' will show all compiler calls.
64 Q:=@
65 ifneq ($(V),1)
66 ifneq ($(Q),)
67 .SILENT:
68 endif
69 endif
71 HOSTCC = gcc
72 HOSTCXX = g++
73 HOSTCFLAGS := -g
74 HOSTCXXFLAGS := -g
76 DOXYGEN := doxygen
77 DOXYGEN_OUTPUT_DIR := doxygen
79 all: real-all
81 # This include must come _before_ the pattern rules below!
82 # Order _does_ matter for pattern rules.
83 include util/kconfig/Makefile
85 # Three cases where we don't need fully populated $(obj) lists:
86 # 1. when no .config exists
87 # 2. when make config (in any flavour) is run
88 # 3. when make distclean is run
89 # Don't waste time on reading all Makefile.incs in these cases
90 ifeq ($(strip $(HAVE_DOTCONFIG)),)
91 NOCOMPILE:=1
92 endif
93 ifneq ($(MAKECMDGOALS),)
94 ifneq ($(filter %config %clean cross%,$(MAKECMDGOALS)),)
95 NOCOMPILE:=1
96 endif
97 ifeq ($(MAKECMDGOALS), %clean)
98 NOMKDIR:=1
99 endif
100 endif
102 ifeq ($(NOCOMPILE),1)
103 include $(TOPLEVEL)/Makefile.inc
104 real-all: config
106 else
108 include $(HAVE_DOTCONFIG)
110 include toolchain.inc
112 ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
113 CC:=clang -m32 -mno-mmx -mno-sse -no-integrated-as
114 HOSTCC:=clang
115 endif
117 strip_quotes = $(subst ",,$(subst \",,$(1)))
119 # The primary target needs to be here before we include the
120 # other files
122 real-all: real-target
124 # must come rather early
125 .SECONDEXPANSION:
127 $(obj)/config.h:
128 $(MAKE) oldconfig
130 # Add a new class of source/object files to the build system
131 add-class= \
132 $(eval $(1)-srcs:=) \
133 $(eval $(1)-objs:=) \
134 $(eval classes+=$(1))
136 # Special classes are managed types with special behaviour
137 # On parse time, for each entry in variable $(1)-y
138 # a handler $(1)-handler is executed with the arguments:
139 # * $(1): directory the parser is in
140 # * $(2): current entry
141 add-special-class= \
142 $(eval $(1):=) \
143 $(eval special-classes+=$(1))
145 # Clean -y variables, include Makefile.inc
146 # Add paths to files in X-y to X-srcs
147 # Add subdirs-y to subdirs
148 includemakefiles= \
149 $(foreach class,classes subdirs $(classes) $(special-classes), $(eval $(class)-y:=)) \
150 $(eval -include $(1)) \
151 $(foreach class,$(classes-y), $(call add-class,$(class))) \
152 $(foreach class,$(classes), \
153 $(eval $(class)-srcs+= \
154 $$(subst $(top)/,, \
155 $$(abspath $$(subst $(dir $(1))/,/,$$(addprefix $(dir $(1)),$$($(class)-y))))))) \
156 $(foreach special,$(special-classes), \
157 $(foreach item,$($(special)-y), $(call $(special)-handler,$(dir $(1)),$(item)))) \
158 $(eval subdirs+=$$(subst $(CURDIR)/,,$$(abspath $$(addprefix $(dir $(1)),$$(subdirs-y)))))
160 # For each path in $(subdirs) call includemakefiles
161 # Repeat until subdirs is empty
162 evaluate_subdirs= \
163 $(eval cursubdirs:=$(subdirs)) \
164 $(eval subdirs:=) \
165 $(foreach dir,$(cursubdirs), \
166 $(eval $(call includemakefiles,$(dir)/Makefile.inc))) \
167 $(if $(subdirs),$(eval $(call evaluate_subdirs)))
169 # collect all object files eligible for building
170 subdirs:=$(TOPLEVEL)
171 $(eval $(call evaluate_subdirs))
172 ifeq ($(FAILBUILD),1)
173 $(error cannot continue build)
174 endif
176 # Eliminate duplicate mentions of source files in a class
177 $(foreach class,$(classes),$(eval $(class)-srcs:=$(sort $($(class)-srcs))))
179 src-to-obj=$(addsuffix .$(1).o, $(basename $(patsubst src/%, $(obj)/%, $($(1)-srcs))))
180 $(foreach class,$(classes),$(eval $(class)-objs:=$(call src-to-obj,$(class))))
182 # Save all objs before processing them (for dependency inclusion)
183 originalobjs:=$(foreach var, $(addsuffix -objs,$(classes)), $($(var)))
185 # Call post-processors if they're defined
186 $(foreach class,$(classes),\
187 $(if $(value $(class)-postprocess),$(eval $(call $(class)-postprocess,$($(class)-objs)))))
189 allsrcs:=$(foreach var, $(addsuffix -srcs,$(classes)), $($(var)))
190 allobjs:=$(foreach var, $(addsuffix -objs,$(classes)), $($(var)))
191 alldirs:=$(sort $(abspath $(dir $(allobjs))))
193 # macro to define template macros that are used by use_template macro
194 define create_cc_template
195 # $1 obj class
196 # $2 source suffix (c, S)
197 # $3 additional compiler flags
198 # $4 additional dependencies
199 ifn$(EMPTY)def $(1)-objs_$(2)_template
200 de$(EMPTY)fine $(1)-objs_$(2)_template
201 $(obj)/$$(1).$(1).o: src/$$(1).$(2) $(obj)/config.h $(4)
202 @printf " CC $$$$(subst $$$$(obj)/,,$$$$(@))\n"
203 $(CC_$(1)) $(3) -MMD $$$$(CPPFLAGS_$(1)) $$$$(CFLAGS_$(1)) -c -o $$$$@ $$$$<
204 en$(EMPTY)def
205 end$(EMPTY)if
206 endef
208 filetypes-of-class=$(subst .,,$(sort $(suffix $($(1)-srcs))))
209 $(foreach class,$(classes), \
210 $(foreach type,$(call filetypes-of-class,$(class)), \
211 $(eval $(call create_cc_template,$(class),$(type),$($(class)-$(type)-ccopts),$($(class)-$(type)-deps)))))
213 foreach-src=$(foreach file,$($(1)-srcs),$(eval $(call $(1)-objs_$(subst .,,$(suffix $(file)))_template,$(subst src/,,$(basename $(file))))))
214 $(eval $(foreach class,$(classes),$(call foreach-src,$(class))))
216 DEPENDENCIES = $(originalobjs:.o=.d)
217 -include $(DEPENDENCIES)
219 printall:
220 @$(foreach class,$(classes),echo $(class)-objs:=$($(class)-objs); )
221 @echo alldirs:=$(alldirs)
222 @echo allsrcs=$(allsrcs)
223 @echo DEPENDENCIES=$(DEPENDENCIES)
224 @echo LIBGCC_FILE_NAME=$(LIBGCC_FILE_NAME_$(class))
225 @$(foreach class,$(special-classes),echo $(class):='$($(class))'; )
227 endif
229 ifndef NOMKDIR
230 $(shell mkdir -p $(KCONFIG_SPLITCONFIG) $(objutil)/kconfig/lxdialog $(additional-dirs) $(alldirs))
231 endif
233 cscope:
234 cscope -bR
236 doxy: doxygen
237 doxygen:
238 $(DOXYGEN) documentation/Doxyfile.coreboot
240 doxyclean: doxygen-clean
241 doxygen-clean:
242 rm -rf $(DOXYGEN_OUTPUT_DIR)
244 clean-for-update: doxygen-clean clean-for-update-target
245 rm -rf $(obj) .xcompile
247 clean: clean-for-update clean-target
248 rm -f .ccwrap
250 clean-cscope:
251 rm -f cscope.out
253 distclean: clean
254 rm -f .config .config.old ..config.tmp .kconfig.d .tmpconfig* .ccwrap .xcompile
256 .PHONY: $(PHONY) clean clean-for-update clean-cscope cscope distclean doxygen doxy .xcompile