2 # Tiny C Compiler Makefile for libtcc1.a
6 include $(TOP
)/Makefile
7 VPATH
= $(TOPSRC
)/lib
$(TOPSRC
)/win32
/lib
10 # we're building the native libtcc1.a
17 else ifeq ($(ARCH
),i386
)
19 else ifeq ($(ARCH
),x86-64
)
21 else ifeq ($(ARCH
),arm
)
23 else ifeq ($(ARCH
),arm64
)
32 cross
: $(DIR
)/libtcc1.a
34 native
: TCC
= $(TOP
)/tcc
$(EXESUF
)
35 cross
: TCC
= $(TOP
)/$(TARGET
)-tcc
$(EXESUF
)
37 XCC
= $(TCC
) -B
$(TOPSRC
)
40 I386_O
= libtcc1.o alloca86.o alloca86-bt.o
$(BCHECK_O
)
41 X86_64_O
= libtcc1.o alloca86_64.o alloca86_64-bt.o
$(BCHECK_O
)
42 ARM_O
= libtcc1.o armeabi.o alloca-arm.o
44 WIN32_O
= crt1.o crt1w.o wincrt1.o wincrt1w.o dllcrt1.o dllmain.o chkstk.o
46 ifeq "$(TARGET)" "i386-win32"
47 OBJ
= $(addprefix $(DIR
)/,$(I386_O
) $(WIN32_O
))
48 TGT
= -DTCC_TARGET_I386
-DTCC_TARGET_PE
49 XCC
= $(TCC
) -B
$(TOPSRC
)/win32
-I
$(TOPSRC
)/include
50 else ifeq "$(TARGET)" "x86_64-win32"
51 OBJ
= $(addprefix $(DIR
)/,$(X86_64_O
) $(WIN32_O
))
52 TGT
= -DTCC_TARGET_X86_64
-DTCC_TARGET_PE
53 XCC
= $(TCC
) -B
$(TOPSRC
)/win32
-I
$(TOPSRC
)/include
54 else ifeq "$(TARGET)" "i386"
55 OBJ
= $(addprefix $(DIR
)/,$(I386_O
))
56 TGT
= -DTCC_TARGET_I386
57 else ifeq "$(TARGET)" "x86_64"
58 OBJ
= $(addprefix $(DIR
)/,$(X86_64_O
))
59 TGT
= -DTCC_TARGET_X86_64
60 else ifeq "$(TARGET)" "arm"
61 OBJ
= $(addprefix $(DIR
)/,$(ARM_O
))
62 TGT
= -DTCC_TARGET_ARM
65 XFLAGS
= $(CFLAGS
) -fPIC
67 else ifeq "$(TARGET)" "arm64"
68 OBJ
= $(addprefix $(DIR
)/,$(ARM64_O
))
69 TGT
= -DTCC_TARGET_ARM64
71 $(error libtcc1.a not supported on target
'$(TARGET)')
74 ifeq ($(TARGETOS
),Darwin
)
75 XFLAGS
+= -D_ANSI_SOURCE
79 $(DIR
)/libtcc1.a ..
/libtcc1.a
: $(OBJ
)
82 $(XCC
) -c
$< -o
$@
$(TGT
) $(XFLAGS
)
84 $(XCC
) -c
$< -o
$@
$(TGT
) $(XFLAGS
)
86 $(OBJ
) : $(DIR
)/exists
93 rm -rf i386-win32 x86_64-win32 i386 x86_64 arm arm64