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/11/07.
11: # Modified by T-Engine Forum at 2013/03/01.
12: # Modified by TRON Forum(http://www.tron.org/) at 2015/06/01.
13: #
14: # ----------------------------------------------------------------------
15: #
16:
17: #
18: # Makefile
19: # for GNU make
20: #
21: # device driver : console/serial (em1d)
22:
23: MACHINE = em1d
24: TETYPE = tef
25:
26: SRC_SYSDEP = ns16450.c
27:
28: # ----------------------------------------------------------------------------
29:
30: DEPS = Dependencies
31: DEPENDENCIES_OUTPUT := $(DEPS)
32: DEPS_SRC = Dependencies_src
33:
34: include $(BD)/etc/makerules
35:
36: HEADER = $(BD)/include
37:
38: # ----------------------------------------------------------------------------
39:
40: TARGET = console
41:
42: S = ../src
43:
44: SRC = main.c consmlock.c console_drv.c line_drv.c
45: SRC += $(SRC_SYSDEP)
46:
47: OBJ = $(addsuffix .o, $(basename $(SRC)))
48:
49: CFLAGS += $(CFLAGS_WARNING)
50:
51: # ----------------------------------------------------------------------------
52:
53: TARGET_SVC = libconsolesvc.a
54:
55: I = $(S)/svc
56: IFSRC = $(S)/svc
57: OBJ_SVC = $(addsuffix .o, $(basename $(SRC_SVC)))
58:
59: IFLIB = device/serialio.h
60:
61: # ----------------------------------------------------------------------------
62:
63: VPATH = $(S) $(IFSRC)
64: HEADER += $(S)
65:
66: # ----------------------------------------------------------------------------
67:
68: .PHONY: all clean install source clean_source clean_install
69:
70: ALL = $(TARGET).o $(TARGET_SVC)
71:
72: all: $(ALL)
73:
74: # ----------------------------------------------------------------------------
75:
76: # generate source code dependencies and define SRC_SVC
77: # (included here because $(SRC_SVC) is referred from $(OBJ) as prerequisites)
78: $(DEPS_SRC): $(addprefix $(BD)/include/, $(IFLIB))
79: $(RM) $@
80: for iflib_src in $(IFLIB) ; do \
81: $(BD)/etc/mkdrvsvc -deps $(MACHINE) $(BD)/include/$$iflib_src >> $@ ; \
82: done
83: -include $(DEPS_SRC)
84:
85: # ----------------------------------------------------------------------------
86:
87: $(TARGET).o: $(SRC_SVC) $(OBJ)
88: $(LINK_R.o) $(OBJ) $(OUTPUT_OPTION)
89:
90: $(TARGET_SVC): $(OBJ_SVC)
91: $(AR) $(ARFLAGS) $@ $?
92: ifdef RANLIB
93: $(RANLIB) $@
94: endif
95:
96: clean:
97: $(RM) $(OBJ) $(OBJ_SVC) $(ALL) $(DEPS) $(DEPS_SRC)
98:
99: source: $(SRC_SVC)
100:
101: $(SRC_SVC): $(addprefix $(BD)/include/, $(IFLIB))
102: ( cd $(IFSRC) ; \
103: for iflib_src in $(IFLIB) ; do \
104: $(BD)/etc/mkdrvsvc $(MACHINE) $(BD)/include/$$iflib_src ; \
105: done );
106:
107: clean_source:
108: ( cd $(I) ; $(RM) *.h )
109: ( cd $(IFSRC) ; $(RM) *.S )
110:
111: clean_install:
112: $(RM) $(addprefix $(DRIVER_INSTALLDIR)/, $(TARGET).o)
113: $(RM) $(addprefix $(LIB_INSTALLDIR)/, $(TARGET_SVC))
114:
115: install: $(addprefix $(DRIVER_INSTALLDIR)/, $(TARGET).o) $(addprefix $(LIB_INSTALLDIR)/, $(TARGET_SVC))
116:
117: # ----------------------------------------------------------------------------
118:
119: ifdef DEPENDENCIES_OUTPUT
120: $(DEPS): ; touch $(DEPS)
121: else
122: $(DEPS): $(SRC) ; $(MAKEDEPS) $@ $?
123: endif
124: -include $(DEPS)