rules-lib.unix
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:6k
源码类别:

VxWorks

开发平台:

C/C++

  1. # rules-lib.unix - Host specific default definitions
  2. #
  3. # modification history
  4. # --------------------
  5. # 01s,12nov01,dbs  fix dependency-build warnings for C++ source
  6. # 01r,01nov01,jab  added LIBDIR directory creation
  7. # 01q,24oct01,jab  fixed dependency generation
  8. # 01p,23oct01,jab  cleaned up dependency rules
  9. # 01o,27aug01,wsl  add man pages and other doc niceties
  10. # 01n,24jul01,r_s  changing the make 'ifeq' conditional to work with 'gnu', 
  11. #                  'sfgnu', 'sfgnule' etc for TOOL
  12. # 01m,24jul01,r_s  diab specific rules added
  13. # 01l,05jan99,fle  added the DOC_OPTS_XXX flags
  14. #                  + made synopsis rule use refLib (refgen)
  15. # 01k,25nov98,fle  doc : made man rule use variables DOC_BOOK and DOC_CHAPTER
  16. # 01j,10nov98,fle  doc : made doc generated in DOC_DIR, and not in a hard
  17. #                  coded destination, so we can over write it
  18. # 01i,08sep98,fle  changed refgen options format since refgen.tcl
  19. # 01h,02sep98,fle  doc : replaced mangen with refgen
  20. # 01g,31aug98,ms   fixed LIBNAME creation rule when no objects exist
  21. # 01f,28jul98,pr   added "/" to LIBDIR path
  22. # 01e,02apr98,pcn  Removed Objcopy changes from Tempest view
  23. # 01d,02dec97,jmp  added synopsis rules.
  24. # 01c,04oct96,yp   added LOCAL_CLEAN to clean objs
  25. # 01b,17may96,yp   brought clean rule here
  26. # 01a,07may96,yp   created
  27. #
  28. # DESCRIPTION
  29. # This file contains the makefile rules that are specific to unix to build 
  30. # vxWorks libraries.  It is included by rules.library where rules common to
  31. # all hosts and the default rule exist. This file contains rules for managing 
  32. # archives on Unix hosts using sub-shells. If the archive is write-able we 
  33. # update it. If not we assume that it is a link you want to break or that it
  34. # doesn't exist. The archive are created from where the object files exist to
  35. # avoid including paths in the archive.
  36. #
  37. # The dependency list is generated by target depend.$(CPU)$(TOOL) which creates
  38. # a dependency list for all files c,s and cpp suffixes. 
  39. #
  40. # Sub directories to be built are expected to be defined in the SUBDIRS macro.
  41. # if it not defined the subdirs target is not seen. 
  42. # We build the man pages in the directories specified in the macro SUBDIRS
  43. # before we deal with DOC_FILES in the current directory
  44. lib:    $(TGT_DIR)/lib/$(LIBNAME)
  45. clean:
  46. $(RM) $(LIBOBJS) $(LOCAL_CLEAN)
  47. $(RM) depend.$(CPU)$(TOOL)
  48. # This is believed to be obsolete. If it is needed we can bring it back
  49. # ifneq ($(CLEANTAIL),)
  50. #  $(MAKE) -f Makefile CPU=$(CPU) TOOL=$(TOOL)
  51. #  $(CLEANTAIL)
  52. #   CLEANTAIL='')
  53. # endif
  54. $(TGT_DIR)/lib/$(LIBNAME): $(MAKE_LIBDIR) $(LIBOBJS)
  55.  @ - if [ -w $@ ] ; then 
  56.     (cd $(LIBDIR); 
  57.     echo "$(AR) crus " $@ $?; 
  58.     $(AR) crus $@ $(notdir $?)); 
  59. else 
  60.     (cd $(LIBDIR); 
  61.     $(RM) ../$(LIBNAME); 
  62.     echo "$(AR) crus " $@ $(LIBDIR)/"*.o"; 
  63.     $(AR) crus $@ *.o); 
  64. fi
  65. #dependency list generation
  66. depend.$(CPU)$(TOOL) : Makefile
  67. @ $(RM) $@
  68. @ echo "Creating depend.$(CPU)$(TOOL)"
  69. ifneq ($(wildcard *.c),)
  70. @ for FILE in $(filter-out $(NODEPENDOBJS), $(wildcard *.c)); 
  71. do 
  72.     $(CC)  $(OPTION_DEPEND) $(CFLAGS) $$FILE  
  73.     | $(TCL) $(BIN_DIR)/depend.tcl $(TGT_DIR) >>$@; 
  74. done
  75. endif
  76. ifneq ($(wildcard *.s),)
  77. @ for FILE in $(filter-out $(NODEPENDOBJS), $(wildcard *.s)); 
  78. do 
  79.     $(CPP) $(OPTION_DEPEND) $(CASFLAGS) $$FILE 
  80.     | $(TCL) $(BIN_DIR)/depend.tcl $(TGT_DIR) >>$@; 
  81. done
  82. endif
  83. ifneq ($(wildcard *.cpp),)
  84. @ for FILE in $(filter-out $(NODEPENDOBJS), $(wildcard *.cpp)); 
  85. do 
  86.     $(CXX) $(OPTION_DEPEND) $(CFLAGS) $$FILE 
  87.     | $(TCL) $(BIN_DIR)/depend.tcl $(TGT_DIR) >>$@ ;
  88. done
  89. endif
  90. # if SUBDIRS is not null we need to build the subdirectories before building
  91. # the current directory. 
  92. # if we have SUBDIRS
  93. ifneq ($(SUBDIRS),)
  94. subdirs :  $(SUBDIRS)
  95. $(SUBDIRS)::
  96. $(MAKE) -C $@ CPU=$(CPU) TOOL=$(TOOL) $(TARGET)
  97. # No SUBDIRS
  98. else
  99. subdirs:
  100. endif
  101. ########
  102. #
  103. # doc rules
  104. # re-define the DOC_DIR for the libraries as the default DOC_DIR is for BSPs
  105. DOC_DIR = $(DOCS_ROOT)/vxworks/ref
  106. # When the desired set of directories to be documented is different from the
  107. # directories whose software must be built (common for component products),
  108. # set DOCSUBDIRS to the subdirectories to be documented.
  109. ifeq ($(DOCSUBDIRS),)
  110. DOCSUBDIRS = $(SUBDIRS)
  111. endif
  112. ifneq ($(DOCSUBDIRS),)
  113. # define the man target and the default output directory for libraries
  114. man:
  115. -for DIR in $(DOCSUBDIRS) ; 
  116. do ( cd $$DIR; $(MAKE) CPU=$(CPU) TOOL=$(TOOL) man ) ; 
  117. done
  118. -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/refgen $(DOC_OPTS) 
  119.     -book $(DOC_BOOK) -chapter $(DOC_CHAPTER) -out $(DOC_DIR) 
  120.     $(DOC_FILES)
  121. -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/refgen $(MAN_PAGE_OPTS) 
  122.     -book $(DOC_BOOK) -chapter $(DOC_CHAPTER) -out $(MAN_PAGE_DIR) 
  123.     $(DOC_FILES)
  124. @date
  125. link ::
  126. -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/htmlLink -R 
  127.     $(DOCS_ROOT)/vxworks/ref
  128. synopsis ::
  129. -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/syngen 
  130.     -d $(WIND_BASE)/host/resource/synopsis $(DOC_FILES)
  131. for DIR in $(DOCSUBDIRS) ; 
  132. do ( cd $$DIR; $(MAKE) CPU=$(CPU) TOOL=$(TOOL) synopsis ) ; 
  133. done
  134. @date
  135. clean_synopsis ::
  136. for DIR in $(DOCSUBDIRS) ; 
  137. do ( cd $$DIR; $(MAKE) CPU=$(CPU) TOOL=$(TOOL) clean_synopsis ) ; 
  138. done
  139. ifneq ($(DOC_FILES),)
  140. $(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/syngen -clean 
  141.     -d $(WIND_BASE)/host/resource/synopsis
  142. endif
  143. # No DOCSUBDIRS
  144. else
  145. man:
  146. -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/refgen $(DOC_OPTS) 
  147.     -book $(DOC_BOOK) -chapter $(DOC_CHAPTER) -out $(DOC_DIR) 
  148.     $(DOC_FILES)
  149. -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/refgen $(MAN_PAGE_OPTS) 
  150.     -book $(DOC_BOOK) -chapter $(DOC_CHAPTER) -out $(MAN_PAGE_DIR) 
  151.     $(DOC_FILES)
  152. @date
  153. synopsis ::
  154. ifneq ($(DOC_FILES),)
  155. -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/syngen 
  156.     -d $(WIND_BASE)/host/resource/synopsis $(DOC_FILES)
  157. @date
  158. endif
  159. clean_synopsis ::
  160. ifneq ($(DOC_FILES),)
  161. $(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/syngen -clean 
  162.     -d $(WIND_BASE)/host/resource/synopsis
  163. endif
  164. endif
  165. # end doc rules
  166. #
  167. ######