This repository was archived by the owner on Oct 12, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -29,9 +29,23 @@ INSTALL_DIR=../install
29
29
DOCDIR =doc
30
30
IMPDIR =import
31
31
32
- OPTIONAL_PIC: =$(if $(PIC ) ,-fPIC,)
33
32
OPTIONAL_COVERAGE: =$(if $(TEST_COVERAGE ) ,-cov,)
34
33
34
+ # default to PIC on x86_64, use PIC=1/0 to en-/disable PIC.
35
+ # Note that shared libraries and C files are always compiled with PIC.
36
+ ifeq ($(PIC ) ,)
37
+ ifeq ($(MODEL),64) # x86_64
38
+ PIC: =1
39
+ else
40
+ PIC: =0
41
+ endif
42
+ endif
43
+ ifeq ($(PIC ) ,1)
44
+ override PIC: =-fPIC
45
+ else
46
+ override PIC: =
47
+ endif
48
+
35
49
ifeq (osx,$(OS ) )
36
50
DOTDLL:=.dylib
37
51
DOTLIB:=.a
@@ -55,7 +69,7 @@ ifeq (solaris,$(OS))
55
69
endif
56
70
57
71
# Set DFLAGS
58
- UDFLAGS:=-conf = -Isrc -Iimport -w -dip1000 $(MODEL_FLAG ) $(OPTIONAL_PIC ) $(OPTIONAL_COVERAGE )
72
+ UDFLAGS:=-conf = -Isrc -Iimport -w -dip1000 $(MODEL_FLAG ) $(PIC ) $(OPTIONAL_COVERAGE )
59
73
ifeq ($(BUILD ) ,debug)
60
74
UDFLAGS += -g -debug
61
75
DFLAGS:=$(UDFLAGS)
Original file line number Diff line number Diff line change @@ -14,13 +14,11 @@ SRC:=src
14
14
GENERATED: =./generated
15
15
ROOT: =$(GENERATED ) /$(OS ) /$(BUILD ) /$(MODEL )
16
16
17
- OPTIONAL_PIC: =$(if $(PIC ) ,-fPIC,)
18
-
19
17
ifneq (default,$(MODEL ) )
20
18
MODEL_FLAG:=-m$(MODEL)
21
19
endif
22
- CFLAGS: =$(MODEL_FLAG ) -Wall
23
- DFLAGS: =$(MODEL_FLAG ) -w -I../../src -I../../import -I$(SRC ) -defaultlib= -debuglib= -dip1000 $( OPTIONAL_PIC )
20
+ CFLAGS: =$(MODEL_FLAG ) $( PIC ) -Wall
21
+ DFLAGS: =$(MODEL_FLAG ) $( PIC ) -w -I../../src -I../../import -I$(SRC ) -defaultlib= -debuglib= -dip1000
24
22
# LINK_SHARED may be set by importing makefile
25
23
DFLAGS+ =$(if $(LINK_SHARED ) ,-L$(DRUNTIMESO ) ,-L$(DRUNTIME ) )
26
24
ifeq ($(BUILD ) ,debug)
You can’t perform that action at this time.
0 commit comments