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 2011/09/08.
11: # Modified by T-Engine Forum at 2012/11/07.
12: # Modified by T-Engine Forum at 2013/03/01.
13: # Modified by TRON Forum(http://www.tron.org/) at 2015/06/01.
14: #
15: # ----------------------------------------------------------------------
16: #
17:
18: # T-Monitor : tmmain (em1d)
19:
20: MACHINE = em1d
21: TETYPE = tef
22:
23: SRC_SYSDEP =
24:
25: # ----------------------------------------------------------------------------
26:
27: DEPS = Dependencies
28: DEPENDENCIES_OUTPUT := $(DEPS)
29:
30: include $(BD)/etc/makerules
31:
32: # install directory
33: TMONITOR_INSTALLDIR = $(BD)/monitor/bin/$(TETYPE)_$(MACHINE)
34:
35: # h/w depend module path
36: HWDEPEND_PATH = $(BD)/monitor/hwdepend/$(TETYPE)_$(MACHINE)/build
37:
38: # command/svc module path
39: CMDSVC_PATH = $(BD)/monitor/cmdsvc/build/$(TETYPE)_$(MACHINE)
40:
41: # each driver module path
42: DRV_SIO_PATH = $(BD)/monitor/driver/sio/build/$(TETYPE)_$(MACHINE)
43: DRV_FLASH_PATH = $(BD)/monitor/driver/flash/build/$(TETYPE)_$(MACHINE)
44: DRV_MEMDISK_PATH = $(BD)/monitor/driver/memdisk/build/$(TETYPE)_$(MACHINE)
45:
46: # header paths
47: HEADER = $(BD)/include $(BD)/monitor/include
48:
49: # ----------------------------------------------------------------------------
50:
51: # version
52: VER := 2.01.00
53:
54: # T-Monitor boot message
55: define VERSION
56: char const Version[] = "$(VER)";
57: char const * const Title[] = {
58: "T-Monitor/$(TETYPE)_$(MACHINE) Version $(VER)",
59: 0,
60: "@(#)$(shell LC_TIME=C date)"
61: };
62: endef
63:
64: # ----------------------------------------------------------------------------
65:
66: TARGET = tmonitor
67:
68: S = ../../src
69:
70: VPATH = $(S)
71: HEADER += $(S)
72:
73: SRC = $(SRC_SYSDEP)
74:
75: OBJ = $(addsuffix .o, $(basename $(SRC)))
76:
77: CFLAGS += $(CFLAGS_WARNING)
78:
79: # ----------------------------------------------------------------------------
80:
81: M_OBJ = $(TMONITOR_INSTALLDIR)/hwdepend.o \
82: $(TMONITOR_INSTALLDIR)/cmdsvc.o \
83: $(TMONITOR_INSTALLDIR)/wrkbuf.o \
84: $(TMONITOR_INSTALLDIR)/sio.o \
85: $(TMONITOR_INSTALLDIR)/flash.o \
86: $(TMONITOR_INSTALLDIR)/memdisk.o
87:
88: LDLIBS = -lgcc
89:
90: LDFLAGS += -static -nostdlib -T $(LINKSCRIPT)
91:
92: ifneq ($(filter ram, $(options)), )
93: # RAM version, for debug purpose
94: LINKSCRIPT = monitor-ram.lnk
95: else
96: LINKSCRIPT = monitor.lnk
97: endif
98:
99: # ----------------------------------------------------------------------------
100:
101: .PHONY: all clean install
102:
103: ALL = $(TARGET).mot $(TARGET).map
104:
105: all: hwdepend cmdsvc drivers $(ALL) install
106:
107: $(TARGET).mot: $(TARGET)
108: $(OBJCOPY) -O srec --srec-forceS3 --srec-len 32 $< $@
109:
110: $(TARGET): $(M_OBJ) $(OBJ) version.o
111: $(CC) $(TARGET_ARCH) $(LDFLAGS) $^ $(LDLIBS) $(OUTPUT_OPTION)
112:
113: version.c: Makefile $(OBJ) $(M_OBJ)
114: echo "$$VERSION" > version.c
115:
116: hwdepend:
117: ( cd $(HWDEPEND_PATH) ; $(MAKE) ; $(MAKE) install ; )
118:
119: cmdsvc:
120: ( cd $(CMDSVC_PATH) ; $(MAKE) ; $(MAKE) install ; )
121:
122: drivers:
123: ( cd $(DRV_SIO_PATH) ; $(MAKE) ; $(MAKE) install ; )
124: ( cd $(DRV_FLASH_PATH) ; $(MAKE) ; $(MAKE) install ; )
125: ( cd $(DRV_MEMDISK_PATH) ; $(MAKE) ; $(MAKE) install ; )
126:
127: clean:
128: ( cd $(HWDEPEND_PATH) ; $(MAKE) clean )
129: ( cd $(CMDSVC_PATH) ; $(MAKE) clean )
130: ( cd $(DRV_SIO_PATH) ; $(MAKE) clean )
131: ( cd $(DRV_FLASH_PATH) ; $(MAKE) clean )
132: ( cd $(DRV_MEMDISK_PATH) ; $(MAKE) clean )
133: $(RM) version.[co] $(OBJ) $(M_OBJ) $(TARGET) $(ALL) $(DEPS)
134:
135: install: $(addprefix $(EXE_INSTALLDIR)/, $(ALL))
136:
137: ifdef DEPENDENCIES_OUTPUT
138: $(DEPS): ; touch $(DEPS)
139: else
140: $(DEPS): $(SRC) ; $(MAKEDEPS) $@ $?
141: endif
142: -include $(DEPS)
143:
144: $(SRC.C):