#************************************************************************** #* * #* OCaml * #* * #* David Allsopp, Tarides * #* * #* Copyright 2024 David Allsopp Ltd. * #* * #* All rights reserved. This file is distributed under the terms of * #* the GNU Lesser General Public License version 2.1, with the * #* special exception on linking described in the file LICENSE. * #* * #************************************************************************** ROOTDIR = ../.. include $(ROOTDIR)/Makefile.common ifeq "$(NATIVE_COMPILER)" "true" DRIVER = ../tools/test_in_prefix.opt$(EXE) else DRIVER = ../tools/test_in_prefix$(EXE) endif DRIVER_ARGS = \ $(VERBOSE_FLAG) --bindir "$(BINDIR)" --libdir '$(TARGET_LIBDIR)' \ $(call bool_to_with, ocamlnat, $(INSTALL_OCAMLNAT)) \ $(call bool_to_with, ocamlopt, $(NATIVE_COMPILER)) \ $(RUNTIME_SEARCH_FLAG) \ $(OTHERLIBRARIES) --pwd "$(SRCDIR_ABS)/testsuite/in_prefix" default: $(DRIVER) @$(info In order to execute the test itself, run $(MAKE) test-in-prefix) @$< $(DRIVER_ARGS) --summary ifeq "$(origin VERBOSE)" "command line" VERBOSE_FLAG = --verbose else VERBOSE_FLAG = endif # Generates --without-$(1) if $(2) is empty or --with-$(1)=$(2) otherwise RUNTIME_SEARCH_FLAG = \ $(if $(RUNTIME_SEARCH),$\ --with-runtime-search=$(RUNTIME_SEARCH),$\ --without-runtime-search) export PATH := $(SRCDIR_ABS)/testsuite/in_prefix/poisoned-runtime:$(PATH) ifeq "$(SUFFIXING)" "true" RUNTIME_NAME = ocamlrun-$(ZINC_RUNTIME_ID)$(EXE) else RUNTIME_NAME = ocamlrun$(EXE) endif test-in-prefix: $(DRIVER) ../tools/main_in_c.$(O) ../tools/dummy$(EXE) @rm -f ocamlrun* @$(LN) $(ROOTDIR)/runtime/ocamlrun$(EXE) test-$(RUNTIME_NAME) @$(MKDIR) poisoned-runtime @cd poisoned-runtime && $(LN) ../../tools/dummy$(EXE) $(RUNTIME_NAME) @$< $(DRIVER_ARGS) @rm -rf poisoned-runtime @rm -f test-ocamlrun* # Generates --without-$(1) if $(2) = false or --with-$(1) otherwise bool_to_with = --with$(if $(filter false,$(2)),out)-$(strip $(1)) ../tools/test_in_prefix$(EXE) \ ../tools/test_in_prefix.opt$(EXE): $(wildcard ../tools/*.ml*) ../tools/%: $(MAKE) -C $(ROOTDIR) testsuite/tools/$*