Skip to content

Commit 9b5f9d8

Browse files
authored
Add /testsuite/tools/Makefile and allow to use Flambda 2 libs (and fix .gitignore) (#109)
* Add testsuite/tools/Makefile * Allow testsuite/tools to use Flambda 2 libs
1 parent c7d2ca2 commit 9b5f9d8

File tree

3 files changed

+117
-13
lines changed

3 files changed

+117
-13
lines changed

.gitignore

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ _runtest/
4646
_stage2_configure/
4747
autom4te.cache
4848

49-
Makefile
50-
config.log
51-
config.status
52-
configure
53-
configure_opts
54-
ocaml-stage1-config.status
55-
ocaml-stage2-config.status
56-
ocamlopt_flags.sexp
57-
oc_cflags.sexp
58-
oc_cppflags.sexp
59-
sharedlib_cflags.sexp
49+
/Makefile
50+
/config.log
51+
/config.status
52+
/configure
53+
/configure_opts
54+
/ocaml-stage1-config.status
55+
/ocaml-stage2-config.status
56+
/ocamlopt_flags.sexp
57+
/oc_cflags.sexp
58+
/oc_cppflags.sexp
59+
/sharedlib_cflags.sexp

Makefile.in

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,6 @@ runtest-upstream:
232232
# replace backend-specific testsuite/tools with their new versions
233233
rm _runtest/testsuite/tools/*
234234
cp -a testsuite/tools/* _runtest/testsuite/tools/
235-
(cd _runtest/testsuite/tools && \
236-
ln -s ../../../ocaml/testsuite/tools/Makefile Makefile)
237235
(cd _runtest && ln -s ../ocaml/Makefile.tools Makefile.tools)
238236
(cd _runtest && ln -s ../ocaml/Makefile.build_config Makefile.build_config)
239237
(cd _runtest && ln -s ../ocaml/Makefile.config_if_required Makefile.config_if_required)
@@ -257,6 +255,12 @@ runtest-upstream:
257255
_runtest/compilerlibs
258256
cp _build2/install/default/lib/ocaml/compiler-libs/*.cmxa \
259257
_runtest/compilerlibs
258+
cp _build2/default/middle_end/flambda2/compilenv_deps/flambda2_compilenv_deps.cma \
259+
_runtest/compilerlibs
260+
cp _build2/default/middle_end/flambda2/flambda2.cma \
261+
_runtest/compilerlibs
262+
cp _build2/default/middle_end/flambda2/backend_intf/flambda2_backend_intf.cma \
263+
_runtest/compilerlibs
260264
mkdir _runtest/toplevel
261265
cp _build2/default/ocaml/toplevel/.ocamltoplevel.objs/byte/*.cm* \
262266
_runtest/toplevel/

testsuite/tools/Makefile

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
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

Comments
 (0)