Recognize C11' _Alignof
[tinycc.git] / lib / Makefile
blob0c1ec54da4ec66b5fc055563be2da7e58f4e4b48
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)-)
10 BIN = $(TOP)/$(X)libtcc1.a
12 XTCC ?= $(TOP)/$(X)tcc$(EXESUF)
13 XCC = $(XTCC)
14 XAR = $(XTCC) -ar
15 XFLAGS-unx = -B$(TOPSRC)
16 XFLAGS-win = -B$(TOPSRC)/win32 -I$(TOPSRC)/include
17 XFLAGS = $(XFLAGS$(XCFG))
18 XCFG = $(or $(findstring -win,$T),-unx)
20 # in order to use gcc, tyoe: make <target>-libtcc1-usegcc=yes
21 arm-libtcc1-usegcc ?= no
23 ifeq "$($(T)-libtcc1-usegcc)" "yes"
24 XCC = $(CC)
25 XAR = $(AR)
26 XFLAGS = $(CFLAGS) -fPIC
27 endif
29 # only for native compiler
30 $(X)BCHECK_O = bcheck.o
32 ifeq ($(CONFIG_musl)$(CONFIG_uClibc),yes)
33 BCHECK_O =
34 endif
36 ifdef CONFIG_OSX
37 XFLAGS += -D_ANSI_SOURCE
38 endif
40 I386_O = libtcc1.o alloca86.o alloca86-bt.o
41 X86_64_O = libtcc1.o alloca86_64.o alloca86_64-bt.o
42 ARM_O = libtcc1.o armeabi.o alloca-arm.o armflush.o
43 ARM64_O = lib-arm64.o
44 WIN_O = crt1.o crt1w.o wincrt1.o wincrt1w.o dllcrt1.o dllmain.o
46 OBJ-i386 = $(I386_O) $(BCHECK_O)
47 OBJ-x86_64 = $(X86_64_O) va_list.o $(BCHECK_O)
48 OBJ-x86_64-osx = $(X86_64_O) va_list.o
49 OBJ-i386-win32 = $(I386_O) chkstk.o bcheck.o $(WIN_O)
50 OBJ-x86_64-win32 = $(X86_64_O) chkstk.o bcheck.o $(WIN_O)
51 OBJ-arm64 = $(ARM64_O)
52 OBJ-arm = $(ARM_O)
53 OBJ-arm-fpa = $(ARM_O)
54 OBJ-arm-fpa-ld = $(ARM_O)
55 OBJ-arm-vfp = $(ARM_O)
56 OBJ-arm-eabi = $(ARM_O)
57 OBJ-arm-eabihf = $(ARM_O)
58 OBJ-arm-wince = $(ARM_O) $(WIN_O)
60 $(BIN) : $(patsubst %.o,$(X)%.o,$(OBJ-$T))
61 $(XAR) rcs $@ $^
63 $(X)%.o : %.c
64 $(XCC) -c $< -o $@ $(XFLAGS)
66 $(X)%.o : %.S
67 $(XCC) -c $< -o $@ $(XFLAGS)
69 $(X)crt1w.o : crt1.c
70 $(X)wincrt1w.o : wincrt1.c
72 clean :
73 rm -f *.a *.o $(BIN)