Files
vxWorks/h/make/rules-lib.x86-linux2
2025-08-20 18:25:46 +08:00

259 lines
8.8 KiB
Plaintext

# rules-lib.unix - Host specific default definitions
#
# modification history
# --------------------
# 02j,15sep05,kkz Updating version number for API docs
# 02i,18aug05,pee Filtering object list for dependency generation
# 02h,31may05,md,pee move dependencies to object directory
# 02k,29apr05,kkz Changing doc directory path
# 02j,26apr05,pee Forcing library update with MAKE_LIBDIR
# 02i,07apr05,h_a LIB_ROOT to replace $(TGT_DIR)/lib for building components
# 02h,18apr05,pee added support for precomp objects.
# 02g,22apr05,h_a LIB_ROOT changes for external lib targets
# 02f,14feb05,bpn Removed shell command directory from doc link rule.
# 02e,14oct04,job Set KERNEL condition when building docs
# 02d,26may04,dgp modify default output directory for docs build
# 02c,13mar04,dlk When library exists, do not archive an empty set of
# objects newer than the library.
# 02b,04mar04,c_c Fixed library build introduced by the SPR 92805 fix.
# 02a,25feb04,c_c Fixed SPR 92805
# 01z,20feb04,c_c Dependencies rework.
# 01y,12jan04,bjl changed refgen to apigen.
# 01x,26dec03,dat ignore errors during dependency generation
# 01w,28nov03,c_c Use dependencies processing macro.
# 01v,07nov03,c_c Unified build rules with WIN32 hosts.
# 01u,01sep03,fle SPR#84899 : do not use make -C anymore, rather change
# directory first, and call make
# 01t,19aug03,fle SPR#88802 : modified depend.tcl use since it now takes
# output file as an argument
# 01s,12nov01,dbs fix dependency-build warnings for C++ source
# 01r,01nov01,jab added LIBDIR directory creation
# 01q,24oct01,jab fixed dependency generation
# 01p,23oct01,jab cleaned up dependency rules
# 01o,27aug01,wsl add man pages and other doc niceties
# 01n,24jul01,r_s changing the make 'ifeq' conditional to work with 'gnu',
# 'sfgnu', 'sfgnule' etc for TOOL
# 01m,24jul01,r_s diab specific rules added
# 01l,05jan99,fle added the DOC_OPTS_XXX flags
# + made synopsis rule use refLib (refgen)
# 01k,25nov98,fle doc : made man rule use variables DOC_BOOK and DOC_CHAPTER
# 01j,10nov98,fle doc : made doc generated in DOC_DIR, and not in a hard
# coded destination, so we can over write it
# 01i,08sep98,fle changed refgen options format since refgen.tcl
# 01h,02sep98,fle doc : replaced mangen with refgen
# 01g,31aug98,ms fixed LIBNAME creation rule when no objects exist
# 01f,28jul98,pr added "/" to LIBDIR path
# 01e,02apr98,pcn Removed Objcopy changes from Tempest view
# 01d,02dec97,jmp added synopsis rules.
# 01c,04oct96,yp added LOCAL_CLEAN to clean objs
# 01b,17may96,yp brought clean rule here
# 01a,07may96,yp created
#
# DESCRIPTION
# This file contains the makefile rules that are specific to unix to build
# vxWorks libraries. It is included by rules.library where rules common to
# all hosts and the default rule exist. This file contains rules for managing
# archives on Unix hosts using sub-shells. If the archive is write-able we
# update it. If not we assume that it is a link you want to break or that it
# doesn't exist. The archive are created from where the object files exist to
# avoid including paths in the archive.
#
# The dependency list is generated by target depend.$(BUILD_EXT)
# which creates a dependency list for all files c,s and cpp suffixes.
#
# Sub directories to be built are expected to be defined in the SUBDIRS macro.
# if it not defined the subdirs target is not seen.
#
# We build the man pages in the directories specified in the macro SUBDIRS
# before we deal with DOC_FILES in the current directory
ifeq ($(LIBNAME),)
LIBNAME = lib$(CPU)$(TOOL)vx.a
endif
LIBOBJS_DIRS = $(LIBDIR)
ifneq ($(strip $(LIBOBJS_PRECOMP)),)
LIBOBJS_DIRS += $(PRECOMPDIR)
endif
lib: $(LIBOBJS_DIRS) $(LIB_ROOT)/$(LIBNAME)
clean:
$(RM) $(LIBOBJS) $(LIBOBJS:.o=.d) $(LOCAL_CLEAN)
# This is believed to be obsolete. If it is needed we can bring it back
# ifneq ($(CLEANTAIL),)
# $(MAKE) -f Makefile CPU=$(CPU) TOOL=$(TOOL) \
# $(CLEANTAIL) \
# CLEANTAIL='')
# endif
$(LIB_ROOT)/$(LIBNAME): $(MAKE_LIBDIR) $(LIBOBJS)
@ - if [ -w $@ ] ; then \
(cd $(LIBDIR); \
if [ "x$?" != "x" ] ; then \
echo "$(AR) crus " $@ $?; \
$(AR) crus $@ $(notdir $?); \
fi)\
else \
(cd $(LIBDIR); \
$(RM) $@; \
echo "$(AR) crus " $@ $(LIBDIR)/"*.o"; \
$(AR) crus $@ *.o; \
) \
fi
LIBOBJS_DEPEND = $(filter-out $(foreach file, $(NODEPENDOBJS), $(LIBDIR)/$(file)), $(LIBOBJS))
depend: $(filter %.dummy_d, $(LIBOBJS_DEPEND:.o=.dummy_d))
- @ :
# Dependency list generation. We generate dependencies for the intersection of
# files listed in OBJS and file present in the local directory, and remove those
# specified in the NODEPENDOBJS list
depend.$(BUILD_EXT): Makefile
- @ $(RM) $@
- @ echo "Creating depend.$(BUILD_EXT)"
ifneq ($(strip $(filter-out $(NODEPENDOBJS), $(filter $(OBJS:.o=.c), \
$(wildcard *.c)))),)
$(CC) $(OPTION_DEPEND_GEN) $(CFLAGS) $(filter-out $(NODEPENDOBJS), \
$(filter $(OBJS:.o=.c), $(wildcard *.c))) >>$@;
endif
ifneq ($(strip $(filter-out $(NODEPENDOBJS), $(filter $(OBJS:.o=.s), \
$(wildcard *.s)))),)
$(CPP) $(OPTION_DEPEND_GEN) $(CASFLAGS) $(filter-out $(NODEPENDOBJS), \
$(filter $(OBJS:.o=.s), $(wildcard *.s))) >>$@;
endif
ifneq ($(strip $(filter-out $(NODEPENDOBJS), $(filter $(OBJS:.o=.cpp), \
$(wildcard *.cpp)))),)
$(CC) $(OPTION_DEPEND_GEN) $(CFLAGS) $(filter-out $(NODEPENDOBJS), \
$(filter $(OBJS:.o=.cpp), $(wildcard *.cpp))) >>$@;
endif
# Post process the dependencies to substitute WIND variables
- @ $(PROCESS_DEP)
ifneq ($(strip $(filter-out $(NODEPENDOBJS), $(filter $(OBJS_PRECOMP:.o=.c), \
$(wildcard *.c)))),)
$(CC) $(OPTION_DEPEND_GEN) $(CFLAGS) $(filter-out $(NODEPENDOBJS), \
$(filter $(OBJS_PRECOMP:.o=.c), $(wildcard *.c))) >>$@.precomp;
endif
ifneq ($(strip $(filter-out $(NODEPENDOBJS), $(filter $(OBJS_PRECOMP:.o=.s), \
$(wildcard *.s)))),)
$(CPP) $(OPTION_DEPEND_GEN) $(CASFLAGS) $(filter-out $(NODEPENDOBJS), \
$(filter $(OBJS_PRECOMP:.o=.s), $(wildcard *.s))) >>$@.precomp;
endif
ifneq ($(strip $(filter-out $(NODEPENDOBJS), $(filter $(OBJS_PRECOMP:.o=.cpp), \
$(wildcard *.cpp)))),)
$(CC) $(OPTION_DEPEND_GEN) $(CFLAGS) $(filter-out $(NODEPENDOBJS), \
$(filter $(OBJS_PRECOMP:.o=.cpp), $(wildcard *.cpp))) >>$@.precomp;
endif
- @ $(PROCESS_DEP_PRECOMP)
# if SUBDIRS is not null we need to build the subdirectories before building
# the current directory.
# if we have SUBDIRS
ifneq ($(SUBDIRS),)
subdirs : $(SUBDIRS)
$(SUBDIRS)::
cd $@ && $(MAKE) CPU=$(CPU) TOOL=$(TOOL) $(TARGET)
# No SUBDIRS
else
subdirs:
endif
########
#
# doc rules
# re-define the DOC_DIR for the libraries as the default DOC_DIR is for BSPs
DOC_DIR = $(DOCS_ROOT)/com.windriver.ide.doc.vxworks/vxworks_kernel_api_reference_6.2
DOC_OPTS = -mg -nostrict -missingok
# When the desired set of directories to be documented is different from the
# directories whose software must be built (common for component products),
# set DOCSUBDIRS to the subdirectories to be documented.
ifeq ($(DOCSUBDIRS),)
DOCSUBDIRS = $(SUBDIRS)
endif
ifneq ($(DOCSUBDIRS),)
# define the man target and the default output directory for libraries
man:
-for DIR in $(DOCSUBDIRS) ; \
do ( cd $$DIR; $(MAKE) CPU=$(CPU) TOOL=$(TOOL) man ) ; \
done
-$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/apigen $(DOC_OPTS) \
-book $(DOC_BOOK) -chapter $(DOC_CHAPTER) -out $(DOC_DIR) \
-set $(DOC_KERNEL) $(DOC_FILES)
-$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/apigen $(MAN_PAGE_OPTS) \
-book $(DOC_BOOK) -chapter $(DOC_CHAPTER) -out $(MAN_PAGE_DIR) \
-set $(DOC_KERNEL) $(DOC_FILES)
@date
link ::
-$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/htmlLink -R \
$(DOCS_ROOT)/com.windriver.ide.doc.vxworks
synopsis ::
-$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/syngen \
-d $(WIND_BASE)/host/resource/synopsis $(DOC_FILES)
for DIR in $(DOCSUBDIRS) ; \
do ( cd $$DIR; $(MAKE) CPU=$(CPU) TOOL=$(TOOL) synopsis ) ; \
done
@date
clean_synopsis ::
for DIR in $(DOCSUBDIRS) ; \
do ( cd $$DIR; $(MAKE) CPU=$(CPU) TOOL=$(TOOL) clean_synopsis ) ; \
done
ifneq ($(DOC_FILES),)
$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/syngen -clean \
-d $(WIND_BASE)/host/resource/synopsis
endif
# No DOCSUBDIRS
else
man:
-$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/apigen $(DOC_OPTS) \
-book $(DOC_BOOK) -chapter $(DOC_CHAPTER) -out $(DOC_DIR) \
-set $(DOC_KERNEL) $(DOC_FILES)
-$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/apigen $(MAN_PAGE_OPTS) \
-book $(DOC_BOOK) -chapter $(DOC_CHAPTER) -out $(MAN_PAGE_DIR) \
-set $(DOC_KERNEL) $(DOC_FILES)
@date
synopsis ::
ifneq ($(DOC_FILES),)
-$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/syngen \
-d $(WIND_BASE)/host/resource/synopsis $(DOC_FILES)
@date
endif
clean_synopsis ::
ifneq ($(DOC_FILES),)
$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/syngen -clean \
-d $(WIND_BASE)/host/resource/synopsis
endif
endif
# end doc rules
#
######