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 17LEVEL := ../../.. 18LIBRARYNAME := llvm_$(TARGET) 19UsedComponents := $(TARGET) 20UsedOcamlInterfaces := llvm 21 22include $(LEVEL)/Makefile.config 23 24SOURCES := $(TARGET)_ocaml.c 25OcamlHeaders1 := $(PROJ_SRC_DIR)/llvm_$(TARGET).mli 26OcamlSources1 := $(PROJ_SRC_DIR)/llvm_$(TARGET).ml 27 28include ../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 43all-local:: copy-meta 44install-local:: install-meta 45uninstall-local:: uninstall-meta 46 47DestMETA := $(PROJ_libocamldir)/META.llvm_$(TARGET) 48 49# Easy way of generating META in the objdir 50copy-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 56install-meta:: $(OcamlDir)/META.llvm_$(TARGET) 57 $(Echo) "Install $(BuildMode) $(DestMETA)" 58 $(Verb) $(MKDIR) $(PROJ_libocamldir) 59 $(Verb) $(DataInstall) $< "$(DestMETA)" 60 61uninstall-meta:: 62 $(Echo) "Uninstalling $(DestMETA)" 63 -$(Verb) $(RM) -f "$(DestMETA)" 64 65.PHONY: copy-meta install-meta uninstall-meta 66