Skip to content

Commit ae1aa15

Browse files
committed
fix(Makefile): reorganize LDFLAGS to complain with Swift Package Manager
1 parent bc8677d commit ae1aa15

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

Makefile

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ CC = gcc
3232
CFLAGS = -Wall -Wextra -Wno-unused-parameter -I$(SRC_DIR) -I$(SQLITE_DIR) -I$(CURL_DIR)/include
3333
T_CFLAGS = $(CFLAGS) -DSQLITE_CORE -DCLOUDSYNC_UNITTEST -DCLOUDSYNC_OMIT_NETWORK -DCLOUDSYNC_OMIT_PRINT_RESULT
3434
COVERAGE = false
35+
ifndef NATIVE_NETWORK
36+
LDFLAGS = -L./$(CURL_DIR)/$(PLATFORM) -lcurl
37+
endif
3538

3639
# Directories
3740
SRC_DIR = src
@@ -56,18 +59,6 @@ COV_FILES = $(filter-out $(SRC_DIR)/lz4.c $(SRC_DIR)/network.c, $(SRC_FILES))
5659
CURL_LIB = $(CURL_DIR)/$(PLATFORM)/libcurl.a
5760
TEST_TARGET = $(patsubst %.c,$(DIST_DIR)/%$(EXE), $(notdir $(TEST_SRC)))
5861

59-
# Native network support only for Apple platforms
60-
ifdef NATIVE_NETWORK
61-
RELEASE_OBJ += $(patsubst %.m, $(BUILD_RELEASE)/%_m.o, $(notdir $(wildcard $(SRC_DIR)/*.m)))
62-
LDFLAGS = -framework Foundation
63-
CFLAGS += -DCLOUDSYNC_OMIT_CURL
64-
65-
$(BUILD_RELEASE)/%_m.o: %.m
66-
$(CC) $(CFLAGS) -fobjc-arc -O3 -fPIC -c $< -o $@
67-
else
68-
LDFLAGS = -L./$(CURL_DIR)/$(PLATFORM) -lcurl
69-
endif
70-
7162
# Platform-specific settings
7263
ifeq ($(PLATFORM),windows)
7364
TARGET := $(DIST_DIR)/cloudsync.dll
@@ -139,6 +130,16 @@ endif
139130
T_LDFLAGS += -fprofile-arcs -ftest-coverage
140131
endif
141132

133+
# Native network support only for Apple platforms
134+
ifdef NATIVE_NETWORK
135+
RELEASE_OBJ += $(patsubst %.m, $(BUILD_RELEASE)/%_m.o, $(notdir $(wildcard $(SRC_DIR)/*.m)))
136+
LDFLAGS += -framework Foundation
137+
CFLAGS += -DCLOUDSYNC_OMIT_CURL
138+
139+
$(BUILD_RELEASE)/%_m.o: %.m
140+
$(CC) $(CFLAGS) -fobjc-arc -O3 -fPIC -c $< -o $@
141+
endif
142+
142143
# Windows .def file generation
143144
$(DEF_FILE):
144145
ifeq ($(PLATFORM),windows)

0 commit comments

Comments
 (0)