IEI Kino added to IEI mainboard Kconfig. I missed this in r5812
[coreboot.git] / Makefile
index f9b5c8b8dd6809da5652690ebfa3761350853dbb..247daccc01fc3f9e6bd7e0a4bce3c5e7955d4b24 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -69,8 +69,21 @@ LIBGCC_FILE_NAME := $(shell test -r `$(CC) -print-libgcc-file-name` && $(CC) -pr
 DOXYGEN := doxygen
 DOXYGEN_OUTPUT_DIR := doxygen
 
+# Three cases where we don't need fully populated $(obj) lists:
+# 1. when no .config exists
+# 2. when make config (in any flavour) is run
+# 3. when make distclean is run
+# Don't waste time on reading all Makefile.incs in these cases
 ifeq ($(strip $(HAVE_DOTCONFIG)),)
+NOCOMPILE:=1
+endif
+ifneq ($(MAKECMDGOALS),)
+ifneq ($(filter %config distclean,$(MAKECMDGOALS)),)
+NOCOMPILE:=1
+endif
+endif
 
+ifeq ($(NOCOMPILE),1)
 all: config
 
 else
@@ -148,16 +161,16 @@ $(obj)/config.h:
 
 CBFSTOOL:=$(objutil)/cbfstool/cbfstool
 
-# needed objects that every mainboard uses 
+# needed objects that every mainboard uses
 # Creation of these is architecture and mainboard independent
 $(obj)/mainboard/$(MAINBOARDDIR)/static.c: $(src)/mainboard/$(MAINBOARDDIR)/devicetree.cb  $(objutil)/sconfig/sconfig
        @printf "    SCONFIG    $(subst $(src)/,,$(<))\n"
        mkdir -p $(obj)/mainboard/$(MAINBOARDDIR)
        $(objutil)/sconfig/sconfig $(MAINBOARDDIR) $(obj)/mainboard/$(MAINBOARDDIR)
 
-$(objutil)/%.o: $(objutil)/%.c $(obj)/config.h
+$(objutil)/%.o: $(objutil)/%.c
        @printf "    HOSTCC     $(subst $(objutil)/,,$(@))\n"
-       $(HOSTCC) -MMD $(HOSTCFLAGS) -c -o $@ $<
+       $(HOSTCC) -MMD -I$(subst $(objutil)/,util/,$(dir $<)) -I$(dir $<) $(HOSTCFLAGS) -c -o $@ $<
 
 $(obj)/%.o: $(obj)/%.c $(obj)/config.h
        @printf "    CC         $(subst $(obj)/,,$(@))\n"
@@ -213,6 +226,8 @@ $(obj)/$(1)%.o: src/$(1)%.asl
        iasl -p $$(basename $$@) -tc $$(basename $$@).asl
        mv $$(basename $$@).hex $$(basename $$@).c
        $(CC) $$(CFLAGS) $$(if $$(subst dsdt,,$$(basename $$(notdir $$@))), -DAmlCode=AmlCode_$$(basename $$(notdir $$@))) -c -o $$@ $$(basename $$@).c
+       # keep %.o: %.c rule from catching the temporary .c file after a make clean
+       mv $$(basename $$@).c $$(basename $$@).hex
 endef
 
 # macro to define template macros that are used by use_template macro
@@ -267,14 +282,14 @@ printcrt0s:
        @echo ldscripts=$(ldscripts)
 
 OBJS     := $(patsubst %,$(obj)/%,$(TARGETS-y))
-INCLUDES := -Isrc -Isrc/include -I$(obj) -Isrc/arch/$(ARCHDIR-y)/include 
+INCLUDES := -Isrc -Isrc/include -I$(obj) -Isrc/arch/$(ARCHDIR-y)/include
 INCLUDES += -Isrc/devices/oprom/include
 # abspath is a workaround for romcc
 INCLUDES += -include $(abspath $(obj)/config.h)
 
 CFLAGS = $(INCLUDES) -Os -nostdinc -pipe
 CFLAGS += -nostdlib -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes
-CFLAGS += -Wwrite-strings -Wredundant-decls -Wno-trigraphs 
+CFLAGS += -Wwrite-strings -Wredundant-decls -Wno-trigraphs
 CFLAGS += -Wstrict-aliasing -Wshadow
 ifeq ($(CONFIG_WARNINGS_ARE_ERRORS),y)
 CFLAGS += -Werror
@@ -289,14 +304,11 @@ CBFS_PAYLOAD_COMPRESS_FLAG:=l
 CBFS_PAYLOAD_COMPRESS_NAME:=LZMA
 endif
 
-coreboot: prepare $(obj)/coreboot.rom
+coreboot: $(obj)/coreboot.rom
 
 endif
 
-prepare:
-       mkdir -p $(obj)
-       mkdir -p $(objutil)/kconfig/lxdialog $(objutil)/cbfstool $(objutil)/romcc $(objutil)/options
-       test -n "$(alldirs)" && mkdir -p $(alldirs) || true
+$(shell mkdir -p $(obj) $(objutil)/kconfig/lxdialog $(objutil)/cbfstool $(objutil)/romcc $(objutil)/options $(alldirs))
 
 $(obj)/build.h: .xcompile
        @printf "    GEN        build.h\n"
@@ -318,6 +330,9 @@ $(obj)/build.h: .xcompile
        printf "#endif\n" >> $(obj)/build.ht
        mv $(obj)/build.ht $(obj)/build.h
 
+cscope:
+       cscope -bR
+
 doxy: doxygen
 doxygen:
        $(DOXYGEN) documentation/Doxyfile.coreboot
@@ -342,9 +357,12 @@ clean-for-update: doxygen-clean
 clean: clean-for-update
        rm -f $(obj)/coreboot* .ccwrap
 
-distclean: clean
+clean-cscope:
+       rm -f cscope.out
+
+distclean: clean-cscope
        rm -rf $(obj)
-       rm -f .config .config.old ..config.tmp .kconfig.d .tmpconfig*
+       rm -f .config .config.old ..config.tmp .kconfig.d .tmpconfig* .ccwrap .xcompile
 
 update:
        dongle.py -c /dev/term/1 $(obj)/coreboot.rom EOF
@@ -356,19 +374,20 @@ include util/kconfig/Makefile
 $(obj)/ldoptions: $(obj)/config.h
        awk '/^#define ([^"])* ([^"])*$$/ {gsub("\\r","",$$3); print $$2 " = " $$3 ";";}' $< > $@
 
-_OS=$(shell uname -s |cut -c-7)
+_WINCHECK=$(shell uname -o 2> /dev/null)
 STACK=
-ifeq ($(_OS),MINGW32)
+ifeq ($(_WINCHECK),Msys)
        STACK=-Wl,--stack,16384000
 endif
-ifeq ($(_OS),CYGWIN_)
+ifeq ($(_WINCHECK),Cygwin)
        STACK=-Wl,--stack,16384000
 endif
+
 $(objutil)/romcc/romcc: $(top)/util/romcc/romcc.c
        @printf "    HOSTCC     $(subst $(obj)/,,$(@)) (this may take a while)\n"
        @# Note: Adding -O2 here might cause problems. For details see:
        @# http://www.coreboot.org/pipermail/coreboot/2010-February/055825.html
        $(HOSTCC) -g $(STACK) -Wall -o $@ $<
 
-.PHONY: $(PHONY) prepare clean distclean doxygen doxy coreboot .xcompile
+.PHONY: $(PHONY) clean clean-cscope cscope distclean doxygen doxy coreboot .xcompile