gonzui


Format: Advanced Search

t2ex/t2ex_source/etc/sysdepend/tef_em1d/makerules.sysdependbare sourcepermlink (0.03 seconds)

Search this content:

    1: #
    2: # ----------------------------------------------------------------------
    3: #    T2EX Software Package
    4: #
    5: #    Copyright 2012 by Ken Sakamura.
    6: #    This software is distributed under the latest version of T-License 2.x.
    7: # ----------------------------------------------------------------------
    8: #
    9: #    Released by T-Engine Forum(http://www.t-engine.org/) at 2012/12/12.
   10: #    Modified by T-Engine Forum at 2013/01/16.
   11: #    Modified by TRON Forum(http://www.tron.org/) at 2015/06/04.
   12: #
   13: # ----------------------------------------------------------------------
   14: #
   15: 
   16: #
   17: # This software package is available for use, modification, 
   18: # and redistribution in accordance with the terms of the attached 
   19: # T-License 2.x.
   20: # If you want to redistribute the source code, you need to attach 
   21: # the T-License 2.x document.
   22: # There's no obligation to publish the content, and no obligation 
   23: # to disclose it to the TRON Forum if you have modified the 
   24: # software package.
   25: # You can also distribute the modified source code. In this case, 
   26: # please register the modification to T-Kernel traceability service.
   27: # People can know the history of modifications by the service, 
   28: # and can be sure that the version you have inherited some 
   29: # modification of a particular version or not.
   30: #
   31: #    http://trace.tron.org/tk/?lang=en
   32: #    http://trace.tron.org/tk/?lang=ja
   33: #
   34: # As per the provisions of the T-License 2.x, TRON Forum ensures that 
   35: # the portion of the software that is copyrighted by Ken Sakamura or 
   36: # the TRON Forum does not infringe the copyrights of a third party.
   37: # However, it does not make any warranty other than this.
   38: # DISCLAIMER: TRON Forum and Ken Sakamura shall not be held
   39: # responsible for any consequences or damages caused directly or
   40: # indirectly by the use of this software package.
   41: #
   42: # The source codes in bsd_source.tar.gz in this software package are 
   43: # derived from NetBSD or OpenBSD and not covered under T-License 2.x.
   44: # They need to be changed or redistributed according to the 
   45: # representation of each source header.
   46: #
   47: 
   48: #
   49: #       makerules
   50: #               for GNU make
   51: #
   52: #       default rules - system-dependent (EM1-D512)
   53: #
   54: #       MACHINE       target CPU
   55: #               em1d : EM1-D512
   56: #
   57: #       TETYPE        target T-Engine type
   58: #               tef  : T-Engine Forum Reference Board
   59: #
   60: #       GNUARM_2      GNU development tool for ARM
   61: #
   62: 
   63: # check environmental variables
   64: ifndef GNU_BD
   65:   $(error 'GNU_BD' is not defined)
   66: endif
   67: ifndef GNUARM_2
   68:   ifndef GNUarm_2
   69:     $(error 'GNUARM_2' is not defined)
   70:   endif
   71:   # for compatibitily
   72:   GNUARM_2 = $(GNUarm_2)
   73: endif
   74: 
   75: # command path
   76: PATH = .
   77: ifneq ($(filter "$(origin GNUARM_2)", $(TOOL_ORIGIN)), )
   78:   PATH := $(PATH):$(GNUARM_2)/bin
   79: endif
   80: ifneq ($(filter "$(origin GNUs)", $(TOOL_ORIGIN)), )
   81:   PATH := $(PATH):$(GNUs)/bin
   82: endif
   83: ifneq ($(filter Linux-%, $(CROSS_ARCH)), )
   84:   PATH := $(PATH):/usr/local/bin:/bin:/usr/bin
   85: endif
   86: ifneq ($(filter Cygwin-%, $(CROSS_ARCH)), )
   87:   PATH := $(PATH):/usr/local/bin:/bin:/usr/bin
   88: endif
   89: 
   90: # ----- T-Engine Reference Board (EM1-D512) ----------------------------
   91: 
   92: # GCC environment
   93: TARGET_ARCH =
   94: 
   95: # target type
   96: _CPUTYPE_FLAGS    = -mcpu=arm1176jzf-s -msoft-float -mfpu=vfp
   97: _CPUTYPE_FLAGS_AS = -mcpu=arm1176jzf-s -mfpu=softvfp
   98: _TE_SYSTEM_NAME_ = _TEF_EM1D_
   99: 
  100: # code set
  101: _CODESET_FLAGS = -mthumb-interwork
  102: 
  103: ### build option ###
  104: CFLAGS +=
  105: CPPFLAGS +=
  106: ASFLAGS +=
  107: LDFLAGS +=
  108: 
  109: ### C  ###
  110: CC := $(GNUARM_2)/bin/gcc4arm
  111: OUTPUT_OPTION = -o $@
  112: ifeq ($(mode), debug)
  113:   CFLAGS += -g
  114:   CPPFLAGS += $(HEADER:%=-I%) -D$(_TE_SYSTEM_NAME_) -DDEBUG
  115: else
  116:   CFLAGS += -O2
  117:   CPPFLAGS += $(HEADER:%=-I%) -D$(_TE_SYSTEM_NAME_)
  118: endif
  119: 
  120: CFLAGS += $(_CPUTYPE_FLAGS) $(_CODESET_FLAGS) -mstructure-size-boundary=8 -ffreestanding
  121: 
  122: CFLAGS_WARNING      = -Wall -Wno-pointer-sign
  123: CFLAGS_WARNING_FULL = -pedantic -W -Wall
  124: 
  125: COMPILE.c = $(CC) $(TARGET_ARCH) $(CFLAGS) $(CPPFLAGS) -c
  126: LINK.c = $(CC) $(TARGET_ARCH) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
  127: 
  128: %.o: %.c
  129:         $(COMPILE.c) $< $(OUTPUT_OPTION)
  130: 
  131: %.uo: %.c
  132:         $(COMPILE.c) $< $(OUTPUT_OPTION) -MT $@
  133: 
  134: %.s: %.c
  135:         $(CC) $(TARGET_ARCH) $(CFLAGS) $(CPPFLAGS) -S $<
  136: 
  137: %.i: %.c
  138:         $(CC) $(TARGET_ARCH) $(CFLAGS) $(CPPFLAGS) -E $< $(OUTPUT_OPTION)
  139: 
  140: ### C++ ###
  141: CXX := $(GNUARM_2)/bin/gcc4arm
  142: CXXFLAGS = $(CFLAGS)
  143: 
  144: COMPILE.cc = $(CXX) $(TARGET_ARCH) $(CXXFLAGS) $(CPPFLAGS) -c
  145: LINK.cc = $(CXX) $(TARGET_ARCH) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)
  146: 
  147: %.o: %.cc
  148:         $(COMPILE.cc) $< $(OUTPUT_OPTION)
  149: 
  150: %.uo: %.cc
  151:         $(COMPILE.cc) $< $(OUTPUT_OPTION) -MT $@
  152: 
  153: %.s: %.cc
  154:         $(CXX) $(TARGET_ARCH) $(CXXFLAGS) $(CPPFLAGS) -S $<
  155: 
  156: %.i: %.cc
  157:         $(CXX) $(TARGET_ARCH) $(CXXFLAGS) $(CPPFLAGS) -E $< $(OUTPUT_OPTION)
  158: 
  159: ### asm ###
  160: AS = $(GNUARM_2)/bin/as
  161: ifeq ($(mode), debug)
  162:   ASFLAGS += -g
  163: else
  164:   ASFLAGS +=
  165: endif
  166: 
  167: ASFLAGS += $(_CPUTYPE_FLAGS) $(_CODESET_FLAGS)
  168: ASFLAGS.s = $(_CPUTYPE_FLAGS_AS) $(_CODESET_FLAGS)
  169: 
  170: COMPILE.S = $(CC) $(TARGET_ARCH) $(ASFLAGS) $(CPPFLAGS) -c
  171: COMPILE.s = $(AS) $(ASFLAGS.s)
  172: 
  173: %.o: %.S
  174:         $(COMPILE.S) $< $(OUTPUT_OPTION)
  175: 
  176: %.uo: %.S
  177:         $(COMPILE.S) $< $(OUTPUT_OPTION) -MT $@
  178: 
  179: %.o: %.s
  180:         $(COMPILE.s) $< $(OUTPUT_OPTION)
  181: 
  182: %.uo: %.s
  183:         $(COMPILE.S) $< $(OUTPUT_OPTION)
  184: 
  185: %.i: %.S
  186:         $(CC) $(TARGET_ARCH) $(ASFLAGS) $(CPPFLAGS) -E $< $(OUTPUT_OPTION)
  187: 
  188: ### linker ###
  189: LD = $(GNUARM_2)/bin/ld
  190: ifeq ($(mode), debug)
  191:   LDFLAGS += $(LIBDIR:%=-L%)
  192: else
  193:   LDFLAGS += $(LIBDIR:%=-L%)
  194: endif
  195: 
  196: LDFLAGS += $(_CPUTYPE_FLAGS) $(_CODESET_FLAGS)
  197: 
  198: LIBDIR = $(COMMONLIB)
  199: LOADLIBES =
  200: LDOBJS =
  201: LDLIBS =
  202: 
  203: # additional linker option
  204: ifneq ($(filter sl, $(options)), )
  205:   LDFLAGS2 = -static
  206: else
  207:   # no effect
  208:   LDFLAGS2 = -static
  209: endif
  210: LDFLAGS3 = -static -T $(COMMONLIB)/static.lnk
  211: START_ADR =
  212: 
  213: # create executable
  214: LINK.o = $(CC) $(TARGET_ARCH) $(LDFLAGS) $(LDFLAGS2) $(START_ADR)
  215: 
  216: # link objects
  217: LINK_R.o = $(CC) $(TARGET_ARCH) $(LDFLAGS) -r -nostdlib
  218: 
  219: # link objects and libraries
  220: LINK_A.o = $(CC) $(TARGET_ARCH) $(LDFLAGS) -r
  221: 
  222: # create executable (location only)
  223: LOCATE.o = $(CC) $(TARGET_ARCH) $(LDFLAGS) -nostdlib $(LDFLAGS3) $(START_ADR)
  224: 
  225: %: %.o
  226:         $(LINK.o) $(LDOBJS) $^ $(LOADLIBES) $(LDLIBS) $(OUTPUT_OPTION)
  227: 
  228: %.out: %.o
  229:         $(LINK.o) $(LDOBJS) $^ $(LOADLIBES) $(LDLIBS) $(OUTPUT_OPTION)
  230: 
  231: %.abs: %.o
  232:         $(LINK_A.o) $(LDOBJS) $^ $(LOADLIBES) $(LDLIBS) -o _$@
  233:         $(LOCATE.o) _$@ $(OUTPUT_OPTION)
  234:         $(RM) _$@
  235: 
  236: ### library ###
  237: AR = $(GNUARM_2)/bin/ar
  238: ARFLAGS = rv
  239: RANLIB = $(GNUARM_2)/bin/ranlib
  240: 
  241: (%): %
  242:         $(AR) $(ARFLAGS) $@ $%
  243: 
  244: ### create name list ###
  245: NM = $(GNUARM_2)/bin/nm
  246: NMFLAGS = -n
  247: 
  248: %.map: %
  249:         $(NM) $(NMFLAGS) $< > $@
  250: 
  251: %.map: %.out
  252:         $(NM) $(NMFLAGS) $< > $@
  253: 
  254: %.map: %.abs
  255:         $(NM) $(NMFLAGS) $< > $@
  256: 
  257: %.map: %.dll
  258:         $(NM) $(NMFLAGS) $< > $@
  259: 
  260: ### data box ###
  261: DBCPPFLAGS = -D$(_TE_SYSTEM_NAME_)
  262: DB_CPP = $(CPP) -nostdinc -traditional -P $(DATABOX_HEADER:%=-I%) $(DBCPPFLAGS)
  263: DB = $(ETCBIN)/databox
  264: DBFLAGS =
  265: DBSRCFLAGS = -s
  266: DATABOX = $(DB) $(DBFLAGS)
  267: 
  268: %.dbx: %.d
  269:         $(DB_CPP) $< $@.tmp
  270:         $(DATABOX) $@.tmp $@
  271:         $(RM) $@.tmp
  272: 
  273: %.fsn: %.f
  274:         $(DB_CPP) $< $@.tmp
  275:         $(DATABOX) -n $@.tmp $@
  276:         $(RM) $@.tmp
  277: 
  278: %.c: %.d
  279:         $(DB_CPP) $< $@.tmp
  280:         $(DATABOX) -n $(DBSRCFLAGS) $@.tmp $@
  281:         $(RM) $@.tmp
  282: 
  283: ### other ###
  284: ifndef CPP
  285:   CPP = $(GNU_BD)/bin/arm_2-unknown-tkernel-cpp
  286: endif
  287: STRIP = $(GNUARM_2)/bin/strip --strip-unneeded
  288: 
  289: OBJCOPY = $(GNU_BD)/bin/arm_2-unknown-tkernel-objcopy
  290: OUTPUT_SREC = -O srec --srec-forceS3 --srec-len 32