Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / SLOF / board-js2x / rtas / Makefile
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
8 # *
9 # * Contributors:
10 # *     IBM Corporation - initial implementation
11 # ****************************************************************************/
12
13 include ../Makefile.dirs
14
15 include $(TOPBRDDIR)/config
16 include $(TOPCMNDIR)/make.rules
17
18
19 LDFLAGS         = -nostdlib
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)
24
25 # Board specific RTAS files:
26 BOARD_SRC_ASM   =
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
32
33
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)
39
40 RTAS_FLASH_SRC  = block_lists.c
41 RTAS_FLASH_OBJ  = $(RTAS_FLASH_SRC:%.c=$(RTASCMNDIR)/flash/%.o)
42
43 # Additional object files:
44 EXTRA_OBJ       = ../llfw/hw.o ../../lib/libc.a ../../lib/libipmi.a
45
46 OBJS            = $(RTAS_OBJ:%=$(RTASCMNDIR)/%) $(BOARD_OBJ) $(EXTRA_OBJ) \
47                   $(RTAS_FLASH_OBJ)
48
49
50 all:    Makefile.dep rtas.bin
51
52 rtas.bin: rtas 
53         $(OBJCOPY) -O binary $< $@
54
55 rtas: $(RTASCMNDIR)/rtas.lds $(OBJS) reloc_table.o 
56         $(LD) $(LDFLAGS) -o $@ -T $(RTASCMNDIR)/rtas.lds $(OBJS) reloc_table.o
57
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)
61
62 $(TOOLSDIR)/gen_reloc_table: $(TOOLSDIR)/gen_reloc_table.c
63         $(MAKE) -C $(TOOLSDIR) gen_reloc_table
64
65 ../../lib/libc.a:
66         $(MAKE) -C ../../lib
67
68 clean:
69         $(MAKE) -C ../../lib clean
70         rm -f $(OBJS) reloc_table.o rtas rtas.bin
71
72 distclean : clean
73         rm -f Makefile.dep
74
75
76 # Rules for creating the dependency file:
77 depend:
78         $(CC) -MM $(CPPFLAGS) $(CFLAGS) $(BOARD_SRCS) > Makefile.dep
79         $(CC) -MM $(CPPFLAGS) $(CFLAGS) $(RTAS_SRCS:%=$(RTASCMNDIR)/%) \
80           | sed -e '/:/s,^,$(RTASCMNDIR)/,' >> Makefile.dep
81 Makefile.dep:
82         $(MAKE) depend
83
84 # Include dependency file if available:
85 ifneq (,$(wildcard Makefile.dep))
86 include Makefile.dep
87 endif
88 %.o: %.oco
89         cp -f $< $@