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 2013/02/20.
11: # Modified by TRON Forum(http://www.tron.org/) at 2015/06/01.
12: #
13: # ----------------------------------------------------------------------
14: #
15:
16:
17: #
18: # Makefile for gmake
19: # libdrvif - Driver Interface library (common description)
20: #
21:
22: # library version
23: LIB_VERSION = 2
24:
25: # source file dependencies (generated automatically)
26: DEPS = Dependencies
27: DEPENDENCIES_OUTPUT := $(DEPS)
28:
29: # ----------------------------------------------------------------------------
30:
31: # target files
32: TARGET_BASE = libdrvif
33:
34: TARGET.a = $(TARGET_BASE).a
35: TARGET.so = $(TARGET_BASE).so.$(LIB_VERSION)
36:
37: # source file path
38: S = ../../src
39: I = $(S)/include
40: IFSRC = $(S)/$(TETYPE)_$(MACHINE)
41:
42: VPATH := $(VPATH):$(IFSRC):$(S)
43: SRC = gdrvif.c sdrvif.c
44: HEADER := $(I) $(HEADER)
45:
46: OBJ = $(addsuffix .o, $(basename $(notdir $(SRC))))
47:
48: CFLAGS += $(CFLAGS_WARNING)
49:
50: # ----------------------------------------------------------------------------
51:
52: .PHONY: all clean install clean_install
53:
54: ifeq ($(LIBTYPE), so)
55: EXE_INST = $(TARGET.so) $(TARGET.so).map
56: ALL = $(EXE_INST) $(TARGET.a)
57: else
58: ALL = $(TARGET.a)
59: endif
60:
61: all: $(ALL)
62:
63: $(TARGET.a): $(OBJ)
64: $(AR) $(ARFLAGS) $@ $?
65: ifdef RANLIB
66: $(RANLIB) $@
67: endif
68:
69: $(TARGET.so): $(OBJ)
70: $(LINK.o) $(LDOBJS) $^ $(LOADLIBES) $(LDLIBS) $(OUTPUT_OPTION)
71:
72: install: $(addprefix $(LIB_INSTALLDIR)/, $(ALL))
73: ifeq ($(LIBTYPE), so)
74: install: $(addprefix $(EXE_INSTALLDIR)/, $(EXE_INST))
75: endif
76:
77: clean:
78: $(RM) *.o $(ALL)
79: $(RM) $(DEPS)
80:
81: clean_install:
82: $(RM) $(addprefix $(LIB_INSTALLDIR)/, $(ALL))
83: ifeq ($(LIBTYPE), so)
84: $(RM) $(addprefix $(EXE_INSTALLDIR)/, $(EXE_INST))
85: endif
86:
87: # generate dependencies
88: ifdef DEPENDENCIES_OUTPUT
89: $(DEPS): ; touch $(DEPS)
90: else
91: $(DEPS): $(SRC) ; $(MAKEDEPS) $@ $?
92: endif
93: -include $(DEPS)