gonzui


Format: Advanced Search

tkernel_2/lib/libsvc/src/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 2013/02/20.
   11: #     Modified by TRON Forum(http://www.tron.org/) at 2015/06/01.
   12: #
   13: # ----------------------------------------------------------------------
   14: #
   15: 
   16: #
   17: #       Makefile for gmake
   18: #       libsvc - System call interface library (common description)
   19: #
   20: 
   21: # library version
   22: LIB_VERSION = 2
   23: 
   24: # source file dependencies (generated automatically)
   25: DEPS = Dependencies
   26: DEPENDENCIES_OUTPUT := $(DEPS)
   27: DEPS_SRC = Dependencies_src
   28: 
   29: # ----------------------------------------------------------------------------
   30: 
   31: # target files
   32: TARGET.a  = libsvc.a
   33: TARGET.so = libsvc.so.$(LIB_VERSION)
   34: 
   35: # source file path
   36: S       = ../../src
   37: I       = $(BD)/include/sys/svc
   38: IFSRC   = $(S)/sysdepend/$(MACHINE)
   39: 
   40: VPATH := $(VPATH):$(IFSRC):$(S)
   41: SRC = $(SRC_TK) $(SRC_SVC)
   42: HEADER += $(I)
   43: 
   44: OBJ = $(addsuffix .o, $(basename $(notdir $(SRC))))
   45: 
   46: # auto generation header/source files
   47: IFLIB_TK =      tk/syscall.h
   48: IFLIB_TD =      tk/dbgspt.h
   49: IFLIB_SVC =     tk/devmgr.h \
   50:                 tk/sysmgr.h \
   51:                 sys/consio.h \
   52:                 sys/segment.h \
   53:                 $(IFLIB_SYSDEP)
   54: 
   55: HEADER   += $(IFSRC)/include
   56: CPPFLAGS += -DBKERNEL
   57: CFLAGS   += $(CFLAGS_WARNING)
   58: 
   59: # ----------------------------------------------------------------------------
   60: 
   61: .PHONY: all clean clean_install clean_all install
   62: 
   63: ifeq ($(LIBTYPE), so)
   64:   ALL = $(TARGET.so) $(TARGET.so).map
   65: else
   66:   ALL = $(TARGET.a)
   67: endif
   68: 
   69: all: $(ALL)
   70: 
   71: # ----------------------------------------------------------------------------
   72: 
   73: # generate source code dependencies and define SRC_SVC
   74: #    (included here because $(SRC_SVC) is referred from $(OBJ) as prerequisites)
   75: $(DEPS_SRC): $(addprefix $(BD)/include/, $(IFLIB_TK) $(IFLIB_TD) $(IFLIB_SVC))
   76:         $(RM) $@
   77:         $(BD)/etc/mktksvc -deps $(MACHINE) $(BD)/include/$(IFLIB_TK) >> $@
   78:         $(BD)/etc/mktdsvc -deps $(MACHINE) $(BD)/include/$(IFLIB_TD) >> $@
   79:         for iflib_src in $(IFLIB_SVC) ; do \
   80:           $(BD)/etc/mkiflib -deps $(MACHINE) $(BD)/include/$$iflib_src >> $@ ; \
   81:         done
   82: -include $(DEPS_SRC)
   83: 
   84: # ----------------------------------------------------------------------------
   85: 
   86: $(TARGET.a): $(OBJ)
   87:         $(AR) $(ARFLAGS) $@ $?
   88:   ifdef RANLIB
   89:         $(RANLIB) $@
   90:   endif
   91: 
   92: $(TARGET.so): $(OBJ)
   93:         $(LINK.o) $(LDOBJS) $^ $(LOADLIBES) $(LDLIBS) $(OUTPUT_OPTION)
   94: 
   95: clean:
   96:         $(RM) *.o $(ALL)
   97:         $(RM) $(DEPS) $(DEPS_SRC)
   98: 
   99: clean_install:
  100:         $(RM) $(addprefix $(LIB_INSTALLDIR)/, $(ALL))
  101: ifeq ($(LIBTYPE), so)
  102:         $(RM) $(addprefix $(EXE_INSTALLDIR)/, $(ALL))
  103: endif
  104: 
  105: clean_all: clean_install clean clean_source
  106:         $(RM) $(DEPS) $(DEPS_SRC)
  107: 
  108: install: $(addprefix $(LIB_INSTALLDIR)/, $(ALL))
  109: ifeq ($(LIBTYPE), so)
  110: install: $(addprefix $(EXE_INSTALLDIR)/, $(ALL))
  111: endif
  112: 
  113: # ----------------------------------------------------------------------------
  114: 
  115: # generafe interface library source file
  116: .PHONY: source clean_source
  117: 
  118: source: $(SRC_SVC)
  119: 
  120: $(SRC_SVC): $(addprefix $(BD)/include/, $(IFLIB_TK) $(IFLIB_TD) $(IFLIB_SVC))
  121:         ( cd $(S); $(BD)/etc/mktksvc $(MACHINE) $(BD)/include/$(IFLIB_TK) );
  122:         ( cd $(S); $(BD)/etc/mktdsvc $(MACHINE) $(BD)/include/$(IFLIB_TD) );
  123:         ( cd $(S) ; \
  124:         for iflib_src in $(IFLIB_SVC) ; do \
  125:           $(BD)/etc/mkiflib $(MACHINE) $(BD)/include/$$iflib_src ; \
  126:         done );
  127: 
  128: clean_source:
  129:         ( cd $(I) ; $(RM) *.h )
  130:         ( cd $(IFSRC) ; $(RM) *.S )
  131: 
  132: # ----------------------------------------------------------------------------
  133: 
  134: # generate dependencies
  135: ifdef DEPENDENCIES_OUTPUT
  136:   $(DEPS): ; touch $(DEPS)
  137: else
  138:   $(DEPS): $(SRC) ; $(MAKEDEPS) $@ $?
  139: endif
  140: -include $(DEPS)