Changeset 758 for trunk/softs/tsar_boot/Makefile
- Timestamp:
- Jul 24, 2014, 3:19:18 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/softs/tsar_boot/Makefile
r726 r758 1 # let the user have a default configuration (ie for PLATFORM_DIR and SOCLIB)1 # let the user have a default configuration (ie for PLATFORM_DIR) 2 2 -include ./build.mk 3 3 4 USE_DT ?= 1 5 DTS ?= platform.dts 6 4 7 MAKECMDGOALS ?= none 5 RAMDISK ?= 06 SOCLIB ?= 07 8 8 9 ifneq ($(MAKECMDGOALS),$(filter $(MAKECMDGOALS),clean distclean clean-doc doc)) … … 10 11 $(error please define PLATFORM_DIR 'make PLATFORM_DIR=foo') 11 12 else 12 ifeq ($(SOCLIB),1) 13 ifeq ($(RAMDISK),1) 14 DEFS+= -DUSE_RDK 15 else 16 DEFS+= -DUSE_BDV 17 endif 18 DTS=platform_soclib.dts 19 $(info Make for $(PLATFORM_DIR), SocLib variant) 20 else 21 DEFS+= -DUSE_SPI 22 DTS=platform_fpga.dts 23 $(info Make for $(PLATFORM_DIR), FPGA variant) 24 endif 13 $(info Make for $(PLATFORM_DIR)) 25 14 endif 15 endif 16 17 # Platform clock frequency (in KHz) 18 ifdef SYSTEM_CLK 19 DEFS := "-DRESET_SYSTEM_CLK=$(SYSTEM_CLK)" 26 20 endif 27 21 … … 30 24 AS := mipsel-unknown-elf-as 31 25 DU := mipsel-unknown-elf-objdump 26 AR := mipsel-unknown-elf-ar 32 27 RM := rm -rf 33 28 ECHO := @echo … … 38 33 39 34 BUILD_DIR := build 40 SRCS_DIR := src41 INCS_DIR := include42 35 43 36 # ============================================================================= … … 45 38 # ============================================================================= 46 39 47 INCLUDE += -I. -I$(INCS_DIR) -I$(PLATFORM_DIR) 48 49 # ============================================================================= 50 # Paths of sources in another directories 51 # ============================================================================= 52 53 VPATH += $(SRCS_DIR) 54 VPATH += $(PLATFORM_DIR) 40 INCLUDE += -I. -Iinclude -Idrivers -I$(PLATFORM_DIR) 55 41 56 42 # ============================================================================= … … 58 44 # ============================================================================= 59 45 46 VPATH += src 47 60 48 CFLAGS := -Wall \ 61 49 -mno-gpopt \ 62 50 -ffreestanding \ 63 51 -fomit-frame-pointer \ 64 -mips32 \ 65 -ggdb \ 66 -mlong-calls \ 52 -march=mips32 \ 67 53 -O2 \ 68 54 -Werror 69 55 70 56 C_SRCS := reset_elf_loader.c \ 57 reset_utils.c \ 58 reset_exception.c \ 71 59 reset_ioc.c \ 72 reset_utils.c \ 73 reset_tty.c \ 74 reset_exception.c 75 76 ifeq ($(SOCLIB),0) 77 C_SRCS += sdcard.c spi.c 78 endif 60 version.c 79 61 80 62 S_SRCS := reset.S 81 63 82 OBJS := $( subst .c,.o, $(notdir $(C_SRCS)))83 OBJS += $(subst .S,.o, $(notdir $(S_SRCS))) 84 OBJS := $(addprefix $(BUILD_DIR)/, $(OBJS))64 OBJS := $(addprefix $(BUILD_DIR)/,\ 65 $(subst .c,.o, $(notdir $(C_SRCS))) \ 66 $(subst .S,.o, $(notdir $(S_SRCS)))) 85 67 86 68 TARGET := preloader.elf 87 69 88 USE_DT ?= 1 70 # ============================================================================= 71 # Drivers library 72 # ============================================================================= 73 74 VPATH += drivers 75 76 DRV_SRCS := reset_tty.c \ 77 reset_inval.c \ 78 reset_sdc.c \ 79 reset_bdv.c \ 80 reset_rdk.c \ 81 sdcard.c \ 82 spi.c 83 84 DRV_OBJS := $(addprefix $(BUILD_DIR)/,\ 85 $(subst .c,.o, $(notdir $(DRV_SRCS)))) 86 87 DRV_LIB := libdrivers.a 88 89 # ============================================================================= 90 # Makefile rules 91 # ============================================================================= 92 93 VPATH += $(BUILD_DIR) 89 94 90 95 all: $(TARGET) 91 96 92 $(BUILD_DIR)/version.o: $(BUILD_DIR) $(OBJS) VERSION version.sh 93 $(ECHO) "[version.sh]" 94 ./version.sh > $(BUILD_DIR)/version.c 95 $(ECHO) "[ CC ] $(BUILD_DIR)/version.c" 96 $(CC) $(DEFS) $(CFLAGS) $(INCLUDE) -c -o $@ $(BUILD_DIR)/version.c 97 $(BUILD_DIR)/$(DRV_LIB): $(BUILD_DIR) $(DRV_OBJS) 98 $(ECHO) "[ AR ] $(notdir $@)" 99 $(AR) rcs $@ $(DRV_OBJS) 100 101 $(BUILD_DIR)/version.o: $(BUILD_DIR)/version.c 102 $(ECHO) "[ CC ] $(notdir $<)" 103 $(CC) $(DEFS) $(CFLAGS) $(INCLUDE) -c -o $@ $< 97 104 $(DU) -D $@ > $@.txt 98 105 99 $(TARGET): $(BUILD_DIR) $(BUILD_DIR)/version.o $(OBJS) $(PLATFORM_DIR)/ldscript $(BUILD_DIR)/platform.ld 106 $(BUILD_DIR)/version.c: $(BUILD_DIR) version.sh VERSION 107 $(ECHO) "[version.sh]" 108 ./version.sh > $@ 109 110 $(TARGET): $(BUILD_DIR) $(OBJS) $(PLATFORM_DIR)/ldscript $(BUILD_DIR)/platform.ld $(BUILD_DIR)/$(DRV_LIB) 100 111 $(ECHO) "[ LD ] $@" 101 $(LD) -o $@ -T $(PLATFORM_DIR)/ldscript $(OBJS) $(BUILD_DIR)/version.o112 $(LD) -o $@ -T $(PLATFORM_DIR)/ldscript $(OBJS) -L$(BUILD_DIR) -ldrivers 102 113 $(DU) -D $@ > $@.txt 103 114 … … 112 123 endif 113 124 114 $(BUILD_DIR)/platform.dtb: $( DTS)125 $(BUILD_DIR)/platform.dtb: $(PLATFORM_DIR)/$(DTS) 115 126 $(ECHO) "[ DTC ] $(notdir $<)" 116 127 ${DTC} -O dtb -o $@ $< &> /dev/null
Note: See TracChangeset
for help on using the changeset viewer.