Build: update setupenvLnx.sh to do error checking
[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
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  PLL_OBJS= $(PLL_PATH)/pll.$(IEXT).oc
31 endif
33 # Device specific helper utilities
36 ECODIR= $(IBL_ROOT)/util/i2cConfig
37 ifeq ($(TARGET),c66x)
38  TFILES= ../../device/c64x/make/$(TARGET)util.$(IEXT).oc
39 endif
41 MODULES= hw 
42 CFG_MODULES= device
44 CLEAN_MODULES=$(addprefix clean_,$(MODULES))
45 CLEAN_MODULES+=$(addprefix clean_,$(CFG_MODULES))
48 CSRC= i2cparam.c
50 CDEFS+= -DI2C_BUS_ADDR=$(I2C_BUS_ADDR)
51 CDEFS+= -DI2C_MAP_ADDR=$(I2C_MAP_ADDR)
54 # enable debug info in the compile
55 UTIL=yes
57 include $(IBL_ROOT)/make/$(ARCH)/makeeco.mk
59 C6X_C_DIR=  $(IBL_ROOT)
60 C6X_C_DIR+=;$(IBL_ROOT)/hw/i2c
61 C6X_C_DIR+=;$(IBL_ROOT)/hw/plls
62 C6X_C_DIR+=;$(STDINC)
63 C6X_C_DIR+=;$(IBL_ROOT)/cfg/$(TARGET)
64 C6X_C_DIR+=;$(IBL_ROOT)/device/$(TARGET)
65 C6X_C_DIR+=;$(IBL_ROOT)/arch/$(ARCH)
66 export C6X_C_DIR
69 export ARCH
70 export TARGET
72 .PHONY: i2cparam.cmd
74 $(DEVICES): gen_cdefdep $(MODULES) $(CFG_MODULES) $(OBJS) i2cparam.cmd
75         $(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)
77 $(MODULES):
78         @echo making $@
79         make -C $(IBL_ROOT)/$@/$(ARCH)/make $@
81 $(CFG_MODULES):
82         @echo making $@
83         make -C $(IBL_ROOT)/$@/$(ARCH)/make CDEFS='$(MAINDEFS)' $@
86 clean2: $(CLEAN_MODULES)
87         @rm -f $(OBJS)
88         @rm -f $(subst .c,.dc,$(CSRC))
89         @rm -f *.out *.map
92 $(CLEAN_MODULES):
93         @echo cleaning $(subst clean_, ,$@)
94         make -C $(IBL_ROOT)/$(subst clean_,,$@)/$(ARCH)/make clean
97 $(OBJS): cdefdep
100 gen_cdefdep:
101         @echo Checking command line dependencies
102         @echo $(TARGET) $(ARCH) $(I2C_BUS_ADDR) $(I2C_MAP_ADDR) > cdefdep.tmp
103         @sh -c 'if diff -q cdefdep.tmp cdefdep ; then echo same ; else $(CP) cdefdep.tmp cdefdep ; fi '
105