]> git.eshelyaron.com Git - dict.git/commitdiff
PORT: detect linux vs macOS shared object extension in Makefile
authorEshel Yaron <me@eshelyaron.com>
Sat, 27 Aug 2022 14:37:24 +0000 (17:37 +0300)
committerEshel Yaron <me@eshelyaron.com>
Sat, 27 Aug 2022 14:37:24 +0000 (17:37 +0300)
.build.yml [new file with mode: 0644]
.gitignore
Makefile

diff --git a/.build.yml b/.build.yml
new file mode 100644 (file)
index 0000000..c52b2d3
--- /dev/null
@@ -0,0 +1,38 @@
+image: debian/stable
+packages:
+  - build-essential
+  - cmake
+  - ninja-build
+  - pkg-config
+  - ncurses-dev
+  - libreadline-dev
+  - libedit-dev
+  - libgoogle-perftools-dev
+  - libgmp-dev
+  - libssl-dev
+  - unixodbc-dev
+  - zlib1g-dev
+  - libarchive-dev
+  - libossp-uuid-dev
+  - libxext-dev
+  - libice-dev
+  - libjpeg-dev
+  - libxinerama-dev
+  - libxft-dev
+  - libxpm-dev
+  - libxt-dev
+  - libdb-dev
+  - libpcre2-dev
+  - libyaml-dev
+  - zip
+  - git
+secrets:
+  - 750079bb-9735-473b-bebf-db897c9f0c6b
+  - 72d5c3dc-f83f-4cc2-96e3-b2b08f6ee8a0
+sources:
+  - git@git.sr.ht:~eshel/sweep
+tasks:
+  - build: |
+      cd sweep
+      make
+      make info
index 4cd36b432c56cbe559703e9e47fa701e6a32f2a0..9f56ac134b4ed0c6090c47a40a48ece0054883ca 100644 (file)
@@ -8,3 +8,4 @@
 /sweep.info
 /sweep.info~
 /sweep.texi
+/sweep.o
index e8d61133e08df0304fbc987d47a94d5531f20535..6704c7d35740bae3b9703f27749d281f2f5f484d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,19 @@
 CURRENT_DIR := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
 
 BASENAME = sweep
+
+UNAME_S := $(shell uname -s)
+ifeq ($(UNAME_S),Linux)
+    SOEXT = so
+endif
+ifeq ($(UNAME_S),Darwin)
+    SOEXT = dylib
+endif
+
 SOEXT    = dylib
 
 TARGET   = $(BASENAME)-module.$(SOEXT)
+OBJECT   = $(BASENAME).o
 SOURCE   = $(BASENAME).c
 
 LDFLAGS += -shared
@@ -28,14 +38,17 @@ CMAKE_OPTIONS += -DSWIPL_INSTALL_IN_LIB=ON
 
 all: $(TARGET)
 
-$(TARGET): $(SOURCE) swipl
-       $(CC) $(CFLAGS) -o $@ $(SOURCE) $(LDFLAGS)
+$(OBJECT): $(SOURCE) lib/libswipl.$(SOEXT)
+       $(CC) $(CFLAGS) -o $@ -c $(SOURCE)
+
+$(TARGET): $(OBJECT)
+       $(CC) -o $@ $(OBJECT) $(LDFLAGS)
 
 clean:
        rm -rf bin lib share swipl/build
-       rm -f $(TARGET) $(BASENAME).info
+       rm -f $(TARGET) $(OBJECT) $(BASENAME).info
 
-swipl:
+lib/libswipl.$(SOEXT):
        cd swipl; \
        rm -rf build; \
        mkdir build; \
@@ -44,5 +57,5 @@ swipl:
        ninja; \
        ninja install
 
-$(BASENAME).info:
+$(BASENAME).info:: README.org
        emacs -Q --batch --eval '(require (quote ox-texinfo))' --eval "(with-current-buffer (find-file \"README.org\") (org-export-to-file (quote texinfo) \"$@\" nil nil nil nil nil (quote org-texinfo-compile)))"