Skip to content
Makefile.rules 70.7 KiB
Newer Older
Reid Spencer's avatar
Reid Spencer committed
	  fi; \
	done
	$(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
	  $(EchoCmd) Eliminating CVS/.svn directories from distribution ; \
	  $(RM) -rf `find $(TopDistDir) -type d \( -name CVS -o \
                                  -name .svn \) -print` ;\
	  $(MAKE) dist-hook ; \
	  $(FIND) $(TopDistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; \
	    -o ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; \
	    -o ! -type d ! -perm -400 -exec chmod a+r {} \; \
	    -o ! -type d ! -perm -444 -exec \
	      $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
	    || chmod -R a+r $(DistDir) ; \
	fi
# This is invoked by distdir target, define it as a no-op to avoid errors if not
# defined by user.
Reid Spencer's avatar
Reid Spencer committed
dist-hook::

endif

###############################################################################
# TOP LEVEL - targets only to apply at the top level directory
###############################################################################

ifeq ($(LEVEL),.)
Reid Spencer's avatar
Reid Spencer committed

#------------------------------------------------------------------------
# Install support for the project's include files:
Reid Spencer's avatar
Reid Spencer committed
#------------------------------------------------------------------------
ifdef NO_INSTALL
install-local::
	$(Echo) Install circumvented with NO_INSTALL
uninstall-local::
	$(Echo) Uninstall circumvented with NO_INSTALL
else
Reid Spencer's avatar
Reid Spencer committed
install-local::
	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_includedir)
Reid Spencer's avatar
Reid Spencer committed
	$(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \
Reid Spencer's avatar
Reid Spencer committed
	  cd $(PROJ_SRC_ROOT)/include && \
	  for  hdr in `find . -type f '!' '(' -name '*~' \
	      -o -name '.#*' -o -name '*.in' ')' -print | grep -v CVS | \
	      grep -v .svn` ; do \
	    instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
Reid Spencer's avatar
Reid Spencer committed
	    if test \! -d "$$instdir" ; then \
	      $(EchoCmd) Making install directory $$instdir ; \
	      $(MKDIR) $$instdir ;\
	    fi ; \
	    $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
Reid Spencer's avatar
Reid Spencer committed
ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
Reid Spencer's avatar
Reid Spencer committed
	$(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \
Reid Spencer's avatar
Reid Spencer committed
	  for hdr in `find . -type f -print | grep -v CVS` ; do \
	    $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
Reid Spencer's avatar
Reid Spencer committed
endif
Reid Spencer's avatar
Reid Spencer committed

uninstall-local::
Reid Spencer's avatar
Reid Spencer committed
	$(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \
	  cd $(PROJ_SRC_ROOT)/include && \
Reid Spencer's avatar
Reid Spencer committed
	    $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
	      '!' '(' -name '*~' -o -name '.#*' \
Chris Lattner's avatar
Chris Lattner committed
        -o -name '*.in' ')' -print ')' | \
        grep -v CVS | sed 's#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
	  cd $(PROJ_SRC_ROOT)/include && \
Chris Lattner's avatar
Chris Lattner committed
	    $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' \
      -print ')' | sed 's#\.in$$##;s#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
	@echo searching for overlength lines in files: $(Sources)
	@echo
	@echo
	egrep -n '.{81}' $(Sources) /dev/null
	@echo searching for tabs in files: $(Sources)
	@echo
	@echo
	egrep -n '	' $(Sources) /dev/null
check-footprint:
	@ls -l $(LibDir) | awk '\
	  BEGIN { sum = 0; } \
	        { sum += $$5; } \
	  END   { printf("Libraries: %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
	@ls -l $(ToolDir) | awk '\
	  BEGIN { sum = 0; } \
	        { sum += $$5; } \
	  END   { printf("Programs:  %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
#------------------------------------------------------------------------
# Print out the directories used for building
#------------------------------------------------------------------------
Reid Spencer's avatar
Reid Spencer committed
printvars::
Reid Spencer's avatar
Reid Spencer committed
	$(Echo) "BuildMode    : " '$(BuildMode)'
	$(Echo) "PROJ_SRC_ROOT: " '$(PROJ_SRC_ROOT)'
	$(Echo) "PROJ_SRC_DIR : " '$(PROJ_SRC_DIR)'
	$(Echo) "PROJ_OBJ_ROOT: " '$(PROJ_OBJ_ROOT)'
	$(Echo) "PROJ_OBJ_DIR : " '$(PROJ_OBJ_DIR)'
	$(Echo) "LLVM_SRC_ROOT: " '$(LLVM_SRC_ROOT)'
	$(Echo) "LLVM_OBJ_ROOT: " '$(LLVM_OBJ_ROOT)'
	$(Echo) "PROJ_prefix  : " '$(PROJ_prefix)'
	$(Echo) "PROJ_bindir  : " '$(PROJ_bindir)'
	$(Echo) "PROJ_libdir  : " '$(PROJ_libdir)'
	$(Echo) "PROJ_etcdir  : " '$(PROJ_etcdir)'
	$(Echo) "PROJ_includedir  : " '$(PROJ_includedir)'
Reid Spencer's avatar
Reid Spencer committed
	$(Echo) "UserTargets  : " '$(UserTargets)'
	$(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
	$(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
	$(Echo) "ObjDir       : " '$(ObjDir)'
	$(Echo) "LibDir       : " '$(LibDir)'
	$(Echo) "ToolDir      : " '$(ToolDir)'
	$(Echo) "ExmplDir     : " '$(ExmplDir)'
	$(Echo) "Sources      : " '$(Sources)'
	$(Echo) "TDFiles      : " '$(TDFiles)'
	$(Echo) "INCFiles     : " '$(INCFiles)'
	$(Echo) "INCTMPFiles  : " '$(INCTMPFiles)'
	$(Echo) "PreConditions: " '$(PreConditions)'
Reid Spencer's avatar
Reid Spencer committed
	$(Echo) "Compile.CXX  : " '$(Compile.CXX)'
	$(Echo) "Compile.C    : " '$(Compile.C)'
	$(Echo) "Archive      : " '$(Archive)'
	$(Echo) "YaccFiles    : " '$(YaccFiles)'
	$(Echo) "LexFiles     : " '$(LexFiles)'
	$(Echo) "Module       : " '$(Module)'
Reid Spencer's avatar
Reid Spencer committed
	$(Echo) "FilesToConfig: " '$(FilesToConfigPATH)'
	$(Echo) "SubDirs      : " '$(SubDirs)'
Reid Spencer's avatar
Reid Spencer committed
	$(Echo) "ProjLibsPaths: " '$(ProjLibsPaths)'
	$(Echo) "ProjLibsOptions: " '$(ProjLibsOptions)'
# General debugging rule, use 'make dbg-print-XXX' to print the
# definition, value and origin of XXX.
	$(error PRINT: $(value $*) = "$($*)" (from $(origin $*)))