]> git.proxmox.com Git - rustc.git/blob - src/llvm/bindings/ocaml/backends/Makefile.common
Imported Upstream version 1.0.0+dfsg1
[rustc.git] / src / llvm / bindings / ocaml / backends / Makefile.common
1 ##===- bindings/ocaml/backends/Makefile.common -------------*- Makefile -*-===##
2 #
3 # The LLVM Compiler Infrastructure
4 #
5 # This file is distributed under the University of Illinois Open Source
6 # License. See LICENSE.TXT for details.
7 #
8 ##===----------------------------------------------------------------------===##
9 #
10 # This is the slave makefile for backend-specific bindings. This makefile should
11 # be included after defining TARGET. It will then substitute @TARGET@ for
12 # the value of TARGET in various *.in files and build an OCaml library in
13 # a regular way.
14 #
15 ##===----------------------------------------------------------------------===##
16
17 LEVEL := ../../..
18 LIBRARYNAME := llvm_$(TARGET)
19 UsedComponents := $(TARGET)
20 UsedOcamlInterfaces := llvm
21
22 include $(LEVEL)/Makefile.config
23
24 SOURCES := $(TARGET)_ocaml.c
25 OcamlHeaders1 := $(PROJ_SRC_DIR)/llvm_$(TARGET).mli
26 OcamlSources1 := $(PROJ_SRC_DIR)/llvm_$(TARGET).ml
27
28 include ../Makefile.ocaml
29
30 $(ObjDir)/llvm_$(TARGET).ml: $(PROJ_SRC_DIR)/llvm_backend.ml.in $(ObjDir)/.dir
31 $(Verb) $(SED) -e 's/@TARGET@/$(TARGET)/' $< > $@
32
33 $(ObjDir)/llvm_$(TARGET).mli: $(PROJ_SRC_DIR)/llvm_backend.mli.in $(ObjDir)/.dir
34 $(Verb) $(SED) -e 's/@TARGET@/$(TARGET)/' $< > $@
35
36 $(ObjDir)/$(TARGET)_ocaml.o: $(PROJ_SRC_DIR)/backend_ocaml.c $(ObjDir)/.dir
37 $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
38 $(Verb) $(Compile.C) -DTARGET=$(TARGET) $< -o $@
39
40
41 ##===- OCamlFind Package --------------------------------------------------===##
42
43 all-local:: copy-meta
44 install-local:: install-meta
45 uninstall-local:: uninstall-meta
46
47 DestMETA := $(PROJ_libocamldir)/META.llvm_$(TARGET)
48
49 # Easy way of generating META in the objdir
50 copy-meta: $(OcamlDir)/META.llvm_$(TARGET)
51
52 $(OcamlDir)/META.llvm_$(TARGET): META.llvm_backend.in
53 $(Verb) $(SED) -e 's/@TARGET@/$(TARGET)/' \
54 -e 's/@PACKAGE_VERSION@/$(LLVMVersion)/' $< > $@
55
56 install-meta:: $(OcamlDir)/META.llvm_$(TARGET)
57 $(Echo) "Install $(BuildMode) $(DestMETA)"
58 $(Verb) $(MKDIR) $(PROJ_libocamldir)
59 $(Verb) $(DataInstall) $< "$(DestMETA)"
60
61 uninstall-meta::
62 $(Echo) "Uninstalling $(DestMETA)"
63 -$(Verb) $(RM) -f "$(DestMETA)"
64
65 .PHONY: copy-meta install-meta uninstall-meta