source: trunk/softs/tsar_boot/Makefile @ 388

Last change on this file since 388 was 388, checked in by cfuguet, 11 years ago

Modifications in tsar/trunk/softs/tsar_boot:

  • Improving the boot_ioc_read when using a SD card in FPGA platform.
  • Adding some instrumentation on the SD card driver (under preprocessor conditional directives).
  • Including Doxyfile for generate documentation using doxygen.
  • Improving the Makefile to include doc generation.
File size: 2.9 KB
Line 
1ifndef MAKECMDGOALS
2  MAKECMDGOALS=none
3endif
4
5ifneq ($(MAKECMDGOALS),$(filter $(MAKECMDGOALS),clean distclean clean-doc doc))
6  ifndef PLATFORM_DIR
7    $(error please define PLATFORM_DIR 'make PLATFORM_DIR=foo')
8  else
9    ifdef SOCLIB
10      DEFS+= -DSOCLIB_IOC
11      DTS=platform_soclib.dts
12      $(info Making for $(PLATFORM_DIR), SocLib variant)
13    else
14      DTS=platform_fpga.dts
15      $(info Making for $(PLATFORM_DIR), FPGA variant)
16    endif
17  endif
18endif
19
20LD             := mipsel-unknown-elf-ld
21CC             := mipsel-unknown-elf-gcc
22AS             := mipsel-unknown-elf-as
23DU             := mipsel-unknown-elf-objdump
24RM             := rm -rf
25ECHO       := echo
26MKDIR      := mkdir
27DTC            := dtc
28HEXDUMP    := hexdump
29DOXYGEN    := doxygen
30
31BUILD_DIR  := build
32SRCS_DIR   := src
33INCS_DIR   := include
34
35# =============================================================================
36# Include files paths
37# =============================================================================
38
39INCLUDE    += -I. -I$(INCS_DIR) -I$(PLATFORM_DIR)
40
41# =============================================================================
42# Paths of sources in another directories
43# =============================================================================
44
45VPATH      += $(SRCS_DIR)
46VPATH      += $(PLATFORM_DIR)
47
48# =============================================================================
49# Object files
50# =============================================================================
51
52CFLAGS     := -Wall -mno-gpopt -ffreestanding -fomit-frame-pointer -mips32 \
53                      -ggdb -mlong-calls
54
55C_SRCS     := boot_elf_loader.c boot_ioc.c boot_memcpy.c boot_tty.c exceptions.c
56ifndef SOCLIB
57C_SRCS     += sdcard.c spi.c
58endif
59
60S_SRCS     := reset.S
61
62OBJS       := $(subst .c,.o, $(notdir $(C_SRCS)))
63OBJS       += $(subst .S,.o, $(notdir $(S_SRCS)))
64OBJS       := $(addprefix $(BUILD_DIR)/, $(OBJS))
65
66TARGET     := bin.soft
67
68
69ifdef SYSCLK_FREQ
70DEFS+= -DSYSCLK_FREQ=$(SYSCLK_FREQ)
71endif
72
73all: $(TARGET)
74
75$(TARGET): $(BUILD_DIR) $(OBJS) $(PLATFORM_DIR)/ldscript $(BUILD_DIR)/platform.ld
76        $(ECHO) "[   LD    ]     $@"
77        $(LD) -o $@ -T $(PLATFORM_DIR)/ldscript $(OBJS)
78        $(DU) -D $@ > $@.txt
79
80$(BUILD_DIR)/platform.ld: $(BUILD_DIR)/platform.dtb
81        $(ECHO) "[ HEXDUMP ]     $(notdir $<)"
82        $(HEXDUMP) -v -e '"BYTE(0x" 1/1 "%02X" ")\n"' $< > $@
83
84$(BUILD_DIR)/platform.dtb: $(DTS)
85        $(ECHO) "[   DTC   ]     $(notdir $<)"
86        touch $@;#${DTC} -O dtb -o $@ $< &> /dev/null
87
88$(BUILD_DIR):
89        $(MKDIR) $@
90
91doc: Doxyfile
92        $(DOXYGEN) Doxyfile
93
94clean:
95        $(RM) $(TARGET).txt $(TARGET) *~ $(BUILD_DIR)
96
97clean-doc:
98        $(RM) doc
99
100distclean: clean clean-doc
101
102# =============================================================================
103# Implicit makefile rules
104
105$(BUILD_DIR)/%.o: %.c
106        $(ECHO) "[   CC    ]     $(notdir $<)"
107        $(CC) $(DEFS) $(CFLAGS) $(INCLUDE) -c -o $@ $<
108        $(DU) -D $@ > $@.txt
109
110$(BUILD_DIR)/%.o: %.S
111        $(ECHO) "[   AS    ]     $(notdir $<)"
112        $(CC) $(DEFS) ${INCLUDE} -g -mips32 -c -o $@ $<
113        $(DU) -D $@ > $@.txt
114
115.SILENT:
Note: See TracBrowser for help on using the repository browser.