2010-12-04 18:47:08 +03:00
|
|
|
#
|
|
|
|
# Tiny C Compiler Makefile for libtcc1.a
|
|
|
|
#
|
|
|
|
|
2015-07-29 23:53:57 +03:00
|
|
|
TOP = ..
|
2013-02-14 20:43:24 +04:00
|
|
|
include $(TOP)/Makefile
|
2016-10-01 22:06:53 +03:00
|
|
|
VPATH = $(TOPSRC)/lib $(TOPSRC)/win32/lib
|
2017-02-25 14:49:47 +03:00
|
|
|
T = $(or $(CROSS_TARGET),$(NATIVE_TARGET),unknown)
|
|
|
|
X = $(if $(CROSS_TARGET),$(CROSS_TARGET)-)
|
2017-04-25 22:01:54 +03:00
|
|
|
BIN = $(TOP)/libtcc1$(if $(CROSS_TARGET),-$(CROSS_TARGET)).a
|
2010-12-04 18:47:08 +03:00
|
|
|
|
2017-02-25 14:49:47 +03: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)
|
|
|
|
|
2017-05-13 09:59:06 +03:00
|
|
|
# in order to use gcc, tyoe: make <target>lib-usegcc=yes
|
2017-05-07 13:41:29 +03:00
|
|
|
armlib-usegcc ?= no
|
2010-12-04 18:47:08 +03:00
|
|
|
|
2017-05-07 13:41:29 +03:00
|
|
|
ifeq "$($(X)$(T)lib-usegcc)" "yes"
|
|
|
|
XCC = $(CC)
|
|
|
|
XAR = $(AR)
|
|
|
|
XFLAGS = $(CFLAGS) -fPIC
|
2017-04-20 23:01:50 +03:00
|
|
|
endif
|
|
|
|
|
2017-05-07 13:41:29 +03:00
|
|
|
# only for native compiler
|
|
|
|
$(X)BCHECK_O = bcheck.o
|
|
|
|
|
2017-07-23 22:24:11 +03:00
|
|
|
ifeq ($(CONFIG_musl)$(CONFIG_uClibc),yes)
|
2017-04-20 23:01:50 +03:00
|
|
|
BCHECK_O =
|
2017-02-25 14:49:47 +03:00
|
|
|
endif
|
2017-02-18 11:55:34 +03:00
|
|
|
|
2017-05-07 13:41:29 +03:00
|
|
|
ifdef CONFIG_OSX
|
|
|
|
XFLAGS += -D_ANSI_SOURCE
|
|
|
|
endif
|
|
|
|
|
2017-04-25 22:01:54 +03:00
|
|
|
I386_O = libtcc1.o alloca86.o alloca86-bt.o
|
|
|
|
X86_64_O = libtcc1.o alloca86_64.o alloca86_64-bt.o
|
2017-05-07 13:41:29 +03:00
|
|
|
ARM_O = libtcc1.o armeabi.o alloca-arm.o armflush.o
|
2015-02-13 21:58:31 +03:00
|
|
|
ARM64_O = lib-arm64.o
|
2017-02-23 10:41:57 +03:00
|
|
|
WIN_O = crt1.o crt1w.o wincrt1.o wincrt1w.o dllcrt1.o dllmain.o
|
2010-12-04 18:47:08 +03:00
|
|
|
|
2017-04-25 22:01:54 +03:00
|
|
|
OBJ-i386 = $(I386_O) $(BCHECK_O)
|
2017-05-07 13:41:29 +03:00
|
|
|
OBJ-x86_64 = $(X86_64_O) va_list.o $(BCHECK_O)
|
|
|
|
OBJ-x86_64-osx = $(X86_64_O) va_list.o
|
2017-04-25 22:01:54 +03:00
|
|
|
OBJ-i386-win32 = $(I386_O) chkstk.o bcheck.o $(WIN_O)
|
|
|
|
OBJ-x86_64-win32 = $(X86_64_O) chkstk.o bcheck.o $(WIN_O)
|
2017-05-07 13:41:29 +03:00
|
|
|
OBJ-arm64 = $(ARM64_O)
|
|
|
|
OBJ-arm = $(ARM_O)
|
|
|
|
OBJ-arm-fpa = $(ARM_O)
|
|
|
|
OBJ-arm-fpa-ld = $(ARM_O)
|
|
|
|
OBJ-arm-vfp = $(ARM_O)
|
|
|
|
OBJ-arm-eabi = $(ARM_O)
|
|
|
|
OBJ-arm-eabihf = $(ARM_O)
|
2017-02-25 14:49:47 +03:00
|
|
|
OBJ-arm-wince = $(ARM_O) $(WIN_O)
|
|
|
|
|
|
|
|
$(BIN) : $(patsubst %.o,$(X)%.o,$(OBJ-$T))
|
2017-02-23 10:41:57 +03:00
|
|
|
$(XAR) rcs $@ $^
|
2010-12-04 18:47:08 +03:00
|
|
|
|
2017-02-25 14:49:47 +03:00
|
|
|
$(X)%.o : %.c
|
2017-07-23 22:24:11 +03:00
|
|
|
$(XCC) -c $< -o $@ $(XFLAGS)
|
2017-02-25 14:49:47 +03:00
|
|
|
|
|
|
|
$(X)%.o : %.S
|
2017-07-23 22:24:11 +03:00
|
|
|
$(XCC) -c $< -o $@ $(XFLAGS)
|
2017-02-25 14:49:47 +03:00
|
|
|
|
|
|
|
$(X)crt1w.o : crt1.c
|
|
|
|
$(X)wincrt1w.o : wincrt1.c
|
2010-12-04 18:47:08 +03:00
|
|
|
|
|
|
|
clean :
|
2017-02-25 14:49:47 +03:00
|
|
|
rm -f *.a *.o $(BIN)
|