Skip to content

Commit

Permalink
tes(openssl): update paths in other makefiles
Browse files Browse the repository at this point in the history
  • Loading branch information
parfeon committed Nov 20, 2024
1 parent 386b05f commit b7c2b3a
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -e

INFO_BG="\033[0m\033[48;2;5;49;70m"
INFO_FG="\033[38;2;19;181;255m"
Expand Down
25 changes: 12 additions & 13 deletions core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,20 @@ CRYPTO_INCLUDES += -I ../openssl/.
CRYPTO_LIBS += -lssl -lcrypto
CRYPTO_SOURCEFILES += pubnub_crypto.c pbcc_crypto.c pbcc_crypto_aes_cbc.c pbcc_crypto_legacy.c ../openssl/pbaes256.c

ifeq ($(shell uname),Darwin)
CRYPTO_CFLAGS := $(shell pkg-config --cflags openssl 2>/dev/null)
CRYPTO_LIBS := $(shell pkg-config --libs openssl 2>/dev/null)

ifeq ($(CRYPTO_CFLAGS),)
CRYPTO_CFLAGS := -I/usr/local/opt/openssl/include
endif
ifeq ($(CRYPTO_LIBS),)
CRYPTO_LIBS := -L/usr/local/opt/openssl/lib -lssl -lcrypto
endif

CRYPTO_INCLUDES += $(CRYPTO_CFLAGS)
CRYPTO_LIBS += $(CRYPTO_LIBS)
# Searching for proper OpenSSL paths.
CRYPTO_CFLAGS := $(shell pkg-config --cflags openssl 2>/dev/null)
CRYPTO_LIBS := $(shell pkg-config --libs openssl 2>/dev/null)

ifeq ($(CRYPTO_CFLAGS),)
CRYPTO_CFLAGS := -I/usr/local/opt/openssl/include
endif
ifeq ($(CRYPTO_LIBS),)
CRYPTO_LIBS := -L/usr/local/opt/openssl/lib
endif

CRYPTO_INCLUDES += $(CRYPTO_CFLAGS)
CRYPTO_LIBS += $(CRYPTO_LIBS)

pbcc_crypto_unittest: $(PROJECT_SOURCEFILES) $(CRYPTO_SOURCEFILES) pbcc_crypto_unit_tests.c
gcc -o pbcc_crypto_unit_test.so -shared $(CFLAGS) $(LDFLAGS) $(CRYPTO_INCLUDES) $(CRYPTO_LIBS) -D PUBNUB_CRYPTO_API=1 -Wall $(COVERAGE_FLAGS) -fPIC $(PROJECT_SOURCEFILES) $(CRYPTO_SOURCEFILES) test/pubnub_test_mocks.c pbcc_crypto_unit_tests.c -lcgreen -lm
# gcc -o pubnub_core_unit_testo $(CFLAGS) -Wall $(COVERAGE_FLAGS) $(PROJECT_SOURCEFILES) pbcc_crypto_unit_tests.c -lcgreen -lm
Expand Down
17 changes: 15 additions & 2 deletions cpp/posix_openssl.mk
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,27 @@ OS := $(shell uname)
ifeq ($(OS),Darwin)
SOURCEFILES += ../posix/monotonic_clock_get_time_darwin.c
OBJFILES += monotonic_clock_get_time_darwin.o
LDLIBS=-lpthread -lssl -lcrypto -L/usr/local/opt/openssl/lib
CFLAGS += -I/usr/local/opt/openssl/include
LDLIBS=-lpthread -lssl -lcrypto
else
SOURCEFILES += ../posix/monotonic_clock_get_time_posix.c
OBJFILES += monotonic_clock_get_time_posix.o
LDLIBS=-lrt -lpthread -lssl -lcrypto
endif

# Searching for proper OpenSSL paths.
OPENSSL_CFLAGS := $(shell pkg-config --cflags openssl 2>/dev/null)
OPENSSL_LIBS := $(shell pkg-config --libs openssl 2>/dev/null)

ifeq ($(OPENSSL_CFLAGS),)
OPENSSL_CFLAGS := -I/usr/local/opt/openssl/include
endif
ifeq ($(OPENSSL_LIBS),)
OPENSSL_LIBS := -L/usr/local/opt/openssl/lib
endif

CFLAGS += $(OPENSSL_CFLAGS)
LDLIBS += $(OPENSSL_LIBS)


all: openssl/pubnub_sync_sample openssl/pubnub_callback_sample openssl/pubnub_sync_grant_sample openssl/pubnub_callback_cpp11_sample openssl/cancel_subscribe_sync_sample openssl/subscribe_publish_callback_sample openssl/futres_nesting_sync openssl/fntest_runner openssl/futres_nesting_callback openssl/futres_nesting_callback_cpp11

Expand Down
17 changes: 15 additions & 2 deletions openssl/posix.mk
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,27 @@ OS := $(shell uname)
ifeq ($(OS),Darwin)
SOURCEFILES += ../posix/monotonic_clock_get_time_darwin.c
OBJFILES += monotonic_clock_get_time_darwin.o
LDLIBS = -lpthread -lssl -lcrypto -L/usr/local/opt/openssl/lib
CFLAGS += -I/usr/local/opt/openssl/include
LDLIBS = -lpthread -lssl -lcrypto
else
SOURCEFILES += ../posix/monotonic_clock_get_time_posix.c
OBJFILES += monotonic_clock_get_time_posix.o
LDLIBS=-lrt -lpthread -lssl -lcrypto
endif

# Searching for proper OpenSSL paths.
OPENSSL_CFLAGS := $(shell pkg-config --cflags openssl 2>/dev/null)
OPENSSL_LIBS := $(shell pkg-config --libs openssl 2>/dev/null)

ifeq ($(OPENSSL_CFLAGS),)
OPENSSL_CFLAGS := -I/usr/local/opt/openssl/include
endif
ifeq ($(OPENSSL_LIBS),)
OPENSSL_LIBS := -L/usr/local/opt/openssl/lib
endif

CFLAGS += $(OPENSSL_CFLAGS)
LDLIBS += $(OPENSSL_LIBS)


INCLUDES=-I .. -I . -I ../lib/base64/

Expand Down

0 comments on commit b7c2b3a

Please sign in to comment.