Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefiles: fix KRML_HOME to work with Cygwin #503

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions krmllib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,14 @@ $(MINI_DIR):
$(GENERIC_DIR):
mkdir -p $@

local_krml_home := $(realpath $(CURDIR)/..)
ifeq ($(OS),Windows_NT)
local_krml_home := $(shell cygpath -m "$(local_krml_home)")
endif

# Everything in the universe
$(GENERIC_DIR)/Makefile.include: $(ALL_KRML_FILES) | $(GENERIC_DIR) $(wildcard c/*.c) $(wildcard c/*.h) ../_build/default/src/Karamel.exe
KRML_HOME=$(shell pwd)/.. \
KRML_HOME="$(local_krml_home)" \
../krml $(KRML_ARGS) -tmpdir $(GENERIC_DIR) \
-warn-error +9+11 \
$(MACHINE_INTS) \
Expand All @@ -133,7 +138,7 @@ $(GENERIC_DIR)/Makefile.include: $(ALL_KRML_FILES) | $(GENERIC_DIR) $(wildcard c
# Minimalistic build (just machine integers and endianness)
$(MINI_DIR)/Makefile.include: $(ALL_KRML_FILES) | $(MINI_DIR) $(wildcard c/fstar_uint128*.h) ../_build/default/src/Karamel.exe
mkdir -p $(dir $@)
KRML_HOME=$(shell pwd)/.. \
KRML_HOME="$(local_krml_home)" \
../krml $(KRML_ARGS) -tmpdir $(MINI_DIR) \
$(MACHINE_INTS) \
$(addprefix -add-include , \
Expand All @@ -153,7 +158,7 @@ $(MINI_DIR)/Makefile.include: $(ALL_KRML_FILES) | $(MINI_DIR) $(wildcard c/fstar
# FStar.UInt64 shares the same bundle name, meaning that
# FStar_UInt128_Verified.h can be dropped in any of the two krmllibs above.
$(UINT128_DIR)/Makefile.include: $(ALL_KRML_FILES) | $(GENERIC_DIR) $(MINI_DIR) ../_build/default/src/Karamel.exe
KRML_HOME=$(shell pwd)/.. \
KRML_HOME="$(local_krml_home)" \
../krml $(KRML_ARGS) -tmpdir $(UINT128_DIR) \
$(addprefix -add-include ,'<inttypes.h>' '<stdbool.h>' '"krml/internal/types.h"' '"krml/internal/target.h"') \
-bundle FStar.UInt64[rename=FStar_UInt_8_16_32_64] \
Expand All @@ -178,5 +183,5 @@ compile-all: compile-dist-generic $(MINI_DIR)/Makefile.include $(UINT128_DIR)/Ma

.PHONY: compile-dist-%
compile-dist-%: dist/%/Makefile.include
KRML_HOME=$(shell pwd)/.. \
KRML_HOME="$(local_krml_home)" \
$(MAKE) -C dist/$* -f Makefile.basic
5 changes: 4 additions & 1 deletion test/sepcomp/a/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ PROJECT_HOME ?= .

ifeq (,$(KRML_HOME))
# assuming test/sepcomp/a
KRML_HOME=$(CURDIR)/../../..
KRML_HOME := $(realpath $(CURDIR)/../../..)
endif
ifeq ($(OS),Windows_NT)
KRML_HOME := $(shell cygpath -m "$(KRML_HOME)")
endif
export KRML_HOME

Expand Down
7 changes: 5 additions & 2 deletions test/sepcomp/b/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
PROJECT_HOME ?= .

ifeq (,$(KRML_HOME))
# assuming test/sepcomp/b
KRML_HOME=$(CURDIR)/../../..
# assuming test/sepcomp/a
KRML_HOME := $(realpath $(CURDIR)/../../..)
endif
ifeq ($(OS),Windows_NT)
KRML_HOME := $(shell cygpath -m "$(KRML_HOME)")
endif
export KRML_HOME

Expand Down