mirror of
https://github.com/GaloisInc/cryptol.git
synced 2024-09-21 10:58:01 +03:00
27ac8d9717
This patch: * Adds the appropriate conditional logic to use the `Win32` library to dynamically load shared libraries on Windows. * Tweaks some FFI-related test cases to make them work portably on Windows. I have left comments describing each of the non-obvious tweaks that I had to make. * Updates the reference manual accordingly. Fixes #1394.
40 lines
783 B
Makefile
40 lines
783 B
Makefile
CFLAGS += -Wall -Werror
|
|
LDLIBS += -lgmp
|
|
|
|
# For each C file foo.c, we make a phony target foo, then depending on the OS
|
|
# map that to foo.dylib, foo.so, or foo.dll.
|
|
|
|
CFILES = $(wildcard *.c)
|
|
TARGETS = $(CFILES:.c=)
|
|
|
|
all: $(TARGETS)
|
|
|
|
.PHONY: all clean $(TARGETS)
|
|
|
|
MACHINE = $(shell $(CC) -dumpmachine)
|
|
ifneq (, $(findstring darwin, $(MACHINE)))
|
|
EXT = .dylib
|
|
else ifneq (, $(findstring cygwin, $(MACHINE)))
|
|
EXT = .dll
|
|
else ifneq (, $(findstring mingw, $(MACHINE)))
|
|
EXT = .dll
|
|
else ifneq (, $(findstring windows, $(MACHINE)))
|
|
EXT = .dll
|
|
else
|
|
EXT = .so
|
|
endif
|
|
|
|
$(TARGETS): %: %$(EXT)
|
|
|
|
%.dylib: %.c
|
|
$(CC) $(CFLAGS) -dynamiclib $< $(LDLIBS) -o $@
|
|
|
|
%.so: %.c
|
|
$(CC) $(CFLAGS) -fPIC -shared $< $(LDLIBS) -o $@
|
|
|
|
%.dll: %.c
|
|
$(CC) $(CFLAGS) -fPIC -shared $< $(LDLIBS) -o $@
|
|
|
|
clean:
|
|
rm *$(EXT)
|