|
| 1 | +#************************************************************************** |
| 2 | +#* * |
| 3 | +#* OCaml * |
| 4 | +#* * |
| 5 | +#* Jeremie Dimino, Jane Street Europe * |
| 6 | +#* * |
| 7 | +#* Copyright 2016 Jane Street Group LLC * |
| 8 | +#* * |
| 9 | +#* All rights reserved. This file is distributed under the terms of * |
| 10 | +#* the GNU Lesser General Public License version 2.1, with the * |
| 11 | +#* special exception on linking described in the file LICENSE. * |
| 12 | +#* * |
| 13 | +#************************************************************************** |
| 14 | + |
| 15 | +.NOTPARALLEL: |
| 16 | + |
| 17 | +TOPDIR = ../.. |
| 18 | + |
| 19 | +COMPILERLIBSDIR = $(TOPDIR)/compilerlibs |
| 20 | + |
| 21 | +RUNTIME_VARIANT ?= |
| 22 | +ASPPFLAGS ?= |
| 23 | + |
| 24 | +include $(TOPDIR)/Makefile.tools |
| 25 | + |
| 26 | +expect_MAIN=expect_test |
| 27 | +expect_PROG=$(expect_MAIN)$(EXE) |
| 28 | +expect_DIRS = parsing utils driver typing toplevel |
| 29 | +expect_OCAMLFLAGS = $(addprefix -I $(TOPDIR)/,$(expect_DIRS)) |
| 30 | +expect_LIBS := $(addprefix $(COMPILERLIBSDIR)/,\ |
| 31 | + ocamlcommon ocamlbytecomp ocamltoplevel) |
| 32 | + |
| 33 | +codegen_PROG = codegen$(EXE) |
| 34 | +codegen_DIRS = parsing utils typing middle_end bytecomp lambda asmcomp |
| 35 | +codegen_OCAMLFLAGS = $(addprefix -I $(TOPDIR)/, $(codegen_DIRS)) -w +40 -g |
| 36 | + |
| 37 | +codegen_LIBS = $(addprefix $(COMPILERLIBSDIR)/,\ |
| 38 | + ocamlcommon flambda2_compilenv_deps flambda2_backend_intf flambda2 ocamloptcomp) |
| 39 | + |
| 40 | +codegen_OBJECTS = $(addsuffix .cmo,\ |
| 41 | + parsecmmaux parsecmm lexcmm codegen_main) |
| 42 | + |
| 43 | +tools := $(expect_PROG) |
| 44 | + |
| 45 | +ifeq "$(NATIVE_COMPILER)" "true" |
| 46 | +tools += $(codegen_PROG) |
| 47 | +ifneq "$(CCOMPTYPE)-$(ARCH)" "msvc-amd64" |
| 48 | +# The asmgen tests are not ported to MSVC64 yet |
| 49 | +# so do not compile any arch-specific module |
| 50 | +tools += asmgen_$(ARCH).$(O) |
| 51 | +endif |
| 52 | +endif |
| 53 | + |
| 54 | +all: $(tools) |
| 55 | + |
| 56 | +$(expect_PROG): $(expect_LIBS:=.cma) $(expect_MAIN).cmo |
| 57 | + $(OCAMLC) -linkall -o $@ $^ |
| 58 | + |
| 59 | +$(expect_PROG): COMPFLAGS = $(expect_OCAMLFLAGS) |
| 60 | + |
| 61 | +$(codegen_PROG): COMPFLAGS = $(codegen_OCAMLFLAGS) |
| 62 | + |
| 63 | +codegen_main.cmo: parsecmm.cmo |
| 64 | + |
| 65 | +$(codegen_PROG): $(codegen_OBJECTS) |
| 66 | + $(OCAMLC) -o $@ $(codegen_LIBS:=.cma) $^ |
| 67 | + |
| 68 | +parsecmm.mli parsecmm.ml: parsecmm.mly |
| 69 | + $(OCAMLYACC) -q parsecmm.mly |
| 70 | + |
| 71 | +lexcmm.ml: lexcmm.mll |
| 72 | + $(OCAMLLEX) -q lexcmm.mll |
| 73 | + |
| 74 | +parsecmmaux.cmo: parsecmmaux.cmi |
| 75 | + |
| 76 | +lexcmm.cmo: lexcmm.cmi |
| 77 | + |
| 78 | +parsecmm.cmo: parsecmm.cmi |
| 79 | + |
| 80 | +asmgen_i386.obj: asmgen_i386nt.asm |
| 81 | + @set -o pipefail ; \ |
| 82 | + $(ASM) $@ $^ | tail -n +2 |
| 83 | + |
| 84 | +%.cmi: %.mli |
| 85 | + $(OCAMLC) -c $< |
| 86 | + |
| 87 | +%.cmo: %.ml |
| 88 | + $(OCAMLC) -c $< |
| 89 | + |
| 90 | +%.cmx: %.ml |
| 91 | + $(OCAMLOPT) -c $< |
| 92 | + |
| 93 | +%.$(O): %.S |
| 94 | + $(ASPP) $(ASPPFLAGS) -DSYS_$(SYSTEM) -DMODEL_$(MODEL) -o $@ $< |
| 95 | + |
| 96 | +.PHONY: clean |
| 97 | +clean: |
| 98 | + rm -f *.cm* *.o *.obj |
| 99 | + rm -f expect_test expect_test.exe codegen codegen.exe |
| 100 | + rm -f parsecmm.ml parsecmm.mli lexcmm.ml |
0 commit comments