macos: fix typo in conftest
[tinycc.git] / lib / Makefile
blobbc57be7f86b79bdb40d0494ef4333d5380be2496
2 # Tiny C Compiler Makefile for libtcc1.a
5 TOP = ..
6 include $(TOP)/Makefile
7 VPATH = $(TOPSRC)/lib $(TOPSRC)/win32/lib
8 T = $(or $(CROSS_TARGET),$(NATIVE_TARGET),unknown)
9 X = $(if $(CROSS_TARGET),$(CROSS_TARGET)-)
11 XTCC ?= $(TOP)/$(X)tcc$(EXESUF)
12 XCC = $(XTCC)
13 XAR = $(XTCC) -ar
14 XFLAGS-unx = -B$(TOPSRC)
15 XFLAGS-win = -B$(TOPSRC)/win32 -I$(TOPSRC)/include
16 XFLAGS = $(XFLAGS$(XCFG)) -I$(TOP)
17 XCFG = $(or $(findstring -win,$T),-unx)
18 S = $(if $(findstring yes,$(SILENT)),@$(info * $@))
20 # in order to use gcc, type: make <target>-libtcc1-usegcc=yes
21 arm-libtcc1-usegcc ?= no
23 # This makes bounds checking 40%..60% faster.
24 #x86_64-libtcc1-usegcc=yes
25 #i386-libtcc1-usegcc=yes
27 ifeq "$($(T)-libtcc1-usegcc)" "yes"
28 XCC = $(CC)
29 XAR = $(AR)
30 XFLAGS = $(CFLAGS) -fPIC -gstabs -fno-omit-frame-pointer -Wno-unused-function -Wno-unused-variable
31 endif
33 # only for native compiler
34 $(X)BCHECK_O = bcheck.o
35 $(X)BT_O = bt-exe.o bt-log.o
36 $(X)B_O = bcheck.o bt-exe.o bt-log.o bt-dll.o
38 ifeq ($(CONFIG_musl)$(CONFIG_uClibc),yes)
39 BCHECK_O =
40 else
41 DSO_O = dsohandle.o
42 endif
44 I386_O = libtcc1.o alloca86.o alloca86-bt.o $(BT_O)
45 X86_64_O = libtcc1.o alloca86_64.o alloca86_64-bt.o $(BT_O)
46 ARM_O = libtcc1.o armeabi.o alloca-arm.o armflush.o fetch_and_add_arm.o $(BT_O)
47 ARM64_O = lib-arm64.o fetch_and_add_arm64.o $(BT_O)
48 RISCV64_O = lib-arm64.o fetch_and_add_riscv64.o $(BT_O)
49 WIN_O = crt1.o crt1w.o wincrt1.o wincrt1w.o dllcrt1.o dllmain.o
51 OBJ-i386 = $(I386_O) $(BCHECK_O) $(DSO_O)
52 OBJ-x86_64 = $(X86_64_O) va_list.o $(BCHECK_O) $(DSO_O)
53 OBJ-x86_64-osx = $(X86_64_O) va_list.o $(BCHECK_O)
54 OBJ-i386-win32 = $(I386_O) chkstk.o $(B_O) $(WIN_O)
55 OBJ-x86_64-win32 = $(X86_64_O) chkstk.o $(B_O) $(WIN_O)
56 OBJ-arm64 = $(ARM64_O) $(BCHECK_O) $(DSO_O)
57 OBJ-arm = $(ARM_O) $(BCHECK_O) $(DSO_O)
58 OBJ-arm-fpa = $(ARM_O) $(DSO_O)
59 OBJ-arm-fpa-ld = $(ARM_O) $(DSO_O)
60 OBJ-arm-vfp = $(ARM_O) $(DSO_O)
61 OBJ-arm-eabi = $(ARM_O) $(DSO_O)
62 OBJ-arm-eabihf = $(ARM_O) $(DSO_O)
63 OBJ-arm-wince = $(ARM_O) $(WIN_O)
64 OBJ-riscv64 = $(RISCV64_O) $(BCHECK_O) $(DSO_O)
66 OBJ-extra = $(filter $(B_O),$(OBJ-$T))
67 OBJ-libtcc1 = $(addprefix $(X),$(filter-out $(OBJ-extra),$(OBJ-$T)))
69 ALL = $(addprefix $(TOP)/,$(X)libtcc1.a $(OBJ-extra))
71 all: $(ALL)
73 $(TOP)/$(X)libtcc1.a : $(OBJ-libtcc1)
74 $S$(XAR) rcs $@ $^
76 $(X)%.o : %.c
77 $S$(XCC) -c $< -o $@ $(XFLAGS)
79 $(X)%.o : %.S
80 $S$(XCC) -c $< -o $@ $(XFLAGS)
82 $(TOP)/%.o : %.c
83 $S$(XCC) -c $< -o $@ $(XFLAGS)
85 $(TOP)/bcheck.o : XFLAGS += -g
86 $(TOP)/bt-exe.o : $(TOP)/tccrun.c
88 $(X)crt1w.o : crt1.c
89 $(X)wincrt1w.o : wincrt1.c
91 clean :
92 rm -f *.a *.o $(ALL)