456628b6bfc703e46f80c22f32302a544ededea6
[keystone-rtos/ibl.git] / src / make / makestg2
1 #*****************************************************************************
2 #* FILE PURPOSE: 2nd stage makefile for the intermediate boot loader
3 #*****************************************************************************
4 #* FILE NAME: makestg2
5 #*
6 #* DESCRIPTION: This makefile is invoked with build specific options
7 #*
8 #******************************************************************************
10 ifndef IBL_ROOT
11         IBL_ROOT=..
12 endif
14 MODULES= main device ethboot nandboot driver hw interp ecc
15 CLEAN_MODULES=$(addprefix clean_,$(MODULES))
17 TARGETS= c6472 c6474 c6474l c6455 c6457
19 ifeq ($(ENDIAN),little)
20         HEX_OPT= -order L
21         IEXT=     le
22 else
23         HEX_OPT= -order M
24         IEXT=     be
25 endif
27 ifeq ($(TARGET),c6474)
28   COMPACT= -compact
29 else
30   COMPACT=
31 endif
33 include $(IBL_ROOT)/make/$(ARCH)/makedefs.mk
35 export ARCH
36 export TARGET
39 $(TARGETS): $(MODULES) utils $(RIBL)
40         $(LD) -o ibl_$@/ibl_$@.out -m ibl_$@/ibl_$@.map  ibl_$@/ibl.cmd $(RTLIBS)
41         hex6x $(HEX_OPT) ibl_$@/ibl.rmd ibl_$@/ibl_$@.out
42         ../util/bconvert/bconvert64x -$(IEXT) ibl_le.b ibl.b
43         $(CP) ibl.b ibl_$@
44         ../util/btoccs/b2i2c ibl_$@/ibl.b ibl_$@/ibl.i2c.b
45         ../util/btoccs/b2ccs ibl_$@/ibl.i2c.b ibl_$@/ibl.i2c.$(IEXT).ccs
46         ../util/romparse/romparse $(COMPACT) ibl_$@/i2crom_$(IEXT).map
47         $(CP) i2crom.ccs ibl_$@/i2crom_$(IEXT).ccs
48         $(CP) i2crom.ccs ibl_$@/i2crom_$(IEXT).dat
49         $(RM) i2crom.ccs ibl_le.b ibl.b
52 $(MODULES):
53         @echo making $@
54         make -C $(IBL_ROOT)/$@/$(ARCH)/make $@
57 utils:
58         make -C $(IBL_ROOT)/util/btoccs
59         make -C $(IBL_ROOT)/util/romparse TARGET=$(TARGET)
60         make -C $(IBL_ROOT)/util/i2cRead  TARGET=$(TARGET) $(TARGET)
61         make -C $(IBL_ROOT)/util/i2cWrite TARGET=$(TARGET) $(TARGET)
62         make -C $(IBL_ROOT)/util/i2cConfig $(TARGET)
63         make -C $(IBL_ROOT)/util/bconvert
65 clean: $(CLEAN_MODULES)
66         
68 $(CLEAN_MODULES):
69         @echo cleaning $(subst clean_, ,$@)
70         make -C $(IBL_ROOT)/$(subst clean_,,$@)/$(ARCH)/make clean
71         
72 cleant:
73         rm -rf ibl_$(TARGET)/ibl_$(TARGET).out
74         rm -rf ibl_$(TARGET)/ibl_$(TARGET).map
75         rm -rf ibl_$(TARGET)/ibl_le.b
76         rm -rf ibl_$(TARGET)/ibl.b
77         rm -rf ibl_$(TARGET)/ibl.i2c.b
78         rm -rf ibl_$(TARGET)/ibl.i2c.ccs
79         rm -rf ibl_$(TARGET)/i2crom.ccs
80