Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 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> |
Stefan Reinauer | 8ed1b6d | 2010-01-19 21:13:44 +0000 | [diff] [blame^] | 6 | ## Copyright (C) 2009-2010 coresystems GmbH |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 7 | ## |
| 8 | ## Redistribution and use in source and binary forms, with or without |
| 9 | ## modification, are permitted provided that the following conditions |
| 10 | ## are met: |
| 11 | ## 1. Redistributions of source code must retain the above copyright |
| 12 | ## notice, this list of conditions and the following disclaimer. |
| 13 | ## 2. Redistributions in binary form must reproduce the above copyright |
| 14 | ## notice, this list of conditions and the following disclaimer in the |
| 15 | ## documentation and/or other materials provided with the distribution. |
| 16 | ## 3. The name of the author may not be used to endorse or promote products |
| 17 | ## derived from this software without specific prior written permission. |
| 18 | ## |
| 19 | ## THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
| 20 | ## ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 21 | ## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 22 | ## ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
| 23 | ## FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 24 | ## DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 25 | ## OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 26 | ## HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 27 | ## LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | ## OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | ## SUCH DAMAGE. |
| 30 | ## |
| 31 | |
| 32 | $(if $(wildcard .xcompile),,$(eval $(shell bash util/xcompile/xcompile > .xcompile))) |
| 33 | include .xcompile |
| 34 | |
| 35 | export top := $(shell pwd) |
| 36 | export src := $(top)/src |
| 37 | export srck := $(top)/util/kconfig |
| 38 | export obj := $(top)/build |
Myles Watson | d4e5c0a | 2009-10-28 15:30:11 +0000 | [diff] [blame] | 39 | export objk := $(obj)/util/kconfig |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 40 | export sconfig := $(top)/util/sconfig |
| 41 | export yapps2_py := $(sconfig)/yapps2.py |
| 42 | export config_g := $(sconfig)/config.g |
| 43 | |
| 44 | |
| 45 | export KERNELVERSION := 2.3 |
| 46 | export KCONFIG_AUTOHEADER := $(obj)/config.h |
| 47 | export KCONFIG_AUTOCONFIG := $(obj)/auto.conf |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 48 | |
| 49 | CONFIG_SHELL := sh |
| 50 | KBUILD_DEFCONFIG := configs/defconfig |
| 51 | UNAME_RELEASE := $(shell uname -r) |
| 52 | HAVE_DOTCONFIG := $(wildcard .config) |
| 53 | MAKEFLAGS += -rR --no-print-directory |
| 54 | |
| 55 | # Make is silent per default, but 'make V=1' will show all compiler calls. |
Patrick Georgi | 2b7418e | 2009-08-25 19:38:46 +0000 | [diff] [blame] | 56 | Q:=@ |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 57 | ifneq ($(V),1) |
Patrick Georgi | 2b7418e | 2009-08-25 19:38:46 +0000 | [diff] [blame] | 58 | ifneq ($(Q),) |
| 59 | .SILENT: |
| 60 | endif |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 61 | endif |
| 62 | |
| 63 | CPP:= $(CC) -x assembler-with-cpp -DASSEMBLY -E |
| 64 | HOSTCC = gcc |
| 65 | HOSTCXX = g++ |
| 66 | HOSTCFLAGS := -I$(srck) -I$(objk) -g |
| 67 | HOSTCXXFLAGS := -I$(srck) -I$(objk) |
Harald Gutmann | dc4bb0d | 2009-08-26 15:35:36 +0000 | [diff] [blame] | 68 | LIBGCC_FILE_NAME := $(shell $(CC) -print-libgcc-file-name) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 69 | |
| 70 | DESTDIR = /opt |
| 71 | |
| 72 | DOXYGEN := doxygen |
| 73 | DOXYGEN_OUTPUT_DIR := doxygen |
| 74 | |
| 75 | ifeq ($(strip $(HAVE_DOTCONFIG)),) |
| 76 | |
| 77 | all: config |
| 78 | |
| 79 | else |
| 80 | |
| 81 | include $(top)/.config |
| 82 | |
| 83 | ARCHDIR-$(CONFIG_ARCH_X86) := i386 |
| 84 | ARCHDIR-$(CONFIG_ARCH_POWERPC) := ppc |
| 85 | |
| 86 | MAINBOARDDIR=$(shell echo $(CONFIG_MAINBOARD_DIR)) |
| 87 | export MAINBOARDDIR |
| 88 | |
| 89 | PLATFORM-y += src/arch/$(ARCHDIR-y) src/cpu src/mainboard/$(MAINBOARDDIR) |
| 90 | TARGETS-y := |
| 91 | |
| 92 | BUILD-y := src/lib src/boot src/console src/devices src/southbridge src/northbridge src/superio src/drivers util/x86emu |
| 93 | BUILD-y += util/cbfstool |
| 94 | BUILD-$(CONFIG_ARCH_X86) += src/pc80 |
| 95 | |
Uwe Hermann | c04be93 | 2009-10-05 13:55:28 +0000 | [diff] [blame] | 96 | ifneq ($(CONFIG_LOCALVERSION),"") |
| 97 | COREBOOT_EXTRA_VERSION := -$(shell echo $(CONFIG_LOCALVERSION)) |
| 98 | endif |
| 99 | |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 100 | # The primary target needs to be here before we include the |
| 101 | # other files |
| 102 | |
| 103 | all: coreboot |
| 104 | |
| 105 | |
| 106 | ####################################################################### |
| 107 | # Build the tools |
| 108 | |
| 109 | CBFSTOOL:=$(obj)/util/cbfstool/cbfstool |
| 110 | |
| 111 | $(obj)/mainboard/$(MAINBOARDDIR)/config.py: $(yapps2_py) $(config_g) |
Patrick Georgi | 2b7418e | 2009-08-25 19:38:46 +0000 | [diff] [blame] | 112 | mkdir -p $(obj)/mainboard/$(MAINBOARDDIR) |
| 113 | python $(yapps2_py) $(config_g) $(obj)/mainboard/$(MAINBOARDDIR)/config.py |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 114 | |
| 115 | |
| 116 | # needed objects that every mainboard uses |
| 117 | # Creation of these is architecture and mainboard independent |
Myles Watson | ed03556 | 2009-09-22 21:29:32 +0000 | [diff] [blame] | 118 | $(obj)/mainboard/$(MAINBOARDDIR)/static.c: $(src)/mainboard/$(MAINBOARDDIR)/devicetree.cb $(obj)/mainboard/$(MAINBOARDDIR)/config.py |
Patrick Georgi | 2b7418e | 2009-08-25 19:38:46 +0000 | [diff] [blame] | 119 | mkdir -p $(obj)/mainboard/$(MAINBOARDDIR) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 120 | (cd $(obj)/mainboard/$(MAINBOARDDIR) ; PYTHONPATH=$(top)/util/sconfig export PYTHONPATH; python config.py $(MAINBOARDDIR) $(top) $(obj)/mainboard/$(MAINBOARDDIR)) |
| 121 | |
| 122 | $(obj)/mainboard/$(MAINBOARDDIR)/static.o: $(obj)/mainboard/$(MAINBOARDDIR)/static.c |
| 123 | # |
| 124 | |
| 125 | objs:=$(obj)/mainboard/$(MAINBOARDDIR)/static.o |
| 126 | initobjs:= |
| 127 | drivers:= |
| 128 | smmobjs:= |
| 129 | crt0s:= |
| 130 | ldscripts:= |
| 131 | types:=obj initobj driver smmobj |
| 132 | src_types:=crt0 ldscript |
| 133 | includemakefiles=$(foreach type,$(2), $(eval $(type)-y:=)) $(eval subdirs-y:=) $(eval include $(1)) $(if $(strip $(3)),$(foreach type,$(2),$(eval $(type)s+=$$(patsubst src/%,$(obj)/%,$$(addprefix $(dir $(1)),$$($(type)-y)))))) $(eval subdirs+=$$(subst $(PWD)/,,$$(abspath $$(addprefix $(dir $(1)),$$(subdirs-y))))) |
| 134 | evaluate_subdirs=$(eval cursubdirs:=$(subdirs)) $(eval subdirs:=) $(foreach dir,$(cursubdirs),$(eval $(call includemakefiles,$(dir)/Makefile.inc,$(types) $(src_types),$(1)))) $(if $(subdirs),$(eval $(call evaluate_subdirs, $(1)))) |
| 135 | |
| 136 | # collect all object files eligible for building |
| 137 | subdirs:=$(PLATFORM-y) $(BUILD-y) |
| 138 | $(eval $(call evaluate_subdirs, modify)) |
| 139 | |
| 140 | allobjs:=$(foreach var, $(addsuffix s,$(types)), $($(var))) |
| 141 | alldirs:=$(sort $(abspath $(dir $(allobjs)))) |
| 142 | source_with_ext=$(patsubst $(obj)/%.o,src/%.$(1),$(allobjs)) |
| 143 | allsrc=$(wildcard $(call source_with_ext,c) $(call source_with_ext,S)) |
| 144 | |
| 145 | POST_EVALUATION:=y |
| 146 | |
| 147 | # fetch rules (protected in POST_EVALUATION) that rely on the variables filled above |
| 148 | subdirs:=$(PLATFORM-y) $(BUILD-y) |
| 149 | $(eval $(call evaluate_subdirs)) |
| 150 | |
| 151 | |
Patrick Georgi | 88f55b2 | 2009-09-25 18:43:02 +0000 | [diff] [blame] | 152 | define c_dsl_template |
| 153 | $(obj)/$(1)%.c: src/$(1)%.dsl |
| 154 | @printf " IASL $$(subst $$(shell pwd)/,,$$(@))\n" |
| 155 | iasl -p $$(basename $$@) -tc $$< |
| 156 | perl -pi -e 's/AmlCode/AmlCode_$$(notdir $$(basename $$@))/g' $$(basename $$@).hex |
| 157 | mv $$(basename $$@).hex $$@ |
| 158 | endef |
| 159 | |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 160 | define objs_c_template |
| 161 | $(obj)/$(1)%.o: src/$(1)%.c |
Uwe Hermann | 6c73b441 | 2009-10-28 17:10:51 +0000 | [diff] [blame] | 162 | @printf " CC $$(subst $$(obj)/,,$$(@))\n" |
Patrick Georgi | 2b7418e | 2009-08-25 19:38:46 +0000 | [diff] [blame] | 163 | $(CC) -m32 $$(CFLAGS) -c -o $$@ $$< |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 164 | endef |
| 165 | |
| 166 | define objs_S_template |
| 167 | $(obj)/$(1)%.o: src/$(1)%.S |
Uwe Hermann | 6c73b441 | 2009-10-28 17:10:51 +0000 | [diff] [blame] | 168 | @printf " CC $$(subst $$(obj)/,,$$(@))\n" |
Patrick Georgi | 2b7418e | 2009-08-25 19:38:46 +0000 | [diff] [blame] | 169 | $(CC) -m32 -DASSEMBLY $$(CFLAGS) -c -o $$@ $$< |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 170 | endef |
| 171 | |
| 172 | define initobjs_c_template |
| 173 | $(obj)/$(1)%.o: src/$(1)%.c |
Uwe Hermann | 6c73b441 | 2009-10-28 17:10:51 +0000 | [diff] [blame] | 174 | @printf " CC $$(subst $$(obj)/,,$$(@))\n" |
Patrick Georgi | 2b7418e | 2009-08-25 19:38:46 +0000 | [diff] [blame] | 175 | $(CC) -m32 $$(CFLAGS) -c -o $$@ $$< |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 176 | endef |
| 177 | |
| 178 | define initobjs_S_template |
| 179 | $(obj)/$(1)%.o: src/$(1)%.S |
Uwe Hermann | 6c73b441 | 2009-10-28 17:10:51 +0000 | [diff] [blame] | 180 | @printf " CC $$(subst $$(obj)/,,$$(@))\n" |
Patrick Georgi | 2b7418e | 2009-08-25 19:38:46 +0000 | [diff] [blame] | 181 | $(CC) -m32 -DASSEMBLY $$(CFLAGS) -c -o $$@ $$< |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 182 | endef |
| 183 | |
| 184 | define drivers_c_template |
| 185 | $(obj)/$(1)%.o: src/$(1)%.c |
Uwe Hermann | 6c73b441 | 2009-10-28 17:10:51 +0000 | [diff] [blame] | 186 | @printf " CC $$(subst $$(obj)/,,$$(@))\n" |
Patrick Georgi | 2b7418e | 2009-08-25 19:38:46 +0000 | [diff] [blame] | 187 | $(CC) -m32 $$(CFLAGS) -c -o $$@ $$< |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 188 | endef |
| 189 | |
| 190 | define drivers_S_template |
| 191 | $(obj)/$(1)%.o: src/$(1)%.S |
Uwe Hermann | 6c73b441 | 2009-10-28 17:10:51 +0000 | [diff] [blame] | 192 | @printf " CC $$(subst $$(obj)/,,$$(@))\n" |
Patrick Georgi | 2b7418e | 2009-08-25 19:38:46 +0000 | [diff] [blame] | 193 | $(CC) -m32 -DASSEMBLY $$(CFLAGS) -c -o $$@ $$< |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 194 | endef |
| 195 | |
| 196 | define smmobjs_c_template |
| 197 | $(obj)/$(1)%.o: src/$(1)%.c |
Uwe Hermann | 6c73b441 | 2009-10-28 17:10:51 +0000 | [diff] [blame] | 198 | @printf " CC $$(subst $$(obj)/,,$$(@))\n" |
Patrick Georgi | 2b7418e | 2009-08-25 19:38:46 +0000 | [diff] [blame] | 199 | $(CC) -m32 $$(CFLAGS) -c -o $$@ $$< |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 200 | endef |
| 201 | |
| 202 | define smmobjs_S_template |
| 203 | $(obj)/$(1)%.o: src/$(1)%.S |
Uwe Hermann | 6c73b441 | 2009-10-28 17:10:51 +0000 | [diff] [blame] | 204 | @printf " CC $$(subst $$(obj)/,,$$(@))\n" |
Patrick Georgi | 2b7418e | 2009-08-25 19:38:46 +0000 | [diff] [blame] | 205 | $(CC) -m32 $$(CFLAGS) -c -o $$@ $$< |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 206 | endef |
| 207 | |
| 208 | usetemplate=$(foreach d,$(sort $(dir $($(1)))),$(eval $(call $(1)_$(2)_template,$(subst $(obj)/,,$(d))))) |
| 209 | usetemplate=$(foreach d,$(sort $(dir $($(1)))),$(eval $(call $(1)_$(2)_template,$(subst $(obj)/,,$(d))))) |
Patrick Georgi | 88f55b2 | 2009-09-25 18:43:02 +0000 | [diff] [blame] | 210 | $(eval $(call usetemplate,c,dsl)) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 211 | $(eval $(call usetemplate,objs,c)) |
| 212 | $(eval $(call usetemplate,objs,S)) |
| 213 | $(eval $(call usetemplate,initobjs,c)) |
| 214 | $(eval $(call usetemplate,initobjs,S)) |
| 215 | $(eval $(call usetemplate,drivers,c)) |
| 216 | $(eval $(call usetemplate,drivers,S)) |
| 217 | $(eval $(call usetemplate,smmobjs,c)) |
| 218 | $(eval $(call usetemplate,smmobjs,S)) |
| 219 | |
| 220 | printall: |
| 221 | @echo objs:=$(objs) |
| 222 | @echo initobjs:=$(initobjs) |
| 223 | @echo drivers:=$(drivers) |
| 224 | @echo smmobjs:=$(smmobjs) |
| 225 | @echo alldirs:=$(alldirs) |
| 226 | @echo allsrc=$(allsrc) |
| 227 | |
| 228 | OBJS := $(patsubst %,$(obj)/%,$(TARGETS-y)) |
| 229 | INCLUDES := -I$(top)/src -I$(top)/src/include -I$(obj) -I$(top)/src/arch/$(ARCHDIR-y)/include |
| 230 | INCLUDES += -I$(shell $(CC) -print-search-dirs | head -n 1 | cut -d' ' -f2)include |
Myles Watson | e680495 | 2009-08-28 14:36:12 +0000 | [diff] [blame] | 231 | INCLUDES += -I$(top)/util/x86emu/include |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 232 | INCLUDES += -include $(obj)/build.h |
| 233 | |
| 234 | try-run= $(shell set -e; \ |
| 235 | TMP=".$$$$.tmp"; \ |
| 236 | if ($(1)) > /dev/null 2>&1; \ |
| 237 | then echo "$(2)"; \ |
| 238 | else echo "$(3)"; \ |
| 239 | fi; rm -rf "$$TMP") |
| 240 | |
| 241 | cc-option= $(call try-run,\ |
| 242 | $(CC) $(1) -S -xc /dev/null -o "$$TMP", $(1), $(2)) |
| 243 | |
| 244 | STACKPROTECT += $(call cc-option, -fno-stack-protector,) |
| 245 | |
Patrick Georgi | 6842c02 | 2009-09-29 17:28:13 +0000 | [diff] [blame] | 246 | CFLAGS = $(STACKPROTECT) $(INCLUDES) -Os -nostdinc |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 247 | CFLAGS += -nostdlib -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes |
Uwe Hermann | c04be93 | 2009-10-05 13:55:28 +0000 | [diff] [blame] | 248 | CFLAGS += -Wwrite-strings -Wredundant-decls -Wno-trigraphs |
Patrick Georgi | 88f55b2 | 2009-09-25 18:43:02 +0000 | [diff] [blame] | 249 | CFLAGS += -Wstrict-aliasing -Wshadow |
Myles Watson | 2e67273 | 2009-11-12 16:38:03 +0000 | [diff] [blame] | 250 | ifeq ($(CONFIG_WARNINGS_ARE_ERRORS),y) |
| 251 | CFLAGS += -Werror |
| 252 | endif |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 253 | CFLAGS += -fno-common -ffreestanding -fno-builtin -fomit-frame-pointer |
| 254 | |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 255 | CBFS_COMPRESS_FLAG:=l |
Myles Watson | 422d0cb | 2009-09-23 17:48:28 +0000 | [diff] [blame] | 256 | CBFS_PAYLOAD_COMPRESS_FLAG:= |
| 257 | ifeq ($(CONFIG_COMPRESSED_PAYLOAD_LZMA),y) |
| 258 | CBFS_PAYLOAD_COMPRESS_FLAG:=l |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 259 | endif |
| 260 | |
| 261 | coreboot: prepare prepare2 $(obj)/coreboot.rom |
| 262 | |
| 263 | endif |
| 264 | |
| 265 | prepare: |
Patrick Georgi | 2b7418e | 2009-08-25 19:38:46 +0000 | [diff] [blame] | 266 | mkdir -p $(obj) |
| 267 | mkdir -p $(obj)/util/kconfig/lxdialog |
| 268 | test -n "$(alldirs)" && mkdir -p $(alldirs) || true |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 269 | |
| 270 | prepare2: |
Uwe Hermann | 6c73b441 | 2009-10-28 17:10:51 +0000 | [diff] [blame] | 271 | @printf " GEN build.h\n" |
Patrick Georgi | 2b7418e | 2009-08-25 19:38:46 +0000 | [diff] [blame] | 272 | printf "#define COREBOOT_VERSION \"$(KERNELVERSION)\"\n" > $(obj)/build.h |
| 273 | printf "#define COREBOOT_EXTRA_VERSION \"$(COREBOOT_EXTRA_VERSION)\"\n" >> $(obj)/build.h |
Patrick Georgi | 2b7418e | 2009-08-25 19:38:46 +0000 | [diff] [blame] | 274 | printf "#define COREBOOT_BUILD \"`LANG= date`\"\n" >> $(obj)/build.h |
| 275 | printf "\n" >> $(obj)/build.h |
| 276 | printf "#define COREBOOT_COMPILER \"$(shell LANG= $(CC) --version | head -n1)\"\n" >> $(obj)/build.h |
| 277 | printf "#define COREBOOT_ASSEMBLER \"$(shell LANG= $(AS) --version | head -n1)\"\n" >> $(obj)/build.h |
| 278 | printf "#define COREBOOT_LINKER \"$(shell LANG= $(LD) --version | head -n1)\"\n" >> $(obj)/build.h |
| 279 | printf "#define COREBOOT_COMPILE_TIME \"`LANG= date +%T`\"\n" >> $(obj)/build.h |
| 280 | printf "#define COREBOOT_COMPILE_BY \"$(shell PATH=$$PATH:/usr/ucb whoami)\"\n" >> $(obj)/build.h |
| 281 | printf "#define COREBOOT_COMPILE_HOST \"$(shell hostname)\"\n" >> $(obj)/build.h |
| 282 | printf "#define COREBOOT_COMPILE_DOMAIN \"$(shell test `uname -s` = "Linux" && dnsdomainname || domainname)\"\n" >> $(obj)/build.h |
| 283 | printf "#include \"config.h\"\n" >> $(obj)/build.h |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 284 | |
| 285 | doxy: doxygen |
| 286 | doxygen: |
Patrick Georgi | 2b7418e | 2009-08-25 19:38:46 +0000 | [diff] [blame] | 287 | $(DOXYGEN) Doxyfile |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 288 | |
| 289 | doxyclean: doxygen-clean |
| 290 | doxygen-clean: |
Patrick Georgi | 2b7418e | 2009-08-25 19:38:46 +0000 | [diff] [blame] | 291 | rm -rf $(DOXYGEN_OUTPUT_DIR) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 292 | |
| 293 | clean: doxygen-clean |
Myles Watson | 1af297c | 2010-01-06 16:59:18 +0000 | [diff] [blame] | 294 | rm -f $(allobjs) $(obj)/coreboot* .xcompile |
Patrick Georgi | 9341acd | 2009-12-23 12:52:56 +0000 | [diff] [blame] | 295 | rm -rf $(obj)/bootblock* $(obj)/romstage* $(obj)/location.* |
Myles Watson | d4e5c0a | 2009-10-28 15:30:11 +0000 | [diff] [blame] | 296 | rm -f $(obj)/option_table.* $(obj)/crt0_includes.h $(obj)/ldscript |
Patrick Georgi | 2b7418e | 2009-08-25 19:38:46 +0000 | [diff] [blame] | 297 | rm -f $(obj)/mainboard/$(MAINBOARDDIR)/static.c $(obj)/mainboard/$(MAINBOARDDIR)/config.py $(obj)/mainboard/$(MAINBOARDDIR)/static.dot |
| 298 | rm -f $(obj)/mainboard/$(MAINBOARDDIR)/auto.inc $(obj)/mainboard/$(MAINBOARDDIR)/crt0.s $(obj)/mainboard/$(MAINBOARDDIR)/crt0.disasm |
| 299 | rmdir -p $(alldirs) 2>/dev/null >/dev/null || true |
Uwe Hermann | 6c73b441 | 2009-10-28 17:10:51 +0000 | [diff] [blame] | 300 | $(MAKE) -C util/sconfig clean |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 301 | |
| 302 | distclean: clean |
Myles Watson | 1af297c | 2010-01-06 16:59:18 +0000 | [diff] [blame] | 303 | rm -rf $(obj) |
Patrick Georgi | 2b7418e | 2009-08-25 19:38:46 +0000 | [diff] [blame] | 304 | rm -f .config .config.old ..config.tmp .kconfig.d .tmpconfig* |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 305 | |
| 306 | update: |
Myles Watson | d4e5c0a | 2009-10-28 15:30:11 +0000 | [diff] [blame] | 307 | dongle.py -c /dev/term/1 $(obj)/coreboot.rom EOF |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 308 | |
| 309 | # This include must come _before_ the pattern rules below! |
| 310 | # Order _does_ matter for pattern rules. |
| 311 | include util/kconfig/Makefile |
| 312 | |
| 313 | $(obj)/ldoptions: $(obj)/config.h |
Patrick Georgi | 26774f2 | 2009-11-21 19:54:02 +0000 | [diff] [blame] | 314 | awk '/^#define ([^"])* ([^"])*$$/ {gsub("\\r","",$$3); print $$2 " = " $$3 ";";}' $< > $@ |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 315 | |
Patrick Georgi | 26774f2 | 2009-11-21 19:54:02 +0000 | [diff] [blame] | 316 | _OS=$(shell uname -s |cut -c-7) |
| 317 | STACK= |
| 318 | ifeq ($(_OS),MINGW32) |
| 319 | STACK=-Wl,--stack,16384000 |
| 320 | endif |
| 321 | ifeq ($(_OS),CYGWIN_) |
| 322 | STACK=-Wl,--stack,16384000 |
| 323 | endif |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 324 | $(obj)/romcc: $(top)/util/romcc/romcc.c |
Uwe Hermann | 6c73b441 | 2009-10-28 17:10:51 +0000 | [diff] [blame] | 325 | @printf " HOSTCC $(subst $(obj)/,,$(@)) (this may take a while)\n" |
Patrick Georgi | 26774f2 | 2009-11-21 19:54:02 +0000 | [diff] [blame] | 326 | $(HOSTCC) -g -O2 $(STACK) -Wall -o $@ $< |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 327 | |
| 328 | .PHONY: $(PHONY) prepare prepare2 clean distclean doxygen doxy coreboot |
| 329 | |