Author: gordon
Date: Mon Dec  3 15:15:53 2007
New Revision: 44547

URL: http://llvm.org/viewvc/llvm-project?rev=44547&view=rev
Log:
Track dependencies when creating symlinks to LLVM libraries next
to the ocaml bindings. This is required on Windows where 'ln -sf'
actually creates a copy. Thanks to Alain Frisch for noticing this.

Modified:
    llvm/trunk/bindings/ocaml/Makefile.ocaml

Modified: llvm/trunk/bindings/ocaml/Makefile.ocaml
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/Makefile.ocaml?rev=44547&r1=44546&r2=44547&view=diff

==============================================================================
--- llvm/trunk/bindings/ocaml/Makefile.ocaml (original)
+++ llvm/trunk/bindings/ocaml/Makefile.ocaml Mon Dec  3 15:15:53 2007
@@ -70,11 +70,13 @@
 OutputCMXA := $(LibraryCMXA:$(ObjDir)/%.cmxa=$(OcamlDir)/%.cmxa)
 OutputsCMI := $(ObjectsCMI:$(ObjDir)/%.cmi=$(OcamlDir)/%.cmi)
 OutputsCMX := $(ObjectsCMX:$(ObjDir)/%.cmx=$(OcamlDir)/%.cmx)
+OutputLibs := $(UsedLibNames:%=$(OcamlDir)/%)
 
 # Installation targets
 DestA    := $(PROJ_libocamldir)/lib$(LIBRARYNAME).a
 DestCMA  := $(PROJ_libocamldir)/$(LIBRARYNAME).cma
 DestCMXA := $(PROJ_libocamldir)/$(LIBRARYNAME).cmxa
+DestLibs := $(UsedLibNames:%=$(PROJ_libocamldir)/%)
 
 
 ##===- Dependencies 
-------------------------------------------------------===##
@@ -123,6 +125,30 @@
        -$(Verb) $(RM) -f $(DestA)
 
 
+##===- Deposit dependent libraries adjacent to Ocaml libs 
-----------------===##
+
+all-local:: build-deplibs
+clean-local:: clean-deplibs
+install-local:: install-deplibs
+uninstall-local:: uninstall-deplibs
+
+build-deplibs: $(OutputLibs)
+
+$(OcamlDir)/%.a: $(LibDir)/%.a
+       $(Verb) ln -sf $< $@
+
+clean-deplibs:
+       $(Verb) rm -f $(OutputLibs)
+
+install-deplibs:
+       $(Verb) for i in $(DestLibs:$(PROJ_libocamldir)/%=%); do \
+         ln -sf "$(PROJ_libdir)/$$i" "$(PROJ_libocamldir)/$$i"; \
+       done
+
+uninstall-deplibs:
+       $(Verb) rm -f $(DestLibs)
+
+
 ##===- Build ocaml interfaces (.mli's -> .cmi's) 
--------------------------===##
 
 all-local:: build-cmis
@@ -178,9 +204,6 @@
 $(LibraryCMA): $(ObjectsCMO) $(OcamlDir)/.dir
        $(Echo) "Archiving $(notdir $@) for $(BuildMode) build"
        $(Verb) $(Archive.CMA) $@ $(ObjectsCMO)
-       $(Verb) for i in $(UsedLibNames); do \
-         ln -sf "$(LibDir)/$$i" "$(OcamlDir)/$$i"; \
-       done
 
 $(ObjDir)/%.cmo: $(ObjDir)/%.ml
        $(Echo) "Compiling $(notdir $<) for $(BuildMode) build"
@@ -193,16 +216,10 @@
        $(Echo) "Installing $(BuildMode) $(DestCMA)"
        $(Verb) $(MKDIR) $(PROJ_libocamldir)
        $(Verb) $(DataInstall) $(OutputCMA) "$(DestCMA)"
-       $(Verb) for i in $(UsedLibNames); do \
-         ln -sf "$(PROJ_libdir)/$$i" "$(PROJ_libocamldir)/$$i"; \
-       done
 
 uninstall-cma::
        $(Echo) "Uninstalling $(DestCMA)"
        -$(Verb) $(RM) -f $(DestCMA)
-       $(Verb) for i in $(UsedLibNames); do \
-         $(RM) -f "$(PROJ_libocamldir)/$$i"; \
-       done
 
 
 ##===- Build optimized ocaml archive (.ml's -> .cmx's -> .cmxa, .a) 
-------===##


_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to