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