aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore5
-rw-r--r--Makefile5
-rw-r--r--lib/Makefile18
-rw-r--r--tests/Makefile10
4 files changed, 27 insertions, 11 deletions
diff --git a/.gitignore b/.gitignore
index 4985f6a..8d0588f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,16 +30,19 @@ p.c
p2.c
tcctest[1234]
test[1234].out
+tests/tcclib.h
+tests/tcctest.gcc
.gdb_history
tcc.1
tcc.pod
config.h
config.mak
config.texi
-tests
tags
.DS_Store
*.swp
lib/x86_64
tcc-doc.info
conftest*
+tiny_libmaker
+*.dSYM
diff --git a/Makefile b/Makefile
index ab9a698..97efbba 100644
--- a/Makefile
+++ b/Makefile
@@ -53,10 +53,6 @@ NATIVE_DEFINES+=$(if $(wildcard /lib/ld-linux.so.3),-DTCC_ARM_EABI)
NATIVE_DEFINES+=$(if $(shell grep -l "^Features.* \(vfp\|iwmmxt\) " /proc/cpuinfo),-DTCC_ARM_VFP)
endif
-ifeq ($(TARGETOS),Darwin)
-NATIVE_DEFINES+=-DWITHOUT_LIBTCC
-endif
-
ifdef CONFIG_WIN32
NATIVE_DEFINES+=-DTCC_TARGET_PE
endif
@@ -144,6 +140,7 @@ BCHECK_O=
endif
ifeq ($(TARGETOS),Darwin)
BCHECK_O=
+PROGS+=tiny_libmaker$(EXESUF)
endif
ifdef CONFIG_USE_LIBGCC
diff --git a/lib/Makefile b/lib/Makefile
index b14f8b5..d7d2c3f 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -14,11 +14,15 @@ ifndef TARGET
else
ifeq ($(ARCH),i386)
TARGET = i386
- XCC = gcc -O2 -m32
+ ifneq ($(TARGETOS),Darwin)
+ XCC = gcc -O2 -m32
+ endif
else
ifeq ($(ARCH),x86-64)
TARGET = x86_64
- XCC = gcc -O2 -m64
+ ifneq ($(TARGETOS),Darwin)
+ XCC = gcc -O2 -m64
+ endif
endif
endif
endif
@@ -55,12 +59,18 @@ else
ifeq "$(TARGET)" "i386"
OBJ = $(addprefix $(DIR)/,$(I386_O))
TGT = -DTCC_TARGET_I386
- XCC ?= $(TCC) -B$(TOP)
+ XCC ?= $(TCC) -B$(TOP) -m32 -D_ANSI_SOURCE
+ ifeq ($(TARGETOS),Darwin)
+ XAR = $(DIR)/tiny_libmaker$(EXESUF)
+ endif
else
ifeq "$(TARGET)" "x86_64"
OBJ = $(addprefix $(DIR)/,$(X86_64_O))
TGT = -DTCC_TARGET_X86_64
- XCC ?= $(TCC) -B$(TOP)
+ XCC ?= $(TCC) -B$(TOP) -m64 -D_ANSI_SOURCE
+ ifeq ($(TARGETOS),Darwin)
+ XAR = $(DIR)/tiny_libmaker$(EXESUF)
+ endif
else
$(error libtcc1.a not supported on target '$(TARGET)')
endif
diff --git a/tests/Makefile b/tests/Makefile
index 2cf9e28..4ce9dfa 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -3,10 +3,10 @@
#
# what tests to run
-TESTS = libtest test3
+TESTS = libtest test1 test3
# these should work too
-# TESTS += test1 test2 speedtest btest weaktest
+TESTS += test2 speedtest btest weaktest
# these don't work as they should
# TESTS += test4 asmtest
@@ -18,6 +18,12 @@ ifdef DISABLE_STATIC
export LD_LIBRARY_PATH:=$(CURDIR)/..
endif
+ifeq ($(TARGETOS),Darwin)
+CFLAGS+=-Wl,-flat_namespace,-undefined,warning
+export MACOSX_DEPLOYMENT_TARGET:=10.2
+NATIVE_DEFINES+=-D_ANSI_SOURCE
+endif
+
# run local version of tcc with local libraries and includes
TCC = ../tcc -B..
RUN_TCC = $(NATIVE_DEFINES) -run -DONE_SOURCE ../tcc.c -B..