1 ##===- bindings/ocaml/backends/Makefile.common -------------*- Makefile -*-===##
3 # The LLVM Compiler Infrastructure
5 # This file is distributed under the University of Illinois Open Source
6 # License. See LICENSE.TXT for details.
8 ##===----------------------------------------------------------------------===##
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
15 ##===----------------------------------------------------------------------===##
18 LIBRARYNAME := llvm_$(TARGET)
19 UsedComponents := $(TARGET)
20 UsedOcamlInterfaces := llvm
22 include $(LEVEL)/Makefile.config
24 SOURCES := $(TARGET)_ocaml.c
25 OcamlHeaders1 := $(PROJ_SRC_DIR)/llvm_$(TARGET).mli
26 OcamlSources1 := $(PROJ_SRC_DIR)/llvm_$(TARGET).ml
28 include ../Makefile.ocaml
30 $(ObjDir)/llvm_$(TARGET).ml: $(PROJ_SRC_DIR)/llvm_backend.ml.in $(ObjDir)/.dir
31 $(Verb) $(SED) -e 's/@TARGET@/$(TARGET)/' $< > $@
33 $(ObjDir)/llvm_$(TARGET).mli: $(PROJ_SRC_DIR)/llvm_backend.mli.in $(ObjDir)/.dir
34 $(Verb) $(SED) -e 's/@TARGET@/$(TARGET)/' $< > $@
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 $@
41 ##===- OCamlFind Package --------------------------------------------------===##
44 install-local:: install-meta
45 uninstall-local:: uninstall-meta
47 DestMETA := $(PROJ_libocamldir)/META.llvm_$(TARGET)
49 # Easy way of generating META in the objdir
50 copy-meta: $(OcamlDir)/META.llvm_$(TARGET)
52 $(OcamlDir)/META.llvm_$(TARGET): META.llvm_backend.in
53 $(Verb) $(SED) -e 's/@TARGET@/$(TARGET)/' \
54 -e 's/@PACKAGE_VERSION@/$(LLVMVersion)/' $< > $@
56 install-meta:: $(OcamlDir)/META.llvm_$(TARGET)
57 $(Echo) "Install $(BuildMode) $(DestMETA)"
58 $(Verb) $(MKDIR) $(PROJ_libocamldir)
59 $(Verb) $(DataInstall) $< "$(DestMETA)"
62 $(Echo) "Uninstalling $(DestMETA)"
63 -$(Verb) $(RM) -f "$(DestMETA)"
65 .PHONY: copy-meta install-meta uninstall-meta