mirror of
https://github.com/frida/tinycc
synced 2024-12-27 15:19:41 +03:00
2bd0daabbe
- tccgen: error out for cast to void, as in void foo(void) { return 1; } This avoids an assertion failure in x86_64-gen.c, also. also fix tests2/03_struct.c accordingly - Error: "memory full" - be more specific - Makefiles: remove circular dependencies, lookup tcctest.c from VPATH - tcc.h: cleanup lib, include, crt and libgcc search paths" avoid duplication or trailing slashes with no CONFIG_MULTIARCHDIR (as from9382d6f1a0
) - tcc.h: remove ";{B}" from PE search path ince5e12c2f9
James Lyon wrote: "... I'm not sure this is the right way to fix this problem." And the answer is: No, please. (copying libtcc1.a for tests instead) - win32/build_tcc.bat: do not move away a versioned file
114 lines
2.3 KiB
Makefile
114 lines
2.3 KiB
Makefile
#
|
|
# Tiny C Compiler Makefile for libtcc1.a
|
|
#
|
|
|
|
TOP = ..
|
|
include $(TOP)/Makefile
|
|
VPATH = $(top_srcdir)/lib $(top_srcdir)/win32/lib
|
|
|
|
ifndef TARGET
|
|
ifdef CONFIG_WIN64
|
|
TARGET = x86_64-win32
|
|
else
|
|
ifdef CONFIG_WIN32
|
|
TARGET = i386-win32
|
|
else
|
|
ifeq ($(ARCH),i386)
|
|
TARGET = i386
|
|
ifneq ($(TARGETOS),Darwin)
|
|
XCC = $(CC)
|
|
endif
|
|
else
|
|
ifeq ($(ARCH),x86-64)
|
|
TARGET = x86_64
|
|
ifneq ($(TARGETOS),Darwin)
|
|
XCC = $(CC)
|
|
endif
|
|
else
|
|
ifeq ($(ARCH),arm)
|
|
TARGET = arm
|
|
endif
|
|
endif
|
|
endif
|
|
endif
|
|
endif
|
|
BCHECK_O = bcheck.o
|
|
endif
|
|
|
|
DIR = $(TARGET)
|
|
|
|
native : ../libtcc1.a
|
|
cross : $(DIR)/libtcc1.a
|
|
|
|
native : TCC = $(TOP)/tcc$(EXESUF)
|
|
cross : TCC = $(TOP)/$(TARGET)-tcc$(EXESUF)
|
|
|
|
I386_O = libtcc1.o alloca86.o alloca86-bt.o $(BCHECK_O)
|
|
X86_64_O = libtcc1.o alloca86_64.o
|
|
ARM_O = libtcc1.o armeabi.o
|
|
WIN32_O = $(I386_O) crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o
|
|
WIN64_O = $(X86_64_O) crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o
|
|
|
|
ifeq "$(TARGET)" "i386-win32"
|
|
OBJ = $(addprefix $(DIR)/,$(WIN32_O))
|
|
TGT = -DTCC_TARGET_I386 -DTCC_TARGET_PE
|
|
XCC = $(TCC) -B$(top_srcdir)/win32 -I$(top_srcdir)/include
|
|
XAR = $(DIR)/tiny_libmaker$(EXESUF)
|
|
else
|
|
ifeq "$(TARGET)" "x86_64-win32"
|
|
OBJ = $(addprefix $(DIR)/,$(WIN64_O))
|
|
TGT = -DTCC_TARGET_X86_64 -DTCC_TARGET_PE
|
|
XCC = $(TCC) -B$(top_srcdir)/win32 -I$(top_srcdir)/include
|
|
XAR = $(DIR)/tiny_libmaker$(EXESUF)
|
|
else
|
|
ifeq "$(TARGET)" "i386"
|
|
OBJ = $(addprefix $(DIR)/,$(I386_O))
|
|
TGT = -DTCC_TARGET_I386
|
|
XCC ?= $(TCC) -B$(TOP)
|
|
else
|
|
ifeq "$(TARGET)" "x86_64"
|
|
OBJ = $(addprefix $(DIR)/,$(X86_64_O))
|
|
TGT = -DTCC_TARGET_X86_64
|
|
XCC ?= $(TCC) -B$(TOP)
|
|
else
|
|
ifeq "$(TARGET)" "arm"
|
|
OBJ = $(addprefix $(DIR)/,$(ARM_O))
|
|
TGT = -DTCC_TARGET_ARM
|
|
XCC ?= $(TCC) -B$(TOP)
|
|
else
|
|
$(error libtcc1.a not supported on target '$(TARGET)')
|
|
endif
|
|
endif
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
XFLAGS = $(CPPFLAGS) $(CFLAGS) $(TGT)
|
|
|
|
ifeq ($(TARGETOS),Darwin)
|
|
XAR = $(DIR)/tiny_libmaker$(EXESUF)
|
|
XFLAGS += -D_ANSI_SOURCE
|
|
BCHECK_O =
|
|
endif
|
|
|
|
ifdef XAR
|
|
AR = $(XAR)
|
|
endif
|
|
|
|
$(DIR)/libtcc1.a ../libtcc1.a : $(OBJ) $(XAR)
|
|
$(AR) rcs $@ $(OBJ)
|
|
$(DIR)/%.o : %.c
|
|
$(XCC) -c $< -o $@ $(XFLAGS)
|
|
$(DIR)/%.o : %.S
|
|
$(XCC) -c $< -o $@ $(XFLAGS)
|
|
$(DIR)/%$(EXESUF) : $(TOP)/win32/tools/%.c
|
|
$(CC) -o $@ $< $(XFLAGS) $(LDFLAGS)
|
|
|
|
$(OBJ) $(XAR) : $(DIR)/exists
|
|
$(DIR)/exists :
|
|
mkdir -p $(DIR)
|
|
@echo $@ > $@
|
|
|
|
clean :
|
|
rm -rfv i386-win32 x86_64-win32 i386 x86_64
|