7.5   Sample Makefile

# make.PPC604diab - diab compilation tools definitions for PowerPC 604 
# 
# modification history 
# -------------------- 
# 01a,23Oct98,ms   written from make.PPC604gnu and Diab release notes. 
# 
# DESCRIPTION 
# This file contains PowerPC 604 specific definitions and flags for the 
# diab tools (compiler, assembler, linker etc.) 
# 
# The following macros are changed for T2 
#     CPP             use cc<X> -E -P -xc. cpp<X> no longer exists. 
#      
#*/ 
 
# Core definitions (all copied from make.PPC604gnu) 
 
CPU           = PPC604 
TOOL          = diab 
VX_CPU_FAMILY = PPC    
ARCH_DIR        = ppc 
TOOLENV               = ppc 
 
# Tools (all these definitions need to be overriden) 
      # new tools 
 
AR            = dar 
AS            = das 
CC            = dcc 
CXX           = $(CC) 
LD            = dld 
 
      # override WRS's CC_COMPILER="-traditional" 
 
COMPILE_TRADITIONAL = $(CC) -c $(CFLAGS) 
COMPILE_SYMTBL  = $(CC) -c $(CFLAGS) 
override CC_COMPILER = $(CC_DDI_FLAGS) -Xdollar-in-ident 
override C++_COMPILER = $(CC_DDI_FLAGS) -Xdollar-in-ident 
 
      # use gnu tools for the following 
 
CPP           = ccppc -E -P -xc 
NM            = nmppc 
RANLIB                = ranlib 
EXTRACT_BIN_NAME= elfToBin 
BINXSYM_NAME  = elfXsyms 
BINHEX_NAME   = elfHex 
DEPEND_GEN_UTIL = $(CPP) -M 
 
# Flags 
 
CC_DDI_FLAGS  = -tPPC403ES:tornado -X4 -Xsmall-data=0 -Xsmall-const=0 \ 
                -Xstrings-in-text=0 
CC_OPTIM_DRIVER       = 
CC_OPTIM_NORMAL       = -O 
CC_OPTIM_TARGET       = -O 
CC_ARCH_SPEC  = 
CC_WARNINGS_ALL = 
DEFINE_CC     = -D__asm__=__asm 
CFLAGS_AS       = $(CC_INCLUDE) $(CC_DEFINE) 
LDFLAGS               = -X -N -Xsection-align=4 
LD_PARTIAL_FLAGS= -X -r4 -Xsection-align=4 
 
      # new link flags for the config tool 
LD_RAM_FLAGS  = -Bt=$(RAM_LOW_ADRS) 
LD_ROM_RES_FLAGS= $(ROM_LDFLAGS) -Bt=$(ROM_TEXT_ADRS) -Bd=$(RAM_LOW_ADRS) 
LD_ROM_CPY_FLAGS= $(ROM_LDFLAGS) -Bt=$(ROM_TEXT_ADRS) -Bd=$(RAM_HIGH_ADRS) 
LD_ROM_CMP_FLAGS= $(ROM_LDFLAGS) -Bt=$(ROM_TEXT_ADRS) -Bd=$(RAM_HIGH_ADRS) 
 
      # old link flags for BSP Makefiles 
LD_LOW_FLAGS  = -Bt=$(RAM_LOW_ADRS) 
LD_HIGH_FLAGS = -Bt=$(RAM_HIGH_ADRS) 
RES_LOW_FLAGS = -Bt=$(ROM_TEXT_ADRS) -Bd=$(RAM_LOW_ADRS) 
RES_HIGH_FLAGS        = -Bt=$(ROM_TEXT_ADRS) -Bd=$(RAM_HIGH_ADRS) 
 
# Misc 
      # WRS default definition of LIBS is lib<CPU><TOOL>. 
      # This has to be overriden, since WRS only supplies lib<CPU>gnu. 
 
LIBS  = $(WIND_BASE)/target/lib/libPPC604gnuvx.a 
 
      # override implicit rule for the .s.o rule. Since this 
      # toolchain's assembler doesn't do C-preprocessing, we 
      # build assembly files in two steps. 
 
IMPLICIT_RULE_S_O     = override 
.s.o : 
      @ $(RM) $@ 
      $(CC) -P $(CC_INCLUDE) $(CC_DEFINES) $<  
      $(AS) $(CFLAGS_AS) $*.i  
      $(RM) $*.i  
 
# end of make.PPC604gnu