2010-12-04 23:47:08 +08:00
|
|
|
#
|
|
|
|
# Tiny C Compiler Makefile for libtcc1.a
|
|
|
|
#
|
|
|
|
|
2015-07-30 04:53:57 +08:00
|
|
|
TOP = ..
|
2013-02-15 00:43:24 +08:00
|
|
|
include $(TOP)/Makefile
|
2016-10-02 03:06:53 +08:00
|
|
|
VPATH = $(TOPSRC)/lib $(TOPSRC)/win32/lib
|
2017-02-25 19:49:47 +08:00
|
|
|
T = $(or $(CROSS_TARGET),$(NATIVE_TARGET),unknown)
|
|
|
|
X = $(if $(CROSS_TARGET),$(CROSS_TARGET)-)
|
2010-12-04 23:47:08 +08:00
|
|
|
|
2017-02-25 19:49:47 +08:00
|
|
|
TCC = $(TOP)/$(X)tcc$(EXESUF)
|
|
|
|
XCC = $(TCC)
|
|
|
|
XAR = $(TCC) -ar
|
|
|
|
XFLAGS-unx = -B$(TOPSRC)
|
|
|
|
XFLAGS-win = -B$(TOPSRC)/win32 -I$(TOPSRC)/include
|
|
|
|
XFLAGS = $(XFLAGS$(XCFG))
|
|
|
|
XCFG = $(or $(findstring -win,$T),-unx)
|
|
|
|
|
|
|
|
ifeq ($(X),)
|
2016-10-02 03:06:33 +08:00
|
|
|
BCHECK_O = bcheck.o
|
2017-02-25 19:49:47 +08:00
|
|
|
ifeq "$T" "arm"
|
|
|
|
XCC = $(CC)
|
|
|
|
XAR = $(AR)
|
|
|
|
XFLAGS = $(CFLAGS) -fPIC
|
|
|
|
endif
|
2010-12-04 23:47:08 +08:00
|
|
|
endif
|
|
|
|
|
2017-02-25 19:49:47 +08:00
|
|
|
ifeq ($(TARGETOS),Darwin)
|
|
|
|
XFLAGS += -D_ANSI_SOURCE
|
|
|
|
BCHECK_O =
|
2017-04-21 04:01:50 +08:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_musl),yes)
|
|
|
|
BCHECK_O =
|
2017-02-25 19:49:47 +08:00
|
|
|
endif
|
2017-02-18 16:55:34 +08:00
|
|
|
|
2013-02-07 02:01:07 +08:00
|
|
|
I386_O = libtcc1.o alloca86.o alloca86-bt.o $(BCHECK_O)
|
2015-04-10 20:17:22 +08:00
|
|
|
X86_64_O = libtcc1.o alloca86_64.o alloca86_64-bt.o $(BCHECK_O)
|
2014-04-06 04:54:11 +08:00
|
|
|
ARM_O = libtcc1.o armeabi.o alloca-arm.o
|
2015-02-14 02:58:31 +08:00
|
|
|
ARM64_O = lib-arm64.o
|
2017-02-23 15:41:57 +08:00
|
|
|
WIN_O = crt1.o crt1w.o wincrt1.o wincrt1w.o dllcrt1.o dllmain.o
|
2010-12-04 23:47:08 +08:00
|
|
|
|
2017-02-25 19:49:47 +08:00
|
|
|
OBJ-i386 = $(I386_O)
|
|
|
|
TGT-i386 = -DTCC_TARGET_I386
|
2010-12-04 23:47:08 +08:00
|
|
|
|
2017-02-25 19:49:47 +08:00
|
|
|
OBJ-x86_64 = $(X86_64_O)
|
|
|
|
TGT-x86_64 = -DTCC_TARGET_X86_64
|
|
|
|
|
|
|
|
OBJ-arm = $(ARM_O)
|
|
|
|
TGT-arm = -DTCC_TARGET_ARM
|
|
|
|
|
|
|
|
OBJ-arm64 = $(ARM64_O)
|
|
|
|
TGT-arm64 = -DTCC_TARGET_ARM64
|
2013-02-07 02:01:07 +08:00
|
|
|
|
2017-02-25 19:49:47 +08:00
|
|
|
OBJ-i386-win32 = $(I386_O) chkstk.o $(WIN_O)
|
|
|
|
TGT-i386-win32 = -DTCC_TARGET_I386 -DTCC_TARGET_PE
|
2017-02-23 15:41:57 +08:00
|
|
|
|
2017-02-25 19:49:47 +08:00
|
|
|
OBJ-x86_64-win32 = $(X86_64_O) chkstk.o $(WIN_O)
|
|
|
|
TGT-x86_64-win32 = -DTCC_TARGET_X86_64 -DTCC_TARGET_PE
|
|
|
|
|
|
|
|
OBJ-arm-wince = $(ARM_O) $(WIN_O)
|
|
|
|
TGT-arm-wince = -DTCC_TARGET_ARM -DTCC_TARGET_PE
|
|
|
|
|
|
|
|
all : $(BIN)
|
|
|
|
|
|
|
|
$(BIN) : $(patsubst %.o,$(X)%.o,$(OBJ-$T))
|
2017-02-23 15:41:57 +08:00
|
|
|
$(XAR) rcs $@ $^
|
2010-12-04 23:47:08 +08:00
|
|
|
|
2017-02-25 19:49:47 +08:00
|
|
|
$(X)%.o : %.c
|
|
|
|
$(XCC) -c $< -o $@ $(TGT-$T) $(XFLAGS)
|
|
|
|
|
|
|
|
$(X)%.o : %.S
|
|
|
|
$(XCC) -c $< -o $@ $(TGT-$T) $(XFLAGS)
|
|
|
|
|
|
|
|
$(X)crt1w.o : crt1.c
|
|
|
|
$(X)wincrt1w.o : wincrt1.c
|
2010-12-04 23:47:08 +08:00
|
|
|
|
|
|
|
clean :
|
2017-02-25 19:49:47 +08:00
|
|
|
rm -f *.a *.o $(BIN)
|