Merge pull request #3 in PROCESSOR-SDK/ibl from PRSDK-5675 to master
[keystone-rtos/ibl.git] / src / util / i2cConfig / makestg2
1 #**************************************************************************
2 #* FILE PURPOSE: 2nd stage makefile for the i2c parameter writer
3 #**************************************************************************
4 #* FILE NAME: makestg2
5 #*
6 #* DESCRIPTION: Builds the i2c parameter writer for a specific target
7 #*
8 #**************************************************************************
10 DEVICES= c6455 c6472 c6474 c6474l c6457 c66x c665x c66xk2x
12 ifndef IBL_ROOT
13  IBL_ROOT=../..
14 endif
16 ifeq ($(ENDIAN),big)
17  IEXT=be
18 else
19  IEXT=le
20 endif
23 # The PLL object files are device specific
24 PLL_PATH= ../../hw/c64x/make
25 ifeq ($(TARGET),c66x) 
26  PLL_OBJS=  $(PLL_PATH)/pll.$(IEXT).oc $(PLL_PATH)/cfgpll.$(IEXT).oc $(PLL_PATH)/cfgpll2.$(IEXT).oc
27  PLL_OBJS+= ../../device/c64x/make/c64x.$(IEXT).oa
28  PSC_OBJS= ../../hw/c64x/make/psc.$(IEXT).oc
29 else
30  ifeq ($(TARGET),c665x) 
31  PLL_OBJS=  $(PLL_PATH)/pll.$(IEXT).oc $(PLL_PATH)/cfgpll.$(IEXT).oc $(PLL_PATH)/cfgpll2.$(IEXT).oc
32  PLL_OBJS+= ../../device/c64x/make/c64x.$(IEXT).oa
33  PSC_OBJS= ../../hw/c64x/make/psc.$(IEXT).oc
34  else
35   ifeq ($(TARGET),c66xk2x) 
36    PLL_OBJS=  $(PLL_PATH)/pll.$(IEXT).oc $(PLL_PATH)/cfgpll.$(IEXT).oc $(PLL_PATH)/cfgpll2.$(IEXT).oc
37    PLL_OBJS+= ../../device/c64x/make/c64x.$(IEXT).oa
38    PSC_OBJS= ../../hw/c64x/make/psc.$(IEXT).oc
39   else
40    PLL_OBJS= $(PLL_PATH)/pll.$(IEXT).oc
41   endif
42  endif 
43 endif
45 # Device specific helper utilities
48 ECODIR= $(IBL_ROOT)/util/i2cConfig
49 ifeq ($(TARGET),c66x) 
50  TFILES= ../../device/c64x/make/$(TARGET)util.$(IEXT).oc
51 else
52  ifeq ($(TARGET),c665x) 
53   TFILES= ../../device/c64x/make/$(TARGET)util.$(IEXT).oc
54  else
55   ifeq ($(TARGET),c66xk2x) 
56    TFILES= ../../device/c64x/make/$(TARGET)util.$(IEXT).oc
57   endif 
58  endif
59 endif
61 MODULES= hw 
62 CFG_MODULES= device
64 CLEAN_MODULES=$(addprefix clean_,$(MODULES))
65 CLEAN_MODULES+=$(addprefix clean_,$(CFG_MODULES))
68 CSRC= i2cparam.c
70 CDEFS+= -DI2C_BUS_ADDR=$(I2C_BUS_ADDR)
71 CDEFS+= -DI2C_MAP_ADDR=$(I2C_MAP_ADDR)
74 # enable debug info in the compile
75 UTIL=yes
77 include $(IBL_ROOT)/make/$(ARCH)/makeeco.mk
79 C6X_C_DIR=  $(IBL_ROOT)
80 C6X_C_DIR+=;$(IBL_ROOT)/hw/i2c
81 C6X_C_DIR+=;$(IBL_ROOT)/hw/plls
82 C6X_C_DIR+=;$(STDINC)
83 C6X_C_DIR+=;$(IBL_ROOT)/cfg/$(TARGET)
84 C6X_C_DIR+=;$(IBL_ROOT)/device/$(TARGET)
85 C6X_C_DIR+=;$(IBL_ROOT)/arch/$(ARCH)
86 export C6X_C_DIR
89 export ARCH
90 export TARGET
92 .PHONY: i2cparam.cmd
94 $(DEVICES): gen_cdefdep $(MODULES) $(CFG_MODULES) $(OBJS) i2cparam.cmd
95         $(LD) -o i2cparam_$(TARGET)_$(IEXT).out -m i2cparam_$(TARGET)_$(IEXT).map i2cparam.$(IEXT).oc ../../hw/c64x/make/i2c.$(IEXT).oc $(PLL_OBJS) $(PSC_OBJS) $(TFILES) i2cparam.cmd $(RTLIBS)
97 $(MODULES):
98         @echo making $@
99         make -C $(IBL_ROOT)/$@/$(ARCH)/make $@
101 $(CFG_MODULES):
102         @echo making $@
103         make -C $(IBL_ROOT)/$@/$(ARCH)/make CDEFS='$(MAINDEFS)' $@
106 clean2: $(CLEAN_MODULES)
107         @rm -f $(OBJS)
108         @rm -f $(subst .c,.dc,$(CSRC))
109         @rm -f *.out *.map
112 $(CLEAN_MODULES):
113         @echo cleaning $(subst clean_, ,$@)
114         make -C $(IBL_ROOT)/$(subst clean_,,$@)/$(ARCH)/make clean
117 $(OBJS): cdefdep
120 gen_cdefdep:
121         @echo Checking command line dependencies
122         @echo $(TARGET) $(ARCH) $(I2C_BUS_ADDR) $(I2C_MAP_ADDR) > cdefdep.tmp
123         @sh -c 'if diff -q cdefdep.tmp cdefdep ; then echo same ; else $(CP) cdefdep.tmp cdefdep ; fi '
125