From 348294a57faa4f272a25c3718d2ad59345891c19 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Sat, 27 Aug 2022 09:36:33 +0300 Subject: [PATCH] Add swipl-devel submodule --- .gitignore | 4 ++++ .gitmodules | 3 +++ Makefile | 27 ++++++++++++++++++++++++--- swipl | 1 + 4 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 .gitmodules create mode 160000 swipl diff --git a/.gitignore b/.gitignore index 42073c2..641c18c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ /.iprolog_history /sweep-module.dylib +/swipl-win.app/ +/bin/ +/lib/ +/share/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..dafcc46 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "swipl"] + path = swipl + url = https://github.com/SWI-Prolog/swipl-devel.git diff --git a/Makefile b/Makefile index 59a4c35..d11f967 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +CURRENT_DIR := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST))))) + BASENAME = sweep SOEXT = dylib @@ -5,6 +7,7 @@ TARGET = $(BASENAME)-module.$(SOEXT) SOURCE = $(BASENAME).c LDFLAGS += -shared +LDFLAGS += -Llib LDFLAGS += -lswipl CFLAGS += -fPIC @@ -12,13 +15,31 @@ CFLAGS += -fdiagnostics-absolute-paths CFLAGS += -Wall CFLAGS += -Wextra CFLAGS += -O2 +CFLAGS += -Ilib/swipl/include + +CMAKE_OPTIONS += -DCMAKE_INSTALL_PREFIX=$(CURRENT_DIR) +CMAKE_OPTIONS += -DUSE_GMP=OFF +CMAKE_OPTIONS += -DSWIPL_PACKAGES_ODBC=OFF +CMAKE_OPTIONS += -DSWIPL_PACKAGES_JAVA=OFF +CMAKE_OPTIONS += -DSWIPL_PACKAGES_X=OFF +CMAKE_OPTIONS += -DSWIPL_INSTALL_IN_LIB=ON -.PHONY: clean all +.PHONY: clean all swipl all: $(TARGET) -$(TARGET): $(SOURCE) - $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) +$(TARGET): $(SOURCE) swipl + $(CC) $(CFLAGS) -o $@ $(SOURCE) $(LDFLAGS) clean: + rm -rf bin lib share swipl/build rm -f $(TARGET) + +swipl: + cd swipl; \ + rm -rf build; \ + mkdir build; \ + cd build; \ + cmake $(CMAKE_OPTIONS) -G Ninja ..; \ + ninja; \ + ninja install diff --git a/swipl b/swipl new file mode 160000 index 0000000..5c7d1f8 --- /dev/null +++ b/swipl @@ -0,0 +1 @@ +Subproject commit 5c7d1f8352b27d45cb8066eac5af95cf925a05b7 -- 2.39.2