X-Git-Url: https://git.kernelconcepts.de/?a=blobdiff_plain;f=config.mk;h=37d61a0c86844df7e124515b3d63d94a88ebc1ae;hb=7e14fc65368cbd2861b1207453da55a4fc7b3f81;hp=2c6cfb4b3ce8416ff696dece936d96d4787783e2;hpb=0377dca227cc883bbaacbe1c442cef5bd6b0e121;p=karo-tx-uboot.git diff --git a/config.mk b/config.mk index 2c6cfb4b3c..37d61a0c86 100644 --- a/config.mk +++ b/config.mk @@ -1,5 +1,5 @@ # -# (C) Copyright 2000 +# (C) Copyright 2000-2006 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. # # See file CREDITS for list of people who contributed to this @@ -23,6 +23,22 @@ ######################################################################### +ifneq ($(OBJTREE),$(SRCTREE)) +ifeq ($(CURDIR),$(SRCTREE)) +dir := +else +dir := $(subst $(SRCTREE)/,,$(CURDIR)) +endif + +obj := $(if $(dir),$(OBJTREE)/$(dir)/,$(OBJTREE)/) +src := $(if $(dir),$(SRCTREE)/$(dir)/,$(SRCTREE)/) + +$(shell mkdir -p $(obj)) +else +obj := +src := +endif + # clean the slate ... PLATFORM_RELFLAGS = PLATFORM_CPPFLAGS = @@ -107,22 +123,36 @@ OBJCOPY = $(CROSS_COMPILE)objcopy OBJDUMP = $(CROSS_COMPILE)objdump RANLIB = $(CROSS_COMPILE)RANLIB +ifneq (,$(findstring s,$(MAKEFLAGS))) +ARFLAGS = cr +else +ARFLAGS = crv +endif RELFLAGS= $(PLATFORM_RELFLAGS) -DBGFLAGS= -g #-DDEBUG +DBGFLAGS= -g # -DDEBUG OPTFLAGS= -Os #-fomit-frame-pointer ifndef LDSCRIPT #LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug +ifeq ($(CONFIG_NAND_U_BOOT),y) +LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds +else LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds endif +endif OBJCFLAGS += --gap-fill=0xff gccincdir := $(shell $(CC) -print-file-name=include) CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS) \ -D__KERNEL__ -DTEXT_BASE=$(TEXT_BASE) \ - -I$(TOPDIR)/include \ - -fno-builtin -ffreestanding -nostdinc -isystem \ - $(gccincdir) -pipe $(PLATFORM_CPPFLAGS) + +ifneq ($(OBJTREE),$(SRCTREE)) +CPPFLAGS += -I$(OBJTREE)/include2 -I$(OBJTREE)/include +endif + +CPPFLAGS += -I$(TOPDIR)/include +CPPFLAGS += -fno-builtin -ffreestanding -nostdinc \ + -isystem $(gccincdir) -pipe $(PLATFORM_CPPFLAGS) ifdef BUILD_TAG CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes \ @@ -131,10 +161,6 @@ else CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes endif -ifdef WILD_WILD_WEST -CFLAGS := $(CFLAGS) -Werror -endif - # avoid trigraph warnings while parsing pci.h (produced by NIOS gcc-2.9) # this option have to be placed behind -Wall -- that's why it is here ifeq ($(ARCH),nios) @@ -143,7 +169,17 @@ CFLAGS := $(CPPFLAGS) -Wall -Wno-trigraphs endif endif -AFLAGS_DEBUG := -Wa,-gstabs +# $(CPPFLAGS) sets -g, which causes gcc to pass a suitable -g +# option to the assembler. +AFLAGS_DEBUG := + +# turn jbsr into jsr for m68k +ifeq ($(ARCH),m68k) +ifeq ($(findstring 3.4,$(shell $(CC) --version)),3.4) +AFLAGS_DEBUG := -Wa,-gstabs,-S +endif +endif + AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS) LDFLAGS += -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS) @@ -184,11 +220,23 @@ export TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS ######################################################################### +ifndef REMOTE_BUILD + %.s: %.S - $(CPP) $(AFLAGS) -o $@ $(CURDIR)/$< + $(CPP) $(AFLAGS) -o $@ $< %.o: %.S - $(CC) $(AFLAGS) -c -o $@ $(CURDIR)/$< + $(CC) $(AFLAGS) -c -o $@ $< %.o: %.c $(CC) $(CFLAGS) -c -o $@ $< +else + +$(obj)%.s: %.S + $(CPP) $(AFLAGS) -o $@ $< +$(obj)%.o: %.S + $(CC) $(AFLAGS) -c -o $@ $< +$(obj)%.o: %.c + $(CC) $(CFLAGS) -c -o $@ $< +endif + #########################################################################