gonzui


Format: Advanced Search

tkernel_2/kernel/sysmain/build/Makefile.commonbare sourcepermlink (0.00 seconds)

Search this content:

    1: #
    2: # ----------------------------------------------------------------------
    3: #     T-Kernel 2.0 Software Package
    4: #
    5: #     Copyright 2011 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 2011/05/17.
   10: #     Modified by T-Engine Forum at 2012/05/22.
   11: #     Modified by T-Engine Forum at 2013/03/02.
   12: #     Modified by TRON Forum(http://www.tron.org/) at 2015/06/01.
   13: #
   14: # ----------------------------------------------------------------------
   15: #
   16: 
   17: #
   18: #       Makefile for gmake
   19: #       sysmain (common description)
   20: #
   21: 
   22: # source file dependencies (generated automatically)
   23: DEPS = Dependencies
   24: DEPENDENCIES_OUTPUT := $(DEPS)
   25: 
   26: MDIR = $(TETYPE)_$(MACHINE)
   27: 
   28: # ----------------------------------------------------------------------------
   29: # kernel install path
   30: KERNEL_INSTALLDIR       = $(BD)/kernel/bin/$(MDIR)
   31: 
   32: # kernel modules path
   33: BLD_TKERNEL_PATH        = $(BD)/kernel/tkernel/build/$(MDIR)
   34: BLD_SYSMGR_PATH         = $(BD)/kernel/sysmgr/build/$(MDIR)
   35: BLD_SYSINIT_PATH        = $(BD)/kernel/sysinit/build/$(MDIR)
   36: 
   37: # device driver path
   38: BLD_DRIVER_PATH         = $(BD)/driver/$(MDIR)/build
   39: 
   40: # config modules path
   41: BLD_CONFIG_PATH         = $(BD)/config/build/$(MDIR)
   42: 
   43: # monitor path
   44: BLD_MONITOR_PATH        = $(BD)/monitor/tmmain/build/$(MDIR)
   45: 
   46: # library path
   47: BLD_LIBS_PATH           = $(BD)/lib/build/$(MDIR)
   48: 
   49: # ----------------------------------------------------------------------------
   50: # target objects
   51: TARGET_RAM      = kernel-ram.sys
   52: TARGET_ROM      = kernel-rom.rom
   53: TARGET_RAMCRT0  = icrt0_ram.o
   54: TARGET_ROMCRT0  = icrt0.o
   55: 
   56: # emulator targets
   57: TARGET_EMU      = rom.bin
   58: TARGET_DBG_EMU  = rom-dbg.bin
   59: 
   60: S       = ../../src
   61: 
   62: # common source files
   63: SRC     += inittask_main.c
   64: VPATH   += $(S)
   65: HEADER  += $(S)
   66: 
   67: # additional source files (cpu-dependent)
   68: VPATH   += $(BD)/kernel/sysdepend/cpu/$(MACHINE)
   69: HEADER  += $(BD)/kernel/sysdepend/cpu/$(MACHINE)
   70: 
   71: # additional source files (device-dependent)
   72: VPATH   += $(BD)/kernel/sysdepend/device/$(MDIR)
   73: HEADER  += $(BD)/kernel/sysdepend/device/$(MDIR)
   74: 
   75: # header file path (kernel settings)
   76: HEADER  += $(BD)/kernel/tkernel/src
   77: 
   78: # object files
   79: OBJ     = $(addsuffix .o, $(basename $(SRC)))
   80: 
   81: # T-Kernel modules
   82: K_OBJ   +=        $(BLD_TKERNEL_PATH)/tkernel.o \
   83:                 $(BLD_SYSMGR_PATH)/sysmgr.o \
   84:                 $(BLD_SYSINIT_PATH)/sysinit.o
   85: 
   86: # gcc standard library
   87: STDLIB = -lgcc
   88: 
   89: # additional library
   90: LDSYSLIBS = -ltk -lsys -ltm -lsvc
   91: LDLIBS += $(LDUSRLIBS) $(LDSYSLIBS)
   92: 
   93: # linker options
   94: LDFLAGS += -static -nostdlib -T $(LINKSCRIPT)
   95: 
   96: LINKSCRIPT = kernel-ram$(_GCCVER).lnk
   97: $(TARGET_ROM): LINKSCRIPT = kernel-rom$(_GCCVER).lnk
   98: 
   99: # compiler options
  100: CFLAGS += $(CFLAGS_WARNING)
  101: CPPFLAGS += -DTKERNEL_ONLY
  102: 
  103: # suppress debug options for the system codes
  104: # (comment out to debug the whole kernel)
  105: DBGOPT := mode=
  106: 
  107: # ----------------------------------------------------------------------------
  108: ALL  = $(TARGET_RAM) $(TARGET_RAM:%.sys=%.map) $(TARGET_RAM:%.sys=%.mot)
  109: ALL += $(TARGET_ROM) $(TARGET_ROM:%.rom=%.map) $(TARGET_ROM:%.rom=%.mot)
  110: ALL += $(TARGET_RAM:%.sys=%.bin)
  111: EMU  = $(TARGET_EMU) $(TARGET_DBG_EMU)
  112: REQ_MODULES = libraries tkernel sysmgr sysinit drivers
  113: 
  114: # make targets
  115: .PHONY: all emu clean install install_emu
  116: .PHONY: source clean_source clean_all
  117: .PHONY: tkernel sysmgr sysinit libraries drivers config monitor 
  118: .PHONY: clean_libraries clean_drivers clean_config clean_monitor
  119: 
  120: # default make targets
  121: all: $(REQ_MODULES) $(TARGET_RAMCRT0) $(TARGET_ROMCRT0)
  122:         $(MAKE) $(ALL)
  123:         $(MAKE) install
  124: 
  125: # make targets for emulator
  126: emu: all config monitor
  127:         $(MAKE) $(EMU)
  128:         $(MAKE) install_emu
  129: 
  130: # objects for RAM
  131: $(TARGET_RAM): $(TARGET_RAMCRT0) $(OBJ) $(K_OBJ) $(I_OBJ)
  132:         $(CC) $(TARGET_ARCH) $(LDFLAGS) $^ $(LDLIBS) $(STDLIB) $(OUTPUT_OPTION)
  133: 
  134: $(TARGET_RAM:%.sys=%.map): $(TARGET_RAM)
  135:         $(NM) $(NMFLAGS) $< > $@
  136: 
  137: $(TARGET_RAM:%.sys=%.mot): $(TARGET_RAM)
  138:         $(OBJCOPY) $(OUTPUT_SREC) $< $@
  139: 
  140: $(TARGET_RAM:%.sys=%.bin): $(TARGET_RAM)
  141:         $(OBJCOPY) -O binary $< $@
  142: 
  143: # objects for ROM
  144: $(TARGET_ROM): $(TARGET_ROMCRT0) $(OBJ) $(K_OBJ) $(I_OBJ)
  145:         $(CC) $(TARGET_ARCH) $(LDFLAGS) $^ $(LDLIBS) $(STDLIB) $(OUTPUT_OPTION)
  146: 
  147: $(TARGET_ROM:%.rom=%.map): $(TARGET_ROM)
  148:         $(NM) $(NMFLAGS) $< > $@
  149: 
  150: $(TARGET_ROM:%.rom=%.mot): $(TARGET_ROM)
  151:         $(OBJCOPY) $(OUTPUT_SREC) $< $@
  152: 
  153: # objects for emulator rom images
  154: EMU_OBJ =       $(BLD_MONITOR_PATH)/tmonitor.mot \
  155:                $(BLD_CONFIG_PATH)/rominfo-rom.mot \
  156:                $(TARGET_ROM:%.rom=%.mot)
  157: 
  158: DBG_EMU_OBJ =   $(BLD_MONITOR_PATH)/tmonitor.mot \
  159:                $(BLD_CONFIG_PATH)/rominfo-ram.mot
  160: 
  161: $(TARGET_EMU): $(EMU_OBJ)
  162:         $(BD)/etc/mergesrec $^ > _rom.mot
  163:         $(OBJCOPY) -I srec -O binary _rom.mot $@
  164:         $(RM) _rom.mot
  165: 
  166: $(TARGET_DBG_EMU): $(DBG_EMU_OBJ)
  167:         $(BD)/etc/mergesrec $^ > _rom-dbg.mot
  168:         $(OBJCOPY) -I srec -O binary _rom-dbg.mot $@
  169:         $(RM) _rom-dbg.mot
  170: 
  171: # required modules
  172: tkernel:
  173:         ( cd $(BLD_TKERNEL_PATH) ; $(MAKE) $(DBGOPT) )
  174: 
  175: sysmgr:
  176:         ( cd $(BLD_SYSMGR_PATH) ; $(MAKE) $(DBGOPT) )
  177: 
  178: sysinit:
  179:         ( cd $(BLD_SYSINIT_PATH) ; $(MAKE) $(DBGOPT) )
  180: 
  181: libraries:
  182:         ( cd $(BLD_LIBS_PATH) ; $(MAKE) $(DBGOPT) )
  183: 
  184: clean_libraries:
  185:         ( cd $(BLD_LIBS_PATH) ; $(MAKE) $(DBGOPT) clean )
  186: 
  187: drivers:
  188:         ( cd $(BLD_DRIVER_PATH) ; $(MAKE) $(DBGOPT) )
  189: 
  190: clean_drivers:
  191:         ( cd $(BLD_DRIVER_PATH) ; $(MAKE) $(DBGOPT) clean )
  192: 
  193: config:
  194:         ( cd $(BLD_CONFIG_PATH) ; $(MAKE) $(DBGOPT) )
  195: 
  196: clean_config:
  197:         ( cd $(BLD_CONFIG_PATH) ; $(MAKE) $(DBGOPT) clean )
  198: 
  199: monitor:
  200:         ( cd $(BLD_MONITOR_PATH) ; $(MAKE) $(DBGOPT) )
  201: 
  202: clean_monitor:
  203:         ( cd $(BLD_MONITOR_PATH) ; $(MAKE) $(DBGOPT) clean )
  204: 
  205: # make source files of svc interface 
  206: source:
  207:         ( cd $(BLD_LIBS_PATH) ; $(MAKE) $(DBGOPT) source )
  208:         ( cd $(BLD_DRIVER_PATH) ; $(MAKE) $(DBGOPT) source )
  209: 
  210: # clean source files of svc interface 
  211: clean_source:
  212:         ( cd $(BLD_LIBS_PATH) ; $(MAKE) $(DBGOPT) clean_source )
  213:         ( cd $(BLD_DRIVER_PATH) ; $(MAKE) $(DBGOPT) clean_source )
  214: 
  215: # clean all objects
  216: clean:  clean_libraries clean_drivers
  217:         ( cd $(BLD_TKERNEL_PATH) ; $(MAKE) $(DBGOPT) clean )
  218:         ( cd $(BLD_SYSMGR_PATH) ; $(MAKE) $(DBGOPT) clean )
  219:         ( cd $(BLD_SYSINIT_PATH) ; $(MAKE) $(DBGOPT) clean )
  220:         $(RM) $(OBJ) $(TARGET_RAMCRT0) $(TARGET_ROMCRT0) $(ALL) $(DEPS)
  221:         $(RM) $(TARGET_EMU) $(TARGET_DBG_EMU)
  222: 
  223: # clean all objects and source files of svc interface
  224: clean_all: clean clean_source
  225: 
  226: # install kernel target
  227: install: $(addprefix $(EXE_INSTALLDIR)/, $(ALL))
  228: 
  229: # install emualtor target
  230: install_emu: $(addprefix $(EXE_INSTALLDIR)/, $(EMU))
  231: 
  232: $(addprefix $(EXE_INSTALLDIR)/, $(TARGET)): $(EXE_INSTALLDIR)/%: %
  233: 
  234: # generate dependencies
  235: $(DEPS): ; touch $(DEPS)
  236: -include $(DEPS)
  237: