From 17ac04f28467cf357985f527dd5e1f97e2c7f411 Mon Sep 17 00:00:00 2001 From: lindnermarek Date: Fri, 5 Jun 2009 12:33:08 +0000 Subject: [PATCH] [inflash] switch all makefiles to CROSS_COMPILE --- flash-tool/Makefile | 15 ++++++++++----- flash-tool/device_stage1/Makefile | 4 +++- flash-tool/device_stage2/Makefile | 16 ++++++++++------ 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/flash-tool/Makefile b/flash-tool/Makefile index 106f1e0..500f8ed 100644 --- a/flash-tool/Makefile +++ b/flash-tool/Makefile @@ -32,17 +32,22 @@ endif STAGE1_PATH = ./device_stage1 STAGE2_PATH = ./device_stage2 +CROSS_COMPILE ?= mipsel-linux- + CC = gcc CFLAGS += -pedantic -Wall -W -O1 -g3 -std=gnu99 LDFLAGS += -lusb -lconfuse BINARY_NAME = inflash +TARGETS = $(BINARY_NAME) stage1 stage2 SRC_C= main.c ingenic_cfg.c ingenic_usb.c cmd.c command_line.c SRC_H= ingenic_cfg.h ingenic_usb.h usb_boot_defines.h \ command_line.h cmd.h config.h SRC_O= $(SRC_C:.c=.o) -$(BINARY_NAME): $(SRC_O) $(SRC_H) Makefile stage1 stage2 +default: $(TARGETS) + +$(BINARY_NAME): $(SRC_O) $(SRC_H) Makefile $(Q_LD)$(CC) -o $@ $(SRC_O) $(LDFLAGS) .c.o: @@ -51,13 +56,13 @@ $(BINARY_NAME): $(SRC_O) $(SRC_H) Makefile stage1 stage2 # for the device stage stage1: - make -C $(STAGE1_PATH) + make CROSS_COMPILE=$(CROSS_COMPILE) -C $(STAGE1_PATH) stage2: - make -C $(STAGE2_PATH) + make CROSS_COMPILE=$(CROSS_COMPILE) -C $(STAGE2_PATH) clean: - make clean -C $(STAGE1_PATH) - make clean -C $(STAGE2_PATH) + make CROSS_COMPILE=$(CROSS_COMPILE) -C $(STAGE1_PATH) clean + make CROSS_COMPILE=$(CROSS_COMPILE) -C $(STAGE2_PATH) clean rm -f $(BINARY_NAME) *.o *~ rm -f `find . -name '*.d' -print` diff --git a/flash-tool/device_stage1/Makefile b/flash-tool/device_stage1/Makefile index b7ce3af..2d8cd02 100644 --- a/flash-tool/device_stage1/Makefile +++ b/flash-tool/device_stage1/Makefile @@ -20,7 +20,9 @@ FLASH_TOOL_PATH = .. -CROSS_COMPILE ?= mipsel-linux- +ifeq ($(CROSS_COMPILE),) +$(error CROSS_COMPILE variable not set) +endif CFLAGS := -O2 -mips32 -fno-pic -mno-abicalls -I.. LDFLAGS := -nostdlib -EL -T target.ld diff --git a/flash-tool/device_stage2/Makefile b/flash-tool/device_stage2/Makefile index d8d0fbb..779422c 100644 --- a/flash-tool/device_stage2/Makefile +++ b/flash-tool/device_stage2/Makefile @@ -9,12 +9,16 @@ FLASH_TOOL_PATH = .. -CC := mipsel-linux-gcc -AR := mipsel-linux-ar rcsv -LD := mipsel-linux-ld -OBJCOPY := mipsel-linux-objcopy -NM := mipsel-linux-nm -OBJDUMP := mipsel-linux-objdump +ifeq ($(CROSS_COMPILE),) +$(error CROSS_COMPILE variable not set) +endif + +CC := $(CROSS_COMPILE)gcc +AR := $(CROSS_COMPILE)ar rcsv +LD := $(CROSS_COMPILE)ld +OBJCOPY := $(CROSS_COMPILE)objcopy +NM := $(CROSS_COMPILE)nm +OBJDUMP := $(CROSS_COMPILE)objdump CFLAGS := -mips32 -O2 -FPIC \ -fno-exceptions -ffunction-sections \