barebox/arch/x86/Makefile
Loïc Minier 4e26fba680 Only pass -P to cpp when generating ld scripts
When building sandbox with ccache, one would hit warnings such as:
    warning: 'struct mmsghdr' declared inside parameter list
on random files; a way to reproduce this issue is to build a simple
file doing just:
    #include <sys/socket.h>

    int main(void) {
        return 0;
    }

    gcc -Wall -P -c -o foo foo.c

But actually the -P flag is only useful when generating non-C files,
such as linker scripts in the case of barebox.  Removing the -P flag
from all the gcc invocations, except when generating .lds files makes
the warning go away.  It turns out that this is what
linux/scripts/Makefile.build also does nowadays.

Signed-off-by: Loïc Minier <loic.minier@linaro.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-10-18 09:18:41 +02:00

53 lines
1,013 B
Makefile

CPPFLAGS += -D__X86__ -fno-strict-aliasing
board-y := x86_generic
machine-y := i386
TEXT_BASE = $(CONFIG_TEXT_BASE)
CPPFLAGS += -march=i386 -m32 -DTEXT_BASE=$(TEXT_BASE)
LDFLAGS += -m elf_i386
ifndef CONFIG_MODULES
# Add cleanup flags
CPPFLAGS += -fdata-sections -ffunction-sections
LDFLAGS_uboot += -static --gc-sections
endif
all: $(KBUILD_IMAGE)
machdirs := $(patsubst %,arch/x86/mach-%/,$(machine-y))
ifeq ($(KBUILD_SRC),)
CPPFLAGS += $(patsubst %,-I%include,$(machdirs))
else
CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(machdirs))
endif
ifneq ($(board-y),)
BOARD := arch/x86/boards/$(board-y)/
else
BOARD :=
endif
ifneq ($(machine-y),)
MACH := arch/x86/mach-$(machine-y)/
else
MACH :=
endif
common-y += $(BOARD) $(MACH)
common-y += arch/x86/lib/
common-y += arch/x86/boot/
# arch/x86/cpu/
lds-$(CONFIG_GENERIC_LINKER_SCRIPT) := arch/x86/lib/barebox.lds
lds-$(CONFIG_BOARD_LINKER_SCRIPT) := $(BOARD)/barebox.lds
CLEAN_FILES += arch/x86/lib/barebox.lds barebox.map barebox.S