aboutsummaryrefslogtreecommitdiff
path: root/lib/Makefile
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2014-04-02 21:27:22 +0200
committerMichael Matz <matz@suse.de>2014-04-02 21:27:22 +0200
commitea2805f097414bf7bf299c131be1aba27b79f5d1 (patch)
tree8fc3fb845eba8dfb3a408d5e71b64903f31bc808 /lib/Makefile
parent3e56584223a67a6c2f41a43cf38e0960e9992238 (diff)
downloadtinycc-ea2805f097414bf7bf299c131be1aba27b79f5d1.tar.gz
tinycc-ea2805f097414bf7bf299c131be1aba27b79f5d1.tar.bz2
shared libs: Build libtcc1.a with -fPIC
TCCs runtime library must be compiled as position independend code, so it can be linked into shared libraries.
Diffstat (limited to 'lib/Makefile')
-rw-r--r--lib/Makefile6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Makefile b/lib/Makefile
index 394df67..7ef267f 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -49,6 +49,10 @@ ARM_O = libtcc1.o armeabi.o
WIN32_O = $(I386_O) crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o
WIN64_O = $(X86_64_O) crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o
+# build TCC runtime library to contain PIC code, so it can be linked
+# into shared libraries
+PICFLAGS = -fPIC
+
ifeq "$(TARGET)" "i386-win32"
OBJ = $(addprefix $(DIR)/,$(WIN32_O))
TGT = -DTCC_TARGET_I386 -DTCC_TARGET_PE
@@ -83,7 +87,7 @@ endif
endif
endif
-XFLAGS = $(CPPFLAGS) $(CFLAGS) $(TGT)
+XFLAGS = $(CPPFLAGS) $(CFLAGS) $(PICFLAGS) $(TGT)
ifeq ($(TARGETOS),Darwin)
XAR = $(DIR)/tiny_libmaker$(EXESUF)