aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorAndrei Warkentin <andrey.warkentin@gmail.com>2017-03-28 01:58:42 -0400
committerAndrei Warkentin <awarkentin@awarkentin-mba.local>2017-04-25 13:55:18 +0300
commit91cd148a05e2c492a02eb77b12a2581b87bc9822 (patch)
tree9180f497ced5f98a481def42655f5e12488c2ef4 /Makefile
parent0ac29b53dc038408b08e0f8515ae6edabc145f76 (diff)
downloadtinycc-91cd148a05e2c492a02eb77b12a2581b87bc9822.tar.gz
tinycc-91cd148a05e2c492a02eb77b12a2581b87bc9822.tar.bz2
tcc: early OSX native support
- build scripts - working '-run' mode, e.g.: ./tcc -B. -I./include -I. -I.. -D_ANSI_SOURCE -run examples/ex1.c Note: we don't bother parsing Mach-O/Fat images yet. We blindly dlopen the image. Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile22
1 files changed, 20 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index c74d833..8de469a 100644
--- a/Makefile
+++ b/Makefile
@@ -36,6 +36,21 @@ ifdef CONFIG_WIN32
endif
CFGWIN = -win
NATIVE_TARGET = $(ARCH)-$(if $(eq $(ARCH),arm),wince,win32)
+else ifdef CONFIG_OSX
+ LIBS=-lm
+ ifndef CONFIG_NOLDL
+ LIBS+=-ldl
+ endif
+ # make libtcc as static or dynamic library?
+ ifeq ($(DISABLE_STATIC),yes)
+ LIBTCC=libtcc.dylib
+ ifndef DISABLE_RPATH
+ LINK_LIBTCC += -Wl,-rpath,"$(libdir)"
+ export LD_LIBRARY_PATH := $(CURDIR)/$(TOP)
+ endif
+ endif
+ CFGWIN =-unx
+ NATIVE_TARGET = $(ARCH)-osx
else
LIBS=-lm
ifndef CONFIG_NOLDL
@@ -72,6 +87,7 @@ CONFIG_$(ARCH) = yes
NATIVE_DEFINES_$(CONFIG_i386) += -DTCC_TARGET_I386
NATIVE_DEFINES_$(CONFIG_x86_64) += -DTCC_TARGET_X86_64
NATIVE_DEFINES_$(CONFIG_WIN32) += -DTCC_TARGET_PE
+NATIVE_DEFINES_$(CONFIG_OSX) += -DTCC_TARGET_X86_64 -DTCC_TARGET_MACHO
NATIVE_DEFINES_$(CONFIG_uClibc) += -DTCC_UCLIBC
NATIVE_DEFINES_$(CONFIG_musl) += -DTCC_MUSL
NATIVE_DEFINES_$(CONFIG_arm) += -DTCC_TARGET_ARM
@@ -92,11 +108,11 @@ TCCDOCS = tcc.1 tcc-doc.html tcc-doc.info
all: $(PROGS) $(TCCLIBS) $(TCCDOCS)
# cross compiler targets to build
-TCC_X = i386 x86_64 i386-win32 x86_64-win32 arm arm64 arm-wince c67
+TCC_X = i386 x86_64 i386-win32 x86_64-win32 x86_64-osx arm arm64 arm-wince c67
# TCC_X += arm-fpa arm-fpa-ld arm-vfp arm-eabi
# cross libtcc1.a targets to build
-LIBTCC1_X = i386 x86_64 i386-win32 x86_64-win32 arm arm64 arm-wince
+LIBTCC1_X = i386 x86_64 i386-win32 x86_64-win32 x86_64-osx arm arm64 arm-wince
PROGS_CROSS = $(foreach X,$(TCC_X),$X-tcc$(EXESUF))
LIBTCC1_CROSS = $(foreach X,$(LIBTCC1_X),libtcc1-$X.a)
@@ -123,6 +139,7 @@ DEF-i386 = -DTCC_TARGET_I386
DEF-x86_64 = -DTCC_TARGET_X86_64
DEF-i386-win32 = -DTCC_TARGET_PE -DTCC_TARGET_I386
DEF-x86_64-win32= -DTCC_TARGET_PE -DTCC_TARGET_X86_64
+DEF-x86_64-osx = -DTCC_TARGET_MACHO -DTCC_TARGET_X86_64
DEF-arm-wince = -DTCC_TARGET_PE -DTCC_TARGET_ARM -DTCC_ARM_EABI -DTCC_ARM_VFP -DTCC_ARM_HARDFLOAT
DEF-arm64 = -DTCC_TARGET_ARM64
DEF-c67 = -DTCC_TARGET_C67 -w # disable warnigs
@@ -160,6 +177,7 @@ i386_FILES = $(CORE_FILES) i386-gen.c i386-link.c i386-asm.c i386-asm.h i386-tok
i386-win32_FILES = $(i386_FILES) tccpe.c
x86_64_FILES = $(CORE_FILES) x86_64-gen.c x86_64-link.c i386-asm.c x86_64-asm.h
x86_64-win32_FILES = $(x86_64_FILES) tccpe.c
+x86_64-osx_FILES = $(x86_64_FILES)
arm_FILES = $(CORE_FILES) arm-gen.c arm-link.c arm-asm.c
arm-wince_FILES = $(arm_FILES) tccpe.c
arm64_FILES = $(CORE_FILES) arm64-gen.c arm64-link.c