2001-11-11 21:01:29 +03:00
|
|
|
#
|
|
|
|
# Tiny C Compiler Makefile
|
|
|
|
#
|
2009-04-18 16:31:35 +04:00
|
|
|
|
|
|
|
TOP ?= .
|
|
|
|
include $(TOP)/config.mak
|
2012-12-14 20:18:03 +04:00
|
|
|
VPATH = $(top_srcdir)
|
2010-12-04 18:47:08 +03:00
|
|
|
|
2014-09-07 19:57:09 +04:00
|
|
|
CPPFLAGS += -I$(TOP) # for config.h
|
2013-01-30 21:39:09 +04:00
|
|
|
|
2013-02-15 16:04:39 +04:00
|
|
|
ifeq (-$(findstring gcc,$(CC))-,-gcc-)
|
2013-02-14 09:53:07 +04:00
|
|
|
ifeq (-$(findstring $(GCC_MAJOR),01)-,--)
|
2010-12-04 18:47:08 +03:00
|
|
|
CFLAGS+=-fno-strict-aliasing
|
2013-02-14 09:53:07 +04:00
|
|
|
ifeq (-$(findstring $(GCC_MAJOR),23)-,--)
|
2012-11-15 02:45:15 +04:00
|
|
|
CFLAGS+=-Wno-pointer-sign -Wno-sign-compare
|
2013-02-14 09:53:07 +04:00
|
|
|
ifeq (-$(GCC_MAJOR)-$(findstring $(GCC_MINOR),56789)-,-4--)
|
|
|
|
CFLAGS+=-D_FORTIFY_SOURCE=0
|
|
|
|
else
|
|
|
|
CFLAGS+=-Wno-unused-result
|
2010-12-04 18:47:08 +03:00
|
|
|
endif
|
2008-12-01 21:19:25 +03:00
|
|
|
endif
|
2013-02-15 03:53:33 +04:00
|
|
|
endif
|
2013-02-15 00:15:56 +04:00
|
|
|
else # not GCC
|
|
|
|
ifeq (-$(findstring clang,$(CC))-,-clang-)
|
2013-02-14 11:24:51 +04:00
|
|
|
# make clang accept gnuisms in libtcc1.c
|
|
|
|
CFLAGS+=-fheinous-gnu-extensions
|
|
|
|
endif
|
2013-02-15 00:15:56 +04:00
|
|
|
endif
|
|
|
|
|
|
|
|
CPPFLAGS_P=$(CPPFLAGS) -DCONFIG_TCC_STATIC
|
|
|
|
CFLAGS_P=$(CFLAGS) -pg -static
|
|
|
|
LIBS_P=
|
|
|
|
LDFLAGS_P=$(LDFLAGS)
|
2013-02-14 11:24:51 +04:00
|
|
|
|
2010-12-04 18:47:08 +03:00
|
|
|
ifdef CONFIG_WIN64
|
|
|
|
CONFIG_WIN32=yes
|
2008-03-08 22:55:47 +03:00
|
|
|
endif
|
2009-04-19 23:24:32 +04:00
|
|
|
|
|
|
|
ifndef CONFIG_WIN32
|
2010-12-04 18:47:08 +03:00
|
|
|
LIBS=-lm
|
|
|
|
ifndef CONFIG_NOLDL
|
|
|
|
LIBS+=-ldl
|
|
|
|
endif
|
2009-04-19 23:24:32 +04:00
|
|
|
endif
|
|
|
|
|
2010-12-04 18:47:08 +03:00
|
|
|
# make libtcc as static or dynamic library?
|
|
|
|
ifdef DISABLE_STATIC
|
2013-04-18 20:27:34 +04:00
|
|
|
ifndef CONFIG_WIN32
|
2010-12-04 18:47:08 +03:00
|
|
|
LIBTCC=libtcc.so.1.0
|
2013-04-18 20:27:34 +04:00
|
|
|
else
|
|
|
|
LIBTCC=libtcc.dll
|
|
|
|
LIBTCC_DLL=yes
|
|
|
|
LIBTCC_EXTRA=libtcc.def libtcc.a
|
|
|
|
endif
|
2010-12-04 18:47:08 +03:00
|
|
|
LINK_LIBTCC=-Wl,-rpath,"$(libdir)"
|
2010-12-20 16:55:54 +03:00
|
|
|
ifdef DISABLE_RPATH
|
2010-12-21 19:44:48 +03:00
|
|
|
LINK_LIBTCC=
|
2010-12-20 16:55:54 +03:00
|
|
|
endif
|
2010-12-04 18:47:08 +03:00
|
|
|
else
|
|
|
|
LIBTCC=libtcc.a
|
|
|
|
LINK_LIBTCC=
|
2009-04-19 23:24:32 +04:00
|
|
|
endif
|
|
|
|
|
2013-02-15 00:15:56 +04:00
|
|
|
CONFIG_$(ARCH) = yes
|
|
|
|
NATIVE_DEFINES_$(CONFIG_i386) += -DTCC_TARGET_I386
|
|
|
|
NATIVE_DEFINES_$(CONFIG_x86-64) += -DTCC_TARGET_X86_64
|
|
|
|
NATIVE_DEFINES_$(CONFIG_WIN32) += -DTCC_TARGET_PE
|
|
|
|
NATIVE_DEFINES_$(CONFIG_uClibc) += -DTCC_UCLIBC
|
2013-02-28 19:55:10 +04:00
|
|
|
NATIVE_DEFINES_$(CONFIG_arm) += -DTCC_TARGET_ARM
|
2013-02-15 00:15:56 +04:00
|
|
|
NATIVE_DEFINES_$(CONFIG_arm_eabihf) += -DTCC_ARM_EABI -DTCC_ARM_HARDFLOAT
|
|
|
|
NATIVE_DEFINES_$(CONFIG_arm_eabi) += -DTCC_ARM_EABI
|
|
|
|
NATIVE_DEFINES_$(CONFIG_arm_vfp) += -DTCC_ARM_VFP
|
2015-02-13 21:58:31 +03:00
|
|
|
NATIVE_DEFINES_$(CONFIG_arm64) += -DTCC_TARGET_ARM64
|
2013-02-15 00:15:56 +04:00
|
|
|
NATIVE_DEFINES += $(NATIVE_DEFINES_yes)
|
|
|
|
|
2009-04-18 16:31:35 +04:00
|
|
|
ifeq ($(TOP),.)
|
2005-04-15 03:52:04 +04:00
|
|
|
|
|
|
|
PROGS=tcc$(EXESUF)
|
2014-01-04 17:57:52 +04:00
|
|
|
I386_CROSS = i386-linux-gnu-tcc$(EXESUF)
|
2015-03-04 11:19:39 +03:00
|
|
|
WIN32_CROSS = i386-win-mingw32-tcc$(EXESUF)
|
|
|
|
WIN64_CROSS = x86_64-win-mingw32-tcc$(EXESUF)
|
|
|
|
WINCE_CROSS = arm-win-mingw32ce-tcc$(EXESUF)
|
2014-01-04 17:57:52 +04:00
|
|
|
X64_CROSS = x86_64-linux-gnu-tcc$(EXESUF)
|
|
|
|
ARM_FPA_CROSS = arm-linux-fpa-tcc$(EXESUF)
|
|
|
|
ARM_FPA_LD_CROSS = arm-linux-fpa-ld-tcc$(EXESUF)
|
|
|
|
ARM_VFP_CROSS = arm-linux-gnu-tcc$(EXESUF)
|
|
|
|
ARM_EABI_CROSS = arm-linux-gnueabi-tcc$(EXESUF)
|
|
|
|
ARM_EABIHF_CROSS = arm-linux-gnueabihf-tcc$(EXESUF)
|
2009-12-20 22:34:35 +03:00
|
|
|
ARM_CROSS = $(ARM_FPA_CROSS) $(ARM_FPA_LD_CROSS) $(ARM_VFP_CROSS) $(ARM_EABI_CROSS)
|
2015-02-13 21:58:31 +03:00
|
|
|
ARM64_CROSS = arm64-tcc$(EXESUF)
|
2009-04-19 23:24:32 +04:00
|
|
|
C67_CROSS = c67-tcc$(EXESUF)
|
|
|
|
|
2014-01-04 17:57:52 +04:00
|
|
|
# Legacy symlinks for cross compilers
|
|
|
|
$(I386_CROSS)_LINK = i386-tcc$(EXESUF)
|
2015-03-04 11:19:39 +03:00
|
|
|
$(WIN32_CROSS)_LINK = i386-win-tcc$(EXESUF)
|
|
|
|
$(WIN64_CROSS)_LINK = x86_64-win-tcc$(EXESUF)
|
|
|
|
$(WINCE_CROSS)_LINK = arm-win-tcc$(EXESUF)
|
2014-01-04 17:57:52 +04:00
|
|
|
$(X64_CROSS)_LINK = x86_64-tcc$(EXESUF)
|
|
|
|
$(ARM_FPA_CROSS)_LINK = arm-fpa-tcc$(EXESUF)
|
|
|
|
$(ARM_FPA_LD_CROSS)_LINK = arm-fpa-ld-tcc$(EXESUF)
|
|
|
|
$(ARM_VFP_CROSS)_LINK = arm-vfp-tcc$(EXESUF)
|
|
|
|
$(ARM_EABI_CROSS)_LINK = arm-eabi-tcc$(EXESUF)
|
|
|
|
|
2009-12-20 22:34:35 +03:00
|
|
|
CORE_FILES = tcc.c libtcc.c tccpp.c tccgen.c tccelf.c tccasm.c tccrun.c
|
|
|
|
CORE_FILES += tcc.h config.h libtcc.h tcctok.h
|
2009-08-27 11:53:50 +04:00
|
|
|
I386_FILES = $(CORE_FILES) i386-gen.c i386-asm.c i386-asm.h i386-tok.h
|
|
|
|
WIN32_FILES = $(CORE_FILES) i386-gen.c i386-asm.c i386-asm.h i386-tok.h tccpe.c
|
2009-12-20 00:08:37 +03:00
|
|
|
WIN64_FILES = $(CORE_FILES) x86_64-gen.c i386-asm.c x86_64-asm.h tccpe.c
|
2009-08-27 12:25:28 +04:00
|
|
|
WINCE_FILES = $(CORE_FILES) arm-gen.c tccpe.c
|
2009-12-20 00:08:37 +03:00
|
|
|
X86_64_FILES = $(CORE_FILES) x86_64-gen.c i386-asm.c x86_64-asm.h
|
2009-04-19 23:24:32 +04:00
|
|
|
ARM_FILES = $(CORE_FILES) arm-gen.c
|
2015-02-13 21:58:31 +03:00
|
|
|
ARM64_FILES = $(CORE_FILES) arm64-gen.c
|
2009-04-19 23:24:32 +04:00
|
|
|
C67_FILES = $(CORE_FILES) c67-gen.c tcccoff.c
|
2009-04-18 16:31:35 +04:00
|
|
|
|
2010-12-04 18:47:08 +03:00
|
|
|
ifdef CONFIG_WIN64
|
|
|
|
PROGS+=tiny_impdef$(EXESUF) tiny_libmaker$(EXESUF)
|
|
|
|
NATIVE_FILES=$(WIN64_FILES)
|
2015-02-13 21:58:31 +03:00
|
|
|
PROGS_CROSS=$(WIN32_CROSS) $(I386_CROSS) $(X64_CROSS) $(ARM_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS)
|
2015-03-04 11:19:39 +03:00
|
|
|
LIBTCC1_CROSS=lib/i386-win/libtcc1.a
|
2010-12-04 18:47:08 +03:00
|
|
|
LIBTCC1=libtcc1.a
|
2012-12-21 17:17:16 +04:00
|
|
|
else ifdef CONFIG_WIN32
|
2010-12-04 18:47:08 +03:00
|
|
|
PROGS+=tiny_impdef$(EXESUF) tiny_libmaker$(EXESUF)
|
|
|
|
NATIVE_FILES=$(WIN32_FILES)
|
2015-02-13 21:58:31 +03:00
|
|
|
PROGS_CROSS=$(WIN64_CROSS) $(I386_CROSS) $(X64_CROSS) $(ARM_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS)
|
2015-03-04 11:19:39 +03:00
|
|
|
LIBTCC1_CROSS=lib/x86_64-win/libtcc1.a
|
2010-12-04 18:47:08 +03:00
|
|
|
LIBTCC1=libtcc1.a
|
2012-12-21 17:17:16 +04:00
|
|
|
else ifeq ($(ARCH),i386)
|
2010-12-04 18:47:08 +03:00
|
|
|
NATIVE_FILES=$(I386_FILES)
|
2015-02-13 21:58:31 +03:00
|
|
|
PROGS_CROSS=$(X64_CROSS) $(WIN32_CROSS) $(WIN64_CROSS) $(ARM_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS)
|
2015-03-04 11:19:39 +03:00
|
|
|
LIBTCC1_CROSS=lib/i386-win/libtcc1.a lib/x86_64-win/libtcc1.a
|
2010-12-04 18:47:08 +03:00
|
|
|
LIBTCC1=libtcc1.a
|
2012-12-21 17:17:16 +04:00
|
|
|
else ifeq ($(ARCH),x86-64)
|
2010-12-04 18:47:08 +03:00
|
|
|
NATIVE_FILES=$(X86_64_FILES)
|
2015-02-13 21:58:31 +03:00
|
|
|
PROGS_CROSS=$(I386_CROSS) $(WIN32_CROSS) $(WIN64_CROSS) $(ARM_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS)
|
2015-03-04 11:19:39 +03:00
|
|
|
LIBTCC1_CROSS=lib/i386-win/libtcc1.a lib/x86_64-win/libtcc1.a lib/i386/libtcc1.a
|
2010-12-04 18:47:08 +03:00
|
|
|
LIBTCC1=libtcc1.a
|
2012-12-21 17:17:16 +04:00
|
|
|
else ifeq ($(ARCH),arm)
|
2010-12-04 18:47:08 +03:00
|
|
|
NATIVE_FILES=$(ARM_FILES)
|
2015-02-13 21:58:31 +03:00
|
|
|
PROGS_CROSS=$(I386_CROSS) $(X64_CROSS) $(WIN32_CROSS) $(WIN64_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS)
|
|
|
|
LIBTCC1=libtcc1.a
|
2015-03-04 11:19:39 +03:00
|
|
|
LIBTCC1_CROSS=lib/i386-win/libtcc1.a lib/x86_64-win/libtcc1.a lib/i386/libtcc1.a
|
2015-02-13 21:58:31 +03:00
|
|
|
else ifeq ($(ARCH),arm64)
|
|
|
|
NATIVE_FILES=$(ARM64_FILES)
|
|
|
|
PROGS_CROSS=$(I386_CROSS) $(X64_CROSS) $(WIN32_CROSS) $(WIN64_CROSS) $(ARM_CROSS) $(C67_CROSS) $(WINCE_CROSS)
|
2013-02-28 19:55:10 +04:00
|
|
|
LIBTCC1=libtcc1.a
|
2015-03-04 11:19:39 +03:00
|
|
|
LIBTCC1_CROSS=lib/i386-win/libtcc1.a lib/x86_64-win/libtcc1.a lib/i386/libtcc1.a
|
2010-12-04 18:47:08 +03:00
|
|
|
endif
|
2014-01-04 17:57:52 +04:00
|
|
|
PROGS_CROSS_LINK=$(foreach PROG_CROSS,$(PROGS_CROSS),$($(PROG_CROSS)_LINK))
|
2009-04-18 16:31:35 +04:00
|
|
|
|
2012-02-16 20:24:14 +04:00
|
|
|
ifeq ($(TARGETOS),Darwin)
|
2012-03-06 22:26:36 +04:00
|
|
|
PROGS+=tiny_libmaker$(EXESUF)
|
2012-02-16 20:24:14 +04:00
|
|
|
endif
|
2010-04-26 12:27:15 +04:00
|
|
|
|
2013-04-18 20:27:34 +04:00
|
|
|
TCCLIBS = $(LIBTCC1) $(LIBTCC) $(LIBTCC_EXTRA)
|
2011-07-07 14:14:08 +04:00
|
|
|
TCCDOCS = tcc.1 tcc-doc.html tcc-doc.info
|
2010-12-04 18:47:08 +03:00
|
|
|
|
2005-04-15 03:52:04 +04:00
|
|
|
ifdef CONFIG_CROSS
|
2010-12-04 18:47:08 +03:00
|
|
|
PROGS+=$(PROGS_CROSS)
|
|
|
|
TCCLIBS+=$(LIBTCC1_CROSS)
|
2008-12-01 21:19:25 +03:00
|
|
|
endif
|
2005-04-15 03:52:04 +04:00
|
|
|
|
2013-01-14 20:34:07 +04:00
|
|
|
all: $(PROGS) $(TCCLIBS) $(TCCDOCS)
|
2009-04-18 16:31:35 +04:00
|
|
|
|
2005-04-15 03:52:04 +04:00
|
|
|
# Host Tiny C Compiler
|
2010-12-04 18:47:08 +03:00
|
|
|
tcc$(EXESUF): tcc.o $(LIBTCC)
|
2013-01-14 20:34:07 +04:00
|
|
|
$(CC) -o $@ $^ $(LIBS) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(LINK_LIBTCC)
|
2001-11-11 21:01:29 +03:00
|
|
|
|
2005-04-15 03:52:04 +04:00
|
|
|
# Cross Tiny C Compilers
|
2013-01-30 22:39:29 +04:00
|
|
|
%-tcc$(EXESUF): tcc.c
|
|
|
|
$(CC) -o $@ $< -DONE_SOURCE $(DEFINES) $(CPPFLAGS) $(CFLAGS) $(LIBS) $(LDFLAGS)
|
2014-01-04 17:57:52 +04:00
|
|
|
$(if $($@_LINK),ln -sf $@ $($@_LINK))
|
2009-12-20 22:34:35 +03:00
|
|
|
|
2013-02-06 22:01:07 +04:00
|
|
|
# profiling version
|
|
|
|
tcc_p$(EXESUF): $(NATIVE_FILES)
|
|
|
|
$(CC) -o $@ $< -DONE_SOURCE $(NATIVE_DEFINES) $(CPPFLAGS_P) $(CFLAGS_P) $(LIBS_P) $(LDFLAGS_P)
|
|
|
|
|
2011-08-01 03:10:36 +04:00
|
|
|
$(I386_CROSS): DEFINES = -DTCC_TARGET_I386 \
|
2015-03-04 10:50:33 +03:00
|
|
|
-DCONFIG_TCCDIR="\"$(tccdir)/i386\""
|
|
|
|
$(X64_CROSS): DEFINES = -DTCC_TARGET_X86_64
|
2011-08-01 03:10:36 +04:00
|
|
|
$(WIN32_CROSS): DEFINES = -DTCC_TARGET_I386 -DTCC_TARGET_PE \
|
|
|
|
-DCONFIG_TCCDIR="\"$(tccdir)/win32\"" \
|
2011-08-11 18:55:30 +04:00
|
|
|
-DCONFIG_TCC_LIBPATHS="\"{B}/lib/32;{B}/lib\""
|
2011-08-01 03:10:36 +04:00
|
|
|
$(WIN64_CROSS): DEFINES = -DTCC_TARGET_X86_64 -DTCC_TARGET_PE \
|
|
|
|
-DCONFIG_TCCDIR="\"$(tccdir)/win32\"" \
|
2011-08-11 18:55:30 +04:00
|
|
|
-DCONFIG_TCC_LIBPATHS="\"{B}/lib/64;{B}/lib\""
|
2009-12-20 22:34:35 +03:00
|
|
|
$(WINCE_CROSS): DEFINES = -DTCC_TARGET_PE
|
|
|
|
$(C67_CROSS): DEFINES = -DTCC_TARGET_C67
|
|
|
|
$(ARM_FPA_CROSS): DEFINES = -DTCC_TARGET_ARM
|
|
|
|
$(ARM_FPA_LD_CROSS)$(EXESUF): DEFINES = -DTCC_TARGET_ARM -DLDOUBLE_SIZE=12
|
2015-03-04 10:50:33 +03:00
|
|
|
$(ARM_VFP_CROSS): DEFINES = -DTCC_TARGET_ARM -DTCC_ARM_VFP
|
|
|
|
$(ARM_EABI_CROSS): DEFINES = -DTCC_TARGET_ARM -DTCC_ARM_EABI -DTCC_ARM_VFP
|
2015-02-13 21:58:31 +03:00
|
|
|
$(ARM64_CROSS): DEFINES = -DTCC_TARGET_ARM64
|
2009-12-20 22:34:35 +03:00
|
|
|
|
|
|
|
$(I386_CROSS): $(I386_FILES)
|
|
|
|
$(X64_CROSS): $(X86_64_FILES)
|
|
|
|
$(WIN32_CROSS): $(WIN32_FILES)
|
|
|
|
$(WIN64_CROSS): $(WIN64_FILES)
|
|
|
|
$(WINCE_CROSS): $(WINCE_FILES)
|
|
|
|
$(C67_CROSS): $(C67_FILES)
|
|
|
|
$(ARM_FPA_CROSS) $(ARM_FPA_LD_CROSS) $(ARM_VFP_CROSS) $(ARM_EABI_CROSS): $(ARM_FILES)
|
2015-02-13 21:58:31 +03:00
|
|
|
$(ARM64_CROSS): $(ARM64_FILES)
|
2009-04-18 16:31:35 +04:00
|
|
|
|
|
|
|
# libtcc generation and test
|
2011-07-14 20:45:37 +04:00
|
|
|
ifndef ONE_SOURCE
|
2009-12-20 03:53:49 +03:00
|
|
|
LIBTCC_OBJ = $(filter-out tcc.o,$(patsubst %.c,%.o,$(filter %.c,$(NATIVE_FILES))))
|
|
|
|
LIBTCC_INC = $(filter %.h,$(CORE_FILES)) $(filter-out $(CORE_FILES),$(NATIVE_FILES))
|
|
|
|
else
|
|
|
|
LIBTCC_OBJ = libtcc.o
|
|
|
|
LIBTCC_INC = $(NATIVE_FILES)
|
2012-04-18 20:43:09 +04:00
|
|
|
libtcc.o : NATIVE_DEFINES += -DONE_SOURCE
|
2009-12-20 03:53:49 +03:00
|
|
|
endif
|
|
|
|
|
|
|
|
$(LIBTCC_OBJ) tcc.o : %.o : %.c $(LIBTCC_INC)
|
2012-10-22 13:11:42 +04:00
|
|
|
$(CC) -o $@ -c $< $(NATIVE_DEFINES) $(CPPFLAGS) $(CFLAGS)
|
2009-12-20 03:53:49 +03:00
|
|
|
|
2013-04-18 20:27:34 +04:00
|
|
|
ifndef LIBTCC_DLL
|
2009-12-20 03:53:49 +03:00
|
|
|
libtcc.a: $(LIBTCC_OBJ)
|
2009-04-18 16:31:35 +04:00
|
|
|
$(AR) rcs $@ $^
|
2013-04-18 20:27:34 +04:00
|
|
|
endif
|
2008-09-05 23:07:56 +04:00
|
|
|
|
2010-04-26 00:34:02 +04:00
|
|
|
libtcc.so.1.0: $(LIBTCC_OBJ)
|
2012-10-22 13:11:42 +04:00
|
|
|
$(CC) -shared -Wl,-soname,$@ -o $@ $^ $(LDFLAGS)
|
2010-04-25 00:27:56 +04:00
|
|
|
|
2010-12-04 18:47:08 +03:00
|
|
|
libtcc.so.1.0: CFLAGS+=-fPIC
|
2004-10-05 02:19:21 +04:00
|
|
|
|
2013-04-18 20:27:34 +04:00
|
|
|
ifdef LIBTCC_DLL
|
|
|
|
libtcc.dll libtcc.def libtcc.a: $(LIBTCC_OBJ)
|
|
|
|
$(CC) -shared $^ -o $@ $(LDFLAGS) -Wl,--output-def,libtcc.def,--out-implib,libtcc.a
|
|
|
|
endif
|
|
|
|
|
2005-04-15 03:52:04 +04:00
|
|
|
# windows utilities
|
2008-03-08 22:55:47 +03:00
|
|
|
tiny_impdef$(EXESUF): win32/tools/tiny_impdef.c
|
2012-10-22 13:11:42 +04:00
|
|
|
$(CC) -o $@ $< $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
|
2008-03-08 22:55:47 +03:00
|
|
|
tiny_libmaker$(EXESUF): win32/tools/tiny_libmaker.c
|
2012-10-22 13:11:42 +04:00
|
|
|
$(CC) -o $@ $< $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
|
2005-04-15 03:52:04 +04:00
|
|
|
|
2002-07-25 02:13:02 +04:00
|
|
|
# TinyCC runtime libraries
|
2010-12-04 18:47:08 +03:00
|
|
|
libtcc1.a : FORCE
|
2013-02-08 22:07:11 +04:00
|
|
|
$(MAKE) -C lib native
|
2010-12-05 23:39:55 +03:00
|
|
|
lib/%/libtcc1.a : FORCE $(PROGS_CROSS)
|
2013-02-08 22:07:11 +04:00
|
|
|
$(MAKE) -C lib cross TARGET=$*
|
2013-02-06 22:01:07 +04:00
|
|
|
|
2010-12-04 18:47:08 +03:00
|
|
|
FORCE:
|
2003-05-24 19:45:33 +04:00
|
|
|
|
2009-04-18 16:31:35 +04:00
|
|
|
# install
|
2013-04-26 01:30:53 +04:00
|
|
|
TCC_INCLUDES = stdarg.h stddef.h stdbool.h float.h varargs.h
|
2009-04-18 16:31:35 +04:00
|
|
|
INSTALL=install
|
2011-06-18 00:22:04 +04:00
|
|
|
ifdef STRIP_BINARIES
|
|
|
|
INSTALLBIN=$(INSTALL) -s
|
|
|
|
else
|
|
|
|
INSTALLBIN=$(INSTALL)
|
|
|
|
endif
|
2003-04-13 23:48:19 +04:00
|
|
|
|
2014-01-04 05:48:15 +04:00
|
|
|
install-strip: install
|
|
|
|
strip $(foreach PROG,$(PROGS),"$(bindir)"/$(PROG))
|
|
|
|
|
2004-10-08 01:11:43 +04:00
|
|
|
ifndef CONFIG_WIN32
|
2010-12-04 18:47:08 +03:00
|
|
|
install: $(PROGS) $(TCCLIBS) $(TCCDOCS)
|
2009-04-18 16:31:35 +04:00
|
|
|
mkdir -p "$(bindir)"
|
2010-12-20 17:20:08 +03:00
|
|
|
ifeq ($(CC),tcc)
|
2014-01-04 17:57:52 +04:00
|
|
|
$(INSTALL) -m755 $(PROGS) $(PROGS_CROSS_LINK) "$(bindir)"
|
2010-12-20 17:20:08 +03:00
|
|
|
else
|
2011-06-18 00:22:04 +04:00
|
|
|
$(INSTALLBIN) -m755 $(PROGS) "$(bindir)"
|
2010-12-20 17:20:08 +03:00
|
|
|
endif
|
2009-04-18 16:31:35 +04:00
|
|
|
mkdir -p "$(mandir)/man1"
|
2014-01-07 19:05:31 +04:00
|
|
|
-$(INSTALL) -m644 tcc.1 "$(mandir)/man1"
|
2010-12-04 18:47:08 +03:00
|
|
|
mkdir -p "$(infodir)"
|
2014-01-07 19:05:31 +04:00
|
|
|
-$(INSTALL) -m644 tcc-doc.info "$(infodir)"
|
2009-04-18 16:31:35 +04:00
|
|
|
mkdir -p "$(tccdir)"
|
|
|
|
mkdir -p "$(tccdir)/include"
|
2010-12-04 18:47:08 +03:00
|
|
|
ifneq ($(LIBTCC1),)
|
|
|
|
$(INSTALL) -m644 $(LIBTCC1) "$(tccdir)"
|
2005-04-15 03:52:04 +04:00
|
|
|
endif
|
2013-04-26 01:30:53 +04:00
|
|
|
$(INSTALL) -m644 $(addprefix $(top_srcdir)/include/,$(TCC_INCLUDES)) $(top_srcdir)/tcclib.h "$(tccdir)/include"
|
2009-04-18 16:31:35 +04:00
|
|
|
mkdir -p "$(libdir)"
|
2014-01-07 19:05:31 +04:00
|
|
|
$(INSTALL) -m644 $(LIBTCC) "$(libdir)"
|
2010-04-26 00:34:02 +04:00
|
|
|
ifdef DISABLE_STATIC
|
|
|
|
ln -sf "$(ln_libdir)/libtcc.so.1.0" "$(libdir)/libtcc.so.1"
|
|
|
|
ln -sf "$(ln_libdir)/libtcc.so.1.0" "$(libdir)/libtcc.so"
|
2010-04-25 08:58:12 +04:00
|
|
|
endif
|
2013-01-14 21:16:17 +04:00
|
|
|
mkdir -p "$(includedir)"
|
|
|
|
$(INSTALL) -m644 $(top_srcdir)/libtcc.h "$(includedir)"
|
2009-12-20 00:08:15 +03:00
|
|
|
mkdir -p "$(docdir)"
|
2010-12-04 18:47:08 +03:00
|
|
|
-$(INSTALL) -m644 tcc-doc.html "$(docdir)"
|
2010-04-25 08:58:12 +04:00
|
|
|
ifdef CONFIG_CROSS
|
2010-12-02 14:08:57 +03:00
|
|
|
mkdir -p "$(tccdir)/win32/lib/32"
|
|
|
|
mkdir -p "$(tccdir)/win32/lib/64"
|
2014-01-09 13:15:08 +04:00
|
|
|
ifneq ($(ARCH),i386)
|
2010-12-05 12:04:28 +03:00
|
|
|
mkdir -p "$(tccdir)/i386"
|
|
|
|
$(INSTALL) -m644 lib/i386/libtcc1.a "$(tccdir)/i386"
|
2010-12-20 17:20:08 +03:00
|
|
|
cp -r "$(tccdir)/include" "$(tccdir)/i386"
|
2010-12-05 12:04:28 +03:00
|
|
|
endif
|
2013-04-26 01:30:53 +04:00
|
|
|
$(INSTALL) -m644 $(top_srcdir)/win32/lib/*.def "$(tccdir)/win32/lib"
|
2015-03-04 11:19:39 +03:00
|
|
|
$(INSTALL) -m644 lib/i386-win/libtcc1.a "$(tccdir)/win32/lib/32"
|
|
|
|
$(INSTALL) -m644 lib/x86_64-win/libtcc1.a "$(tccdir)/win32/lib/64"
|
2013-04-26 01:30:53 +04:00
|
|
|
cp -r $(top_srcdir)/win32/include/. "$(tccdir)/win32/include"
|
2014-01-09 13:15:08 +04:00
|
|
|
cp -r "$(tccdir)/include" "$(tccdir)/win32"
|
2010-04-25 08:58:12 +04:00
|
|
|
endif
|
2009-04-18 16:31:35 +04:00
|
|
|
|
|
|
|
uninstall:
|
|
|
|
rm -fv $(foreach P,$(PROGS),"$(bindir)/$P")
|
2013-02-06 22:01:07 +04:00
|
|
|
rm -fv $(foreach P,$(LIBTCC1),"$(tccdir)/$P")
|
2009-04-18 16:31:35 +04:00
|
|
|
rm -fv $(foreach P,$(TCC_INCLUDES),"$(tccdir)/include/$P")
|
2013-04-26 01:30:53 +04:00
|
|
|
rm -fv "$(tccdir)/include/tcclib.h"
|
2010-12-04 18:47:08 +03:00
|
|
|
rm -fv "$(docdir)/tcc-doc.html" "$(mandir)/man1/tcc.1" "$(infodir)/tcc-doc.info"
|
|
|
|
rm -fv "$(libdir)/$(LIBTCC)" "$(includedir)/libtcc.h"
|
|
|
|
rm -fv "$(libdir)/libtcc.so*"
|
|
|
|
rm -rf "$(tccdir)/win32"
|
2010-12-20 17:20:08 +03:00
|
|
|
-rmdir $(tccdir)/include
|
2014-01-09 13:15:08 +04:00
|
|
|
ifneq ($(ARCH),i386)
|
2010-12-05 12:04:28 +03:00
|
|
|
rm -rf "$(tccdir)/i386"
|
|
|
|
endif
|
2010-12-02 14:08:57 +03:00
|
|
|
else
|
2010-12-04 18:47:08 +03:00
|
|
|
# on windows
|
|
|
|
install: $(PROGS) $(TCCLIBS) $(TCCDOCS)
|
2009-04-18 16:31:35 +04:00
|
|
|
mkdir -p "$(tccdir)"
|
|
|
|
mkdir -p "$(tccdir)/lib"
|
|
|
|
mkdir -p "$(tccdir)/include"
|
|
|
|
mkdir -p "$(tccdir)/examples"
|
|
|
|
mkdir -p "$(tccdir)/doc"
|
|
|
|
mkdir -p "$(tccdir)/libtcc"
|
2011-06-18 00:22:04 +04:00
|
|
|
$(INSTALLBIN) -m755 $(PROGS) "$(tccdir)"
|
2013-04-17 20:31:18 +04:00
|
|
|
$(INSTALL) -m644 $(LIBTCC1) $(top_srcdir)/win32/lib/*.def "$(tccdir)/lib"
|
|
|
|
cp -r $(top_srcdir)/win32/include/. "$(tccdir)/include"
|
|
|
|
cp -r $(top_srcdir)/win32/examples/. "$(tccdir)/examples"
|
2013-04-26 01:30:53 +04:00
|
|
|
$(INSTALL) -m644 $(addprefix $(top_srcdir)/include/,$(TCC_INCLUDES)) $(top_srcdir)/tcclib.h "$(tccdir)/include"
|
2013-04-17 20:31:18 +04:00
|
|
|
$(INSTALL) -m644 tcc-doc.html $(top_srcdir)/win32/tcc-win32.txt "$(tccdir)/doc"
|
2013-04-18 20:27:34 +04:00
|
|
|
$(INSTALL) -m644 $(top_srcdir)/libtcc.h $(LIBTCC_EXTRA) "$(tccdir)/libtcc"
|
|
|
|
$(INSTALL) -m644 $(LIBTCC) $(tccdir)
|
2010-12-02 14:08:57 +03:00
|
|
|
ifdef CONFIG_CROSS
|
2010-12-04 18:47:08 +03:00
|
|
|
mkdir -p "$(tccdir)/lib/32"
|
|
|
|
mkdir -p "$(tccdir)/lib/64"
|
2015-03-04 11:19:39 +03:00
|
|
|
-$(INSTALL) -m644 lib/i386-win/libtcc1.a "$(tccdir)/lib/32"
|
|
|
|
-$(INSTALL) -m644 lib/x86_64-win/libtcc1.a "$(tccdir)/lib/64"
|
2010-12-02 14:08:57 +03:00
|
|
|
endif
|
|
|
|
|
2010-12-04 18:47:08 +03:00
|
|
|
uninstall:
|
|
|
|
rm -rfv "$(tccdir)/*"
|
2008-12-01 21:19:25 +03:00
|
|
|
endif
|
2002-05-14 02:58:22 +04:00
|
|
|
|
2003-05-18 22:11:06 +04:00
|
|
|
# documentation and man page
|
2002-07-25 02:13:02 +04:00
|
|
|
tcc-doc.html: tcc-doc.texi
|
2013-05-29 15:14:59 +04:00
|
|
|
-makeinfo --no-split --html --number-sections -o $@ $<
|
2002-07-25 02:13:02 +04:00
|
|
|
|
2003-05-18 22:11:06 +04:00
|
|
|
tcc.1: tcc-doc.texi
|
2012-12-14 20:18:03 +04:00
|
|
|
-$(top_srcdir)/texi2pod.pl $< tcc.pod
|
2013-02-17 03:48:51 +04:00
|
|
|
-pod2man --section=1 --center="Tiny C Compiler" --release=`cat $(top_srcdir)/VERSION` tcc.pod > $@
|
2003-05-18 22:11:06 +04:00
|
|
|
|
2010-09-10 23:19:01 +04:00
|
|
|
tcc-doc.info: tcc-doc.texi
|
2012-12-14 20:18:03 +04:00
|
|
|
-makeinfo $<
|
2010-09-10 23:19:01 +04:00
|
|
|
|
2009-04-18 16:31:35 +04:00
|
|
|
# in tests subdir
|
2011-05-14 18:21:45 +04:00
|
|
|
export LIBTCC1
|
|
|
|
|
2014-01-23 21:19:56 +04:00
|
|
|
%est:
|
2014-01-21 16:25:14 +04:00
|
|
|
$(MAKE) -C tests $@ 'PROGS_CROSS=$(PROGS_CROSS)'
|
2010-12-04 18:47:08 +03:00
|
|
|
|
2009-12-20 03:53:49 +03:00
|
|
|
clean:
|
2014-11-26 06:48:07 +03:00
|
|
|
rm -vf $(PROGS) tcc_p$(EXESUF) tcc.pod *~ *.o *.a *.so* *.out *.log \
|
|
|
|
*.exe a.out tags TAGS libtcc_test$(EXESUF)
|
2009-12-20 03:53:49 +03:00
|
|
|
$(MAKE) -C tests $@
|
2011-05-14 18:21:45 +04:00
|
|
|
ifneq ($(LIBTCC1),)
|
2010-12-04 18:47:08 +03:00
|
|
|
$(MAKE) -C lib $@
|
2011-05-14 18:21:45 +04:00
|
|
|
endif
|
2009-04-18 16:31:35 +04:00
|
|
|
|
|
|
|
distclean: clean
|
2010-09-10 23:19:01 +04:00
|
|
|
rm -vf config.h config.mak config.texi tcc.1 tcc-doc.info tcc-doc.html
|
2009-04-18 16:31:35 +04:00
|
|
|
|
2009-12-20 03:53:49 +03:00
|
|
|
config.mak:
|
2010-12-04 18:47:08 +03:00
|
|
|
@echo "Please run ./configure."
|
|
|
|
@exit 1
|
2009-12-20 03:53:49 +03:00
|
|
|
|
2014-11-26 06:48:07 +03:00
|
|
|
tags:
|
|
|
|
ctags $(top_srcdir)/*.[ch] $(top_srcdir)/include/*.h $(top_srcdir)/lib/*.[chS]
|
|
|
|
|
|
|
|
TAGS:
|
|
|
|
ctags -e $(top_srcdir)/*.[ch] $(top_srcdir)/include/*.h $(top_srcdir)/lib/*.[chS]
|
|
|
|
|
2012-12-21 00:29:57 +04:00
|
|
|
# create release tarball from *current* git branch (including tcc-doc.html
|
|
|
|
# and converting two files to CRLF)
|
2012-12-21 17:17:23 +04:00
|
|
|
TCC-VERSION := tcc-$(shell cat $(top_srcdir)/VERSION)
|
2012-12-21 00:29:57 +04:00
|
|
|
tar: tcc-doc.html
|
|
|
|
mkdir $(TCC-VERSION)
|
|
|
|
( cd $(TCC-VERSION) && git --git-dir ../.git checkout -f )
|
|
|
|
cp tcc-doc.html $(TCC-VERSION)
|
|
|
|
for f in tcc-win32.txt build-tcc.bat ; do \
|
|
|
|
cat win32/$$f | sed 's,\(.*\),\1\r,g' > $(TCC-VERSION)/win32/$$f ; \
|
|
|
|
done
|
|
|
|
tar cjf $(TCC-VERSION).tar.bz2 $(TCC-VERSION)
|
|
|
|
rm -rf $(TCC-VERSION)
|
|
|
|
git reset
|
|
|
|
|
2014-11-26 06:48:07 +03:00
|
|
|
.PHONY: all clean tar tags TAGS distclean install uninstall FORCE
|
2012-12-21 00:29:57 +04:00
|
|
|
|
2009-04-19 23:24:32 +04:00
|
|
|
endif # ifeq ($(TOP),.)
|