blob: dda1ab25221464bf165b3c4818fee4afe968bb86 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
1. Support user-provided values of CC, CFLAGS and LDFLAGS
2. Do not force the use of a static version of libsodium
--- a/Makefile
+++ b/Makefile
@@ -54,20 +54,20 @@
endif
# Compiler options
-CC = gcc
+CC := $(CC)
# compiling flags here
-CFLAGS = -g -std=c99 -I$(SRCDIR) -I$(LIBDIR) -Wall -Wextra
+CFLAGS := $(CFLAGS) -g -std=c99 -I$(SRCDIR) -I$(LIBDIR) -Wall -Wextra
ifndef MAC_OS
CFLAGS += $(shell pkg-config --cflags libsecret-1)
endif
TEST_CFLAGS = $(CFLAGS) -I.
# Linker options
-LINKER = gcc
+LINKER := $(CC)
ifdef MAC_OS
LFLAGS = -lsodium -largp
else
-LFLAGS = -l:libsodium.a -lseccomp
+LFLAGS := $(LDFLAGS) -lsodium -lseccomp
endif
ifdef HAS_CJSON
LFLAGS += -lcjson
@@ -81,7 +81,7 @@
ifdef MAC_OS
CLIENT_LFLAGS = -L$(APILIB) -largp -loidc-agent.$(LIBVERSION)
else
-CLIENT_LFLAGS = -L$(APILIB) -l:$(SHARED_LIB_NAME_FULL) -lseccomp
+CLIENT_LFLAGS = $(LDFLAGS) -L$(APILIB) -l:$(SHARED_LIB_NAME_FULL) -lseccomp
endif
ifdef HAS_CJSON
CLIENT_LFLAGS += -lcjson
@@ -478,7 +478,7 @@
ifdef MAC_OS
@gcc -dynamiclib -fpic -Wl, -o $@ $(PIC_OBJECTS) -lc
else
- @gcc -shared -fpic -Wl,-soname,$(SONAME) -o $@ $(PIC_OBJECTS) -lc
+ @$(LINKER) -shared -fpic -Wl,-soname,$(SONAME) $(LDFLAGS) -o $@ $(PIC_OBJECTS) -lc
endif
.PHONY: shared_lib
|