2010-12-04 23:47:08 +08:00
|
|
|
#
|
|
|
|
# Tiny C Compiler Makefile for libtcc1.a
|
|
|
|
#
|
|
|
|
|
|
|
|
TOP = ..
|
2013-02-15 00:43:24 +08:00
|
|
|
include $(TOP)/Makefile
|
2012-12-15 00:18:03 +08:00
|
|
|
VPATH = $(top_srcdir)/lib $(top_srcdir)/win32/lib
|
2010-12-04 23:47:08 +08:00
|
|
|
|
|
|
|
ifndef TARGET
|
|
|
|
ifdef CONFIG_WIN64
|
|
|
|
TARGET = x86_64-win32
|
|
|
|
else
|
|
|
|
ifdef CONFIG_WIN32
|
|
|
|
TARGET = i386-win32
|
|
|
|
else
|
|
|
|
ifeq ($(ARCH),i386)
|
|
|
|
TARGET = i386
|
2013-02-07 02:01:07 +08:00
|
|
|
ifneq ($(TARGETOS),Darwin)
|
|
|
|
XCC = $(CC)
|
|
|
|
endif
|
2010-12-04 23:47:08 +08:00
|
|
|
else
|
|
|
|
ifeq ($(ARCH),x86-64)
|
|
|
|
TARGET = x86_64
|
2013-02-07 02:01:07 +08:00
|
|
|
ifneq ($(TARGETOS),Darwin)
|
|
|
|
XCC = $(CC)
|
|
|
|
endif
|
2013-02-28 23:55:10 +08:00
|
|
|
else
|
|
|
|
ifeq ($(ARCH),arm)
|
|
|
|
TARGET = arm
|
|
|
|
endif
|
2010-12-04 23:47:08 +08:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
2013-02-09 02:07:11 +08:00
|
|
|
BCHECK_O = bcheck.o
|
2010-12-04 23:47:08 +08:00
|
|
|
endif
|
|
|
|
|
|
|
|
DIR = $(TARGET)
|
|
|
|
|
|
|
|
native : ../libtcc1.a
|
|
|
|
cross : $(DIR)/libtcc1.a
|
|
|
|
|
|
|
|
native : TCC = $(TOP)/tcc$(EXESUF)
|
|
|
|
cross : TCC = $(TOP)/$(TARGET)-tcc$(EXESUF)
|
|
|
|
|
2013-02-07 02:01:07 +08:00
|
|
|
I386_O = libtcc1.o alloca86.o alloca86-bt.o $(BCHECK_O)
|
2010-12-04 23:47:08 +08:00
|
|
|
X86_64_O = libtcc1.o alloca86_64.o
|
Add ARM aeabi functions needed to run tcctest
Add implementation for float / integer conversion functions:
__aeabi_d2lz, __aeabi_d2ulz, __aeabi_f2lz, __aeabi_f2ulz, __aeabi_l2d,
__aeabi_l2f, __aeabi_ul2d, __aeabi_ul2f
Add implementation for long long helper functions:
__aeabi_ldivmod, __aeabi_uldivmod, __aeabi_llsl, __aeabi_llsr, __aeabi_lasr
Add implementation for integer division functions:
__aeabi_uidiv, __aeabi_uidivmod, __aeabi_idiv, __aeabi_idivmod,
2013-04-07 23:02:57 +08:00
|
|
|
ARM_O = libtcc1.o armeabi.o
|
2013-02-07 02:01:07 +08:00
|
|
|
WIN32_O = $(I386_O) crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o
|
2010-12-04 23:47:08 +08:00
|
|
|
WIN64_O = $(X86_64_O) crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o
|
|
|
|
|
2014-04-03 03:27:22 +08:00
|
|
|
# build TCC runtime library to contain PIC code, so it can be linked
|
|
|
|
# into shared libraries
|
|
|
|
PICFLAGS = -fPIC
|
|
|
|
|
2010-12-04 23:47:08 +08:00
|
|
|
ifeq "$(TARGET)" "i386-win32"
|
|
|
|
OBJ = $(addprefix $(DIR)/,$(WIN32_O))
|
|
|
|
TGT = -DTCC_TARGET_I386 -DTCC_TARGET_PE
|
2013-01-31 01:39:09 +08:00
|
|
|
XCC = $(TCC) -B$(top_srcdir)/win32 -I$(top_srcdir)/include
|
2010-12-04 23:47:08 +08:00
|
|
|
XAR = $(DIR)/tiny_libmaker$(EXESUF)
|
|
|
|
else
|
|
|
|
ifeq "$(TARGET)" "x86_64-win32"
|
|
|
|
OBJ = $(addprefix $(DIR)/,$(WIN64_O))
|
|
|
|
TGT = -DTCC_TARGET_X86_64 -DTCC_TARGET_PE
|
2013-01-31 01:39:09 +08:00
|
|
|
XCC = $(TCC) -B$(top_srcdir)/win32 -I$(top_srcdir)/include
|
2010-12-04 23:47:08 +08:00
|
|
|
XAR = $(DIR)/tiny_libmaker$(EXESUF)
|
|
|
|
else
|
|
|
|
ifeq "$(TARGET)" "i386"
|
|
|
|
OBJ = $(addprefix $(DIR)/,$(I386_O))
|
|
|
|
TGT = -DTCC_TARGET_I386
|
2013-02-07 02:01:07 +08:00
|
|
|
XCC ?= $(TCC) -B$(TOP)
|
2010-12-04 23:47:08 +08:00
|
|
|
else
|
|
|
|
ifeq "$(TARGET)" "x86_64"
|
|
|
|
OBJ = $(addprefix $(DIR)/,$(X86_64_O))
|
|
|
|
TGT = -DTCC_TARGET_X86_64
|
2013-02-07 02:01:07 +08:00
|
|
|
XCC ?= $(TCC) -B$(TOP)
|
2013-02-28 23:55:10 +08:00
|
|
|
else
|
|
|
|
ifeq "$(TARGET)" "arm"
|
|
|
|
OBJ = $(addprefix $(DIR)/,$(ARM_O))
|
|
|
|
TGT = -DTCC_TARGET_ARM
|
|
|
|
XCC ?= $(TCC) -B$(TOP)
|
2010-12-04 23:47:08 +08:00
|
|
|
else
|
|
|
|
$(error libtcc1.a not supported on target '$(TARGET)')
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
2013-02-28 23:55:10 +08:00
|
|
|
endif
|
2010-12-04 23:47:08 +08:00
|
|
|
|
2014-04-03 03:27:22 +08:00
|
|
|
XFLAGS = $(CPPFLAGS) $(CFLAGS) $(PICFLAGS) $(TGT)
|
2013-02-07 02:01:07 +08:00
|
|
|
|
|
|
|
ifeq ($(TARGETOS),Darwin)
|
|
|
|
XAR = $(DIR)/tiny_libmaker$(EXESUF)
|
|
|
|
XFLAGS += -D_ANSI_SOURCE
|
|
|
|
BCHECK_O =
|
|
|
|
endif
|
|
|
|
|
2010-12-04 23:47:08 +08:00
|
|
|
ifdef XAR
|
|
|
|
AR = $(XAR)
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(DIR)/libtcc1.a ../libtcc1.a : $(OBJ) $(XAR)
|
|
|
|
$(AR) rcs $@ $(OBJ)
|
|
|
|
$(DIR)/%.o : %.c
|
2013-02-07 02:01:07 +08:00
|
|
|
$(XCC) -c $< -o $@ $(XFLAGS)
|
2010-12-04 23:47:08 +08:00
|
|
|
$(DIR)/%.o : %.S
|
2013-02-07 02:01:07 +08:00
|
|
|
$(XCC) -c $< -o $@ $(XFLAGS)
|
2010-12-04 23:47:08 +08:00
|
|
|
$(DIR)/%$(EXESUF) : $(TOP)/win32/tools/%.c
|
2013-02-15 00:43:24 +08:00
|
|
|
$(CC) -o $@ $< $(XFLAGS) $(LDFLAGS)
|
2010-12-04 23:47:08 +08:00
|
|
|
|
|
|
|
$(OBJ) $(XAR) : $(DIR)/exists
|
|
|
|
$(DIR)/exists :
|
|
|
|
mkdir -p $(DIR)
|
|
|
|
@echo $@ > $@
|
|
|
|
|
|
|
|
clean :
|
|
|
|
rm -rfv i386-win32 x86_64-win32 i386 x86_64
|