Skip to content

Commit cc5d65b

Browse files
authored
fix linux math linker flag (#8)
* Update Makefile: adjust linker flags for Linux and test target * fix(workflow): always run it but release only in the main branch * fix(Makefile): add math library flag to test target compilation * fix(Makefile): correct order of arguments in linking and test target compilation
1 parent 236066e commit cc5d65b

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: release sqlite-js
22
on:
33
push:
4-
branches:
5-
- main
64

75
permissions:
86
contents: write
@@ -121,6 +119,7 @@ jobs:
121119
runs-on: ubuntu-latest
122120
name: release
123121
needs: build
122+
if: github.ref == 'refs/heads/main'
124123

125124
env:
126125
GH_TOKEN: ${{ github.token }}

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ else ifeq ($(PLATFORM),isim)
6464
CFLAGS += -arch x86_64 -arch arm64 $(SDK)
6565
else # linux
6666
TARGET := $(DIST_DIR)/js.so
67-
LDFLAGS := -shared
67+
LDFLAGS := -lm -shared
6868
endif
6969

7070
# Object files
@@ -78,7 +78,7 @@ all: $(TARGET)
7878

7979
# Link the final target
8080
$(TARGET): $(OBJ_FILES) $(DEF_FILE)
81-
$(CC) $(LDFLAGS) -o $@ $^
81+
$(CC) -o $@ $^ $(LDFLAGS)
8282
ifeq ($(PLATFORM),windows)
8383
# Generate import library for Windows
8484
dlltool -D $@ -d $(DEF_FILE) -l $(DIST_DIR)/js.lib
@@ -131,7 +131,7 @@ endif
131131

132132
# Compile test target
133133
$(TEST_TARGET): $(TEST_FILES) $(TARGET)
134-
$(CC) $(INCLUDES) $^ -lm -o $@ libs/sqlite3.c -DSQLITE_CORE
134+
$(CC) $(INCLUDES) $^ -o $@ libs/sqlite3.c -DSQLITE_CORE
135135

136136
# Testing the extension
137137
test: $(TARGET) $(TEST_TARGET)

0 commit comments

Comments
 (0)