1 # *****************************************************************************
2 # * Copyright (c) 2004, 2008 IBM Corporation
3 # * All rights reserved.
4 # * This program and the accompanying materials
5 # * are made available under the terms of the BSD License
6 # * which accompanies this distribution, and is available at
7 # * http://www.opensource.org/licenses/bsd-license.php
10 # * IBM Corporation - initial implementation
11 # ****************************************************************************/
13 include ../Makefile.dirs
15 include $(TOPBRDDIR)/config
16 include $(TOPCMNDIR)/make.rules
20 CPPFLAGS = -I. -I$(LIBCMNDIR)/libc/include -I$(LIBCMNDIR)/libipmi -I$(INCLBRDDIR) \
21 -I$(INCLCMNDIR) -I$(RTASCMNDIR) -I$(INCLCMNDIR)/$(CPUARCH)
22 ASFLAGS = -Wa,-mregnames $(FLAG)
23 CFLAGS += -Wall -Wextra -O2 -msoft-float -ffreestanding $(FLAG)
25 # Board specific RTAS files:
27 BOARD_SRC_C = rtas_flash.c rtas_board.c rtas_pci.c \
28 rtas_out.c rtas_table.c
29 BOARD_SRCS = $(BOARD_SRC_ASM) $(BOARD_SRC_C)
30 BOARD_OBJ = $(BOARD_SRC_ASM:%.S=%.o) $(BOARD_SRC_C:%.c=%.o) $(BOARD_OCO:%.oco=%.o)
31 BOARD_OCO = i2c_bmc.oco ipmi_oem.oco
34 # Common RTAS files (from $(RTASCMNDIR) directory):
35 RTAS_SRC_ASM = rtas_entry.S rtas_common.S reloc.S
36 RTAS_SRC_C = rtas_call.c
37 RTAS_SRCS = $(RTAS_SRC_ASM) $(RTAS_SRC_C)
38 RTAS_OBJ = $(RTAS_SRC_ASM:%.S=%.o) $(RTAS_SRC_C:%.c=%.o)
40 RTAS_FLASH_SRC = block_lists.c
41 RTAS_FLASH_OBJ = $(RTAS_FLASH_SRC:%.c=$(RTASCMNDIR)/flash/%.o)
43 # Additional object files:
44 EXTRA_OBJ = ../llfw/hw.o ../../lib/libc.a ../../lib/libipmi.a
46 OBJS = $(RTAS_OBJ:%=$(RTASCMNDIR)/%) $(BOARD_OBJ) $(EXTRA_OBJ) \
50 all: Makefile.dep rtas.bin
53 $(OBJCOPY) -O binary $< $@
55 rtas: $(RTASCMNDIR)/rtas.lds $(OBJS) reloc_table.o
56 $(LD) $(LDFLAGS) -o $@ -T $(RTASCMNDIR)/rtas.lds $(OBJS) reloc_table.o
58 reloc_table.o: $(TOOLSDIR)/gen_reloc_table $(OBJS)
59 $(TOOLSDIR)/create_reloc_table.sh --ld "$(ONLY_LD)" --ldflags "$(LDFLAGS)" \
60 --lds "$(RTASCMNDIR)/rtas.lds" --objcopy "$(OBJCOPY)" $(OBJS)
62 $(TOOLSDIR)/gen_reloc_table: $(TOOLSDIR)/gen_reloc_table.c
63 $(MAKE) -C $(TOOLSDIR) gen_reloc_table
69 $(MAKE) -C ../../lib clean
70 rm -f $(OBJS) reloc_table.o rtas rtas.bin
76 # Rules for creating the dependency file:
78 $(CC) -MM $(CPPFLAGS) $(CFLAGS) $(BOARD_SRCS) > Makefile.dep
79 $(CC) -MM $(CPPFLAGS) $(CFLAGS) $(RTAS_SRCS:%=$(RTASCMNDIR)/%) \
80 | sed -e '/:/s,^,$(RTASCMNDIR)/,' >> Makefile.dep
84 # Include dependency file if available:
85 ifneq (,$(wildcard Makefile.dep))