Skip to content

Commit

Permalink
Rewrite makefiles to explicitly reference DESTDIR to fix bug 3153.
Browse files Browse the repository at this point in the history
We need this so can not bake DESTDIR into the O'Caml symlinks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97743 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Erick Tryzelaar committed Mar 4, 2010
1 parent 3cfe010 commit d4076cf
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 51 deletions.
16 changes: 8 additions & 8 deletions Makefile.config.in
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ endif

LLVMMAKE := $(LLVM_SRC_ROOT)/make

PROJ_bindir := $(DESTDIR)$(PROJ_prefix)/bin
PROJ_libdir := $(DESTDIR)$(PROJ_prefix)/lib
PROJ_datadir := $(DESTDIR)$(PROJ_prefix)/share
PROJ_docsdir := $(DESTDIR)$(PROJ_prefix)/docs/llvm
PROJ_etcdir := $(DESTDIR)$(PROJ_prefix)/etc/llvm
PROJ_includedir := $(DESTDIR)$(PROJ_prefix)/include
PROJ_infodir := $(DESTDIR)$(PROJ_prefix)/info
PROJ_mandir := $(DESTDIR)$(PROJ_prefix)/share/man
PROJ_bindir := $(PROJ_prefix)/bin
PROJ_libdir := $(PROJ_prefix)/lib
PROJ_datadir := $(PROJ_prefix)/share
PROJ_docsdir := $(PROJ_prefix)/docs/llvm
PROJ_etcdir := $(PROJ_prefix)/etc/llvm
PROJ_includedir := $(PROJ_prefix)/include
PROJ_infodir := $(PROJ_prefix)/info
PROJ_mandir := $(PROJ_prefix)/share/man

# Determine if we're on a unix type operating system
LLVM_ON_UNIX:=@LLVM_ON_UNIX@
Expand Down
46 changes: 23 additions & 23 deletions Makefile.rules
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
# in the file so they get built before dependencies
#---------------------------------------------------------

$(PROJ_bindir) $(PROJ_libdir) $(PROJ_includedir) $(PROJ_etcdir)::
$(DESTDIR)$(PROJ_bindir) $(DESTDIR)$(PROJ_libdir) $(DESTDIR)$(PROJ_includedir) $(DESTDIR)$(PROJ_etcdir)::
$(Verb) $(MKDIR) $@

# To create other directories, as needed, and timestamp their creation
Expand Down Expand Up @@ -904,22 +904,22 @@ install-local::
uninstall-local::
$(Echo) UnInstall circumvented with NO_INSTALL
else
install-local:: $(PROJ_etcdir) $(CONFIG_FILES)
$(Echo) Installing Configuration Files To $(PROJ_etcdir)
install-local:: $(DESTDIR)$(PROJ_etcdir) $(CONFIG_FILES)
$(Echo) Installing Configuration Files To $(DESTDIR)$(PROJ_etcdir)
$(Verb)for file in $(CONFIG_FILES); do \
if test -f $(PROJ_OBJ_DIR)/$${file} ; then \
$(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(PROJ_etcdir) ; \
$(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
elif test -f $(PROJ_SRC_DIR)/$${file} ; then \
$(DataInstall) $(PROJ_SRC_DIR)/$${file} $(PROJ_etcdir) ; \
$(DataInstall) $(PROJ_SRC_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
else \
$(ECHO) Error: cannot find config file $${file}. ; \
fi \
done

uninstall-local::
$(Echo) Uninstalling Configuration Files From $(PROJ_etcdir)
$(Echo) Uninstalling Configuration Files From $(DESTDIR)$(PROJ_etcdir)
$(Verb)for file in $(CONFIG_FILES); do \
$(RM) -f $(PROJ_etcdir)/$${file} ; \
$(RM) -f $(DESTDIR)$(PROJ_etcdir)/$${file} ; \
done
endif

Expand Down Expand Up @@ -1011,7 +1011,7 @@ endif
ifdef BYTECODE_DESTINATION
ModuleDestDir := $(BYTECODE_DESTINATION)
else
ModuleDestDir := $(PROJ_libdir)
ModuleDestDir := $(DESTDIR)$(PROJ_libdir)
endif

ifdef NO_INSTALL
Expand Down Expand Up @@ -1090,17 +1090,17 @@ install-local::
uninstall-local::
$(Echo) Uninstall circumvented with NO_INSTALL
else
DestSharedLib = $(PROJ_libdir)/lib$(LIBRARYNAME)$(SHLIBEXT)
DestSharedLib = $(DESTDIR)$(PROJ_libdir)/lib$(LIBRARYNAME)$(SHLIBEXT)

install-local:: $(DestSharedLib)

$(DestSharedLib): $(LibName.SO) $(PROJ_libdir)
$(DestSharedLib): $(LibName.SO) $(DESTDIR)$(PROJ_libdir)
$(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
$(Verb) $(INSTALL) $(LibName.SO) $(DestSharedLib)

uninstall-local::
$(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
-$(Verb) $(RM) -f $(PROJ_libdir)/lib$(LIBRARYNAME).*
-$(Verb) $(RM) -f $(DESTDIR)$(PROJ_libdir)/lib$(LIBRARYNAME).*
endif
endif

Expand Down Expand Up @@ -1144,7 +1144,7 @@ endif
ifdef BYTECODE_DESTINATION
BytecodeDestDir := $(BYTECODE_DESTINATION)
else
BytecodeDestDir := $(PROJ_libdir)
BytecodeDestDir := $(DESTDIR)$(PROJ_libdir)
endif

DestBytecodeLib = $(BytecodeDestDir)/lib$(LIBRARYNAME).bca
Expand Down Expand Up @@ -1209,13 +1209,13 @@ install-local::
uninstall-local::
$(Echo) Uninstall circumvented with NO_INSTALL
else
DestArchiveLib := $(PROJ_libdir)/lib$(LIBRARYNAME).a
DestArchiveLib := $(DESTDIR)$(PROJ_libdir)/lib$(LIBRARYNAME).a

install-local:: $(DestArchiveLib)

$(DestArchiveLib): $(LibName.A) $(PROJ_libdir)
$(DestArchiveLib): $(LibName.A) $(DESTDIR)$(PROJ_libdir)
$(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
$(Verb) $(MKDIR) $(PROJ_libdir)
$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_libdir)
$(Verb) $(INSTALL) $(LibName.A) $(DestArchiveLib)

uninstall-local::
Expand Down Expand Up @@ -1315,11 +1315,11 @@ install-local::
uninstall-local::
$(Echo) Uninstall circumvented with NO_INSTALL
else
DestTool = $(PROJ_bindir)/$(TOOLEXENAME)
DestTool = $(DESTDIR)$(PROJ_bindir)/$(TOOLEXENAME)

install-local:: $(DestTool)

$(DestTool): $(ToolBuildPath) $(PROJ_bindir)
$(DestTool): $(ToolBuildPath) $(DESTDIR)$(PROJ_bindir)
$(Echo) Installing $(BuildMode) $(DestTool)
$(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool)

Expand Down Expand Up @@ -1964,25 +1964,25 @@ uninstall-local::
else
install-local::
$(Echo) Installing include files
$(Verb) $(MKDIR) $(PROJ_includedir)
$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_includedir)
$(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \
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 "$(PROJ_includedir)/$$hdr"` ; \
instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
if test \! -d "$$instdir" ; then \
$(EchoCmd) Making install directory $$instdir ; \
$(MKDIR) $$instdir ;\
fi ; \
$(DataInstall) $$hdr $(PROJ_includedir)/$$hdr ; \
$(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
done ; \
fi
ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
$(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \
cd $(PROJ_OBJ_ROOT)/include && \
for hdr in `find . -type f -print | grep -v CVS` ; do \
$(DataInstall) $$hdr $(PROJ_includedir)/$$hdr ; \
$(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
done ; \
fi
endif
Expand All @@ -1994,10 +1994,10 @@ uninstall-local::
$(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
'!' '(' -name '*~' -o -name '.#*' \
-o -name '*.in' ')' -print ')' | \
grep -v CVS | sed 's#^#$(PROJ_includedir)/#'` ; \
grep -v CVS | sed 's#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
cd $(PROJ_SRC_ROOT)/include && \
$(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' \
-print ')' | sed 's#\.in$$##;s#^#$(PROJ_includedir)/#'` ; \
-print ')' | sed 's#\.in$$##;s#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
fi
endif
endif
Expand Down
6 changes: 3 additions & 3 deletions docs/CommandGuide/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ EXTRA_DIST := $(POD) index.html
clean-local::
$(Verb) $(RM) -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)

HTML_DIR := $(PROJ_docsdir)/html/CommandGuide
MAN_DIR := $(PROJ_mandir)/man1
PS_DIR := $(PROJ_docsdir)/ps
HTML_DIR := $(DESTDIR)$(PROJ_docsdir)/html/CommandGuide
MAN_DIR := $(DESTDIR)$(PROJ_mandir)/man1
PS_DIR := $(DESTDIR)$(PROJ_docsdir)/ps

install-local:: $(HTML) $(INSTALL_MANS) $(PS)
$(Echo) Installing HTML CommandGuide Documentation
Expand Down
24 changes: 12 additions & 12 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ generated:: doxygen ocamldoc

install-html: $(PROJ_OBJ_DIR)/html.tar.gz
$(Echo) Installing HTML documentation
$(Verb) $(MKDIR) $(PROJ_docsdir)/html
$(Verb) $(MKDIR) $(PROJ_docsdir)/html/img
$(Verb) $(DataInstall) $(HTML) $(PROJ_docsdir)/html
$(Verb) $(DataInstall) $(IMAGES) $(PROJ_docsdir)/html/img
$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/html.tar.gz $(PROJ_docsdir)
$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html
$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/img
$(Verb) $(DataInstall) $(HTML) $(DESTDIR)$(PROJ_docsdir)/html
$(Verb) $(DataInstall) $(IMAGES) $(DESTDIR)$(PROJ_docsdir)/html/img
$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/html.tar.gz $(DESTDIR)$(PROJ_docsdir)

$(PROJ_OBJ_DIR)/html.tar.gz: $(HTML)
$(Echo) Packaging HTML documentation
Expand All @@ -63,11 +63,11 @@ $(PROJ_OBJ_DIR)/html.tar.gz: $(HTML)

install-doxygen: doxygen
$(Echo) Installing doxygen documentation
$(Verb) $(MKDIR) $(PROJ_docsdir)/html/doxygen
$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(PROJ_docsdir)
$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/doxygen
$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(DESTDIR)$(PROJ_docsdir)
$(Verb) cd $(PROJ_OBJ_DIR)/doxygen && \
$(FIND) . -type f -exec \
$(DataInstall) {} $(PROJ_docsdir)/html/doxygen \;
$(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/html/doxygen \;

doxygen: regendoc $(PROJ_OBJ_DIR)/doxygen.tar.gz

Expand All @@ -94,11 +94,11 @@ $(LLVM_SRC_ROOT)/docs/userloc.html:

install-ocamldoc: ocamldoc
$(Echo) Installing ocamldoc documentation
$(Verb) $(MKDIR) $(PROJ_docsdir)/ocamldoc/html
$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(PROJ_docsdir)
$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html
$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(DESTDIR)$(PROJ_docsdir)
$(Verb) cd $(PROJ_OBJ_DIR)/ocamldoc && \
$(FIND) . -type f -exec \
$(DataInstall) {} $(PROJ_docsdir)/ocamldoc/html \;
$(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html \;

ocamldoc: regen-ocamldoc
$(Echo) Packaging ocamldoc documentation
Expand All @@ -120,4 +120,4 @@ regen-ocamldoc:

uninstall-local::
$(Echo) Uninstalling Documentation
$(Verb) $(RM) -rf $(PROJ_docsdir)
$(Verb) $(RM) -rf $(DESTDIR)$(PROJ_docsdir)
2 changes: 1 addition & 1 deletion docs/tutorial/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ include $(LEVEL)/Makefile.common

HTML := $(wildcard $(PROJ_SRC_DIR)/*.html)
EXTRA_DIST := $(HTML) index.html
HTML_DIR := $(PROJ_docsdir)/html/tutorial
HTML_DIR := $(DESTDIR)$(PROJ_docsdir)/html/tutorial

install-local:: $(HTML)
$(Echo) Installing HTML Tutorial Documentation
Expand Down
4 changes: 2 additions & 2 deletions lib/VMCore/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ $(GENFILE): $(ObjDir)/Intrinsics.gen.tmp
changed significantly. )

install-local:: $(GENFILE)
$(Echo) Installing $(PROJ_includedir)/llvm/Intrinsics.gen
$(Verb) $(DataInstall) $(GENFILE) $(PROJ_includedir)/llvm/Intrinsics.gen
$(Echo) Installing $(DESTDIR)$(PROJ_includedir)/llvm/Intrinsics.gen
$(Verb) $(DataInstall) $(GENFILE) $(DESTDIR)$(PROJ_includedir)/llvm/Intrinsics.gen
4 changes: 2 additions & 2 deletions tools/llvm-config/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,6 @@ clean-local::
$(LibDeps) GenLibDeps.out
install-local:: all-local
$(Echo) Installing llvm-config
$(Verb) $(MKDIR) $(PROJ_bindir)
$(Verb) $(ScriptInstall) $(ToolDir)/llvm-config $(PROJ_bindir)
$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_bindir)
$(Verb) $(ScriptInstall) $(ToolDir)/llvm-config $(DESTDIR)$(PROJ_bindir)

0 comments on commit d4076cf

Please sign in to comment.