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)-)
|
various stuff
win32/Makefile ("for cygwin") removed
- On cygwin, the normal ./configure && make can be used with either
cygwin's "GCC for Win32 Toolchain"
./configure --cross-prefix=i686-w64-mingw32-
or with an existing tcc:
./configure --cc=<old-tccdir>/tcc.exe
tcctest.c:
- exclude test_high_clobbers() on _WIN64 (does not work)
tests2/95_bitfield.c:
- use 'signed char' for ARM (where default 'char' is unsigned)
tests:
- remove -I "expr" diff option to allow tests with
busybox-diff.
libtcc.c, tcc.c:
- removed -iwithprefix option. It is supposed to be
combined with -iprefix which we don't have either.
tccgen.c:
- fix assignments and return of 'void', as in
void f() {
void *p, *q;
*p = *q:
return *p;
}
This appears to be allowed but should do nothing.
tcc.h, libtcc.c, tccpp.c:
- Revert "Introduce VIP sysinclude paths which are always searched first"
This reverts commit 1d5e386b0a78393ac6b670c209a185849ec798a1.
The patch was giving tcc's system includes priority over -I which
is not how it should be.
tccelf.c:
- add DT_TEXTREL tag only if text relocations are actually
used (which is likely not the case on x86_64)
- prepare_dynamic_rel(): avoid relocation of unresolved
(weak) symbols
tccrun.c:
- for HAVE_SELINUX, use two mappings to the same (real) file.
(it was so once except the RX mapping wasn't used at all).
tccpe.c:
- fix relocation constant used for x86_64 (by Andrei E. Warentin)
- #ifndef _WIN32 do "chmod 755 ..." to get runnable exes on cygwin.
tccasm.c:
- keep forward asm labels static, otherwise they will endup
in dynsym eventually.
configure, Makefile:
- mingw32: respect ./configure options --bindir --docdir --libdir
- allow overriding tcc when building libtcc1.a and libtcc.def with
make XTCC=<tcc program to use>
- use $(wildcard ...) for install to allow installing just
a cross compiler for example
make cross-arm
make install
- use name <target>-libtcc1.a
build-tcc.bat:
- add options: -clean, -b bindir
2017-10-11 19:13:43 +03:00
|
|
|
BIN = $(TOP)/$(X)libtcc1.a
|
2019-12-10 10:07:25 +03:00
|
|
|
BINB = $(TOP)/$(X)libtccb1.a
|
2010-12-04 18:47:08 +03:00
|
|
|
|
various stuff
win32/Makefile ("for cygwin") removed
- On cygwin, the normal ./configure && make can be used with either
cygwin's "GCC for Win32 Toolchain"
./configure --cross-prefix=i686-w64-mingw32-
or with an existing tcc:
./configure --cc=<old-tccdir>/tcc.exe
tcctest.c:
- exclude test_high_clobbers() on _WIN64 (does not work)
tests2/95_bitfield.c:
- use 'signed char' for ARM (where default 'char' is unsigned)
tests:
- remove -I "expr" diff option to allow tests with
busybox-diff.
libtcc.c, tcc.c:
- removed -iwithprefix option. It is supposed to be
combined with -iprefix which we don't have either.
tccgen.c:
- fix assignments and return of 'void', as in
void f() {
void *p, *q;
*p = *q:
return *p;
}
This appears to be allowed but should do nothing.
tcc.h, libtcc.c, tccpp.c:
- Revert "Introduce VIP sysinclude paths which are always searched first"
This reverts commit 1d5e386b0a78393ac6b670c209a185849ec798a1.
The patch was giving tcc's system includes priority over -I which
is not how it should be.
tccelf.c:
- add DT_TEXTREL tag only if text relocations are actually
used (which is likely not the case on x86_64)
- prepare_dynamic_rel(): avoid relocation of unresolved
(weak) symbols
tccrun.c:
- for HAVE_SELINUX, use two mappings to the same (real) file.
(it was so once except the RX mapping wasn't used at all).
tccpe.c:
- fix relocation constant used for x86_64 (by Andrei E. Warentin)
- #ifndef _WIN32 do "chmod 755 ..." to get runnable exes on cygwin.
tccasm.c:
- keep forward asm labels static, otherwise they will endup
in dynsym eventually.
configure, Makefile:
- mingw32: respect ./configure options --bindir --docdir --libdir
- allow overriding tcc when building libtcc1.a and libtcc.def with
make XTCC=<tcc program to use>
- use $(wildcard ...) for install to allow installing just
a cross compiler for example
make cross-arm
make install
- use name <target>-libtcc1.a
build-tcc.bat:
- add options: -clean, -b bindir
2017-10-11 19:13:43 +03:00
|
|
|
XTCC ?= $(TOP)/$(X)tcc$(EXESUF)
|
|
|
|
XCC = $(XTCC)
|
|
|
|
XAR = $(XTCC) -ar
|
2017-02-25 14:49:47 +03:00
|
|
|
XFLAGS-unx = -B$(TOPSRC)
|
|
|
|
XFLAGS-win = -B$(TOPSRC)/win32 -I$(TOPSRC)/include
|
|
|
|
XFLAGS = $(XFLAGS$(XCFG))
|
|
|
|
XCFG = $(or $(findstring -win,$T),-unx)
|
|
|
|
|
various stuff
win32/Makefile ("for cygwin") removed
- On cygwin, the normal ./configure && make can be used with either
cygwin's "GCC for Win32 Toolchain"
./configure --cross-prefix=i686-w64-mingw32-
or with an existing tcc:
./configure --cc=<old-tccdir>/tcc.exe
tcctest.c:
- exclude test_high_clobbers() on _WIN64 (does not work)
tests2/95_bitfield.c:
- use 'signed char' for ARM (where default 'char' is unsigned)
tests:
- remove -I "expr" diff option to allow tests with
busybox-diff.
libtcc.c, tcc.c:
- removed -iwithprefix option. It is supposed to be
combined with -iprefix which we don't have either.
tccgen.c:
- fix assignments and return of 'void', as in
void f() {
void *p, *q;
*p = *q:
return *p;
}
This appears to be allowed but should do nothing.
tcc.h, libtcc.c, tccpp.c:
- Revert "Introduce VIP sysinclude paths which are always searched first"
This reverts commit 1d5e386b0a78393ac6b670c209a185849ec798a1.
The patch was giving tcc's system includes priority over -I which
is not how it should be.
tccelf.c:
- add DT_TEXTREL tag only if text relocations are actually
used (which is likely not the case on x86_64)
- prepare_dynamic_rel(): avoid relocation of unresolved
(weak) symbols
tccrun.c:
- for HAVE_SELINUX, use two mappings to the same (real) file.
(it was so once except the RX mapping wasn't used at all).
tccpe.c:
- fix relocation constant used for x86_64 (by Andrei E. Warentin)
- #ifndef _WIN32 do "chmod 755 ..." to get runnable exes on cygwin.
tccasm.c:
- keep forward asm labels static, otherwise they will endup
in dynsym eventually.
configure, Makefile:
- mingw32: respect ./configure options --bindir --docdir --libdir
- allow overriding tcc when building libtcc1.a and libtcc.def with
make XTCC=<tcc program to use>
- use $(wildcard ...) for install to allow installing just
a cross compiler for example
make cross-arm
make install
- use name <target>-libtcc1.a
build-tcc.bat:
- add options: -clean, -b bindir
2017-10-11 19:13:43 +03:00
|
|
|
# in order to use gcc, tyoe: make <target>-libtcc1-usegcc=yes
|
|
|
|
arm-libtcc1-usegcc ?= no
|
2019-12-10 10:07:25 +03:00
|
|
|
x86_64-libtcc1-usegcc ?= no
|
|
|
|
i386-libtcc1-usegcc ?= no
|
2010-12-04 18:47:08 +03:00
|
|
|
|
various stuff
win32/Makefile ("for cygwin") removed
- On cygwin, the normal ./configure && make can be used with either
cygwin's "GCC for Win32 Toolchain"
./configure --cross-prefix=i686-w64-mingw32-
or with an existing tcc:
./configure --cc=<old-tccdir>/tcc.exe
tcctest.c:
- exclude test_high_clobbers() on _WIN64 (does not work)
tests2/95_bitfield.c:
- use 'signed char' for ARM (where default 'char' is unsigned)
tests:
- remove -I "expr" diff option to allow tests with
busybox-diff.
libtcc.c, tcc.c:
- removed -iwithprefix option. It is supposed to be
combined with -iprefix which we don't have either.
tccgen.c:
- fix assignments and return of 'void', as in
void f() {
void *p, *q;
*p = *q:
return *p;
}
This appears to be allowed but should do nothing.
tcc.h, libtcc.c, tccpp.c:
- Revert "Introduce VIP sysinclude paths which are always searched first"
This reverts commit 1d5e386b0a78393ac6b670c209a185849ec798a1.
The patch was giving tcc's system includes priority over -I which
is not how it should be.
tccelf.c:
- add DT_TEXTREL tag only if text relocations are actually
used (which is likely not the case on x86_64)
- prepare_dynamic_rel(): avoid relocation of unresolved
(weak) symbols
tccrun.c:
- for HAVE_SELINUX, use two mappings to the same (real) file.
(it was so once except the RX mapping wasn't used at all).
tccpe.c:
- fix relocation constant used for x86_64 (by Andrei E. Warentin)
- #ifndef _WIN32 do "chmod 755 ..." to get runnable exes on cygwin.
tccasm.c:
- keep forward asm labels static, otherwise they will endup
in dynsym eventually.
configure, Makefile:
- mingw32: respect ./configure options --bindir --docdir --libdir
- allow overriding tcc when building libtcc1.a and libtcc.def with
make XTCC=<tcc program to use>
- use $(wildcard ...) for install to allow installing just
a cross compiler for example
make cross-arm
make install
- use name <target>-libtcc1.a
build-tcc.bat:
- add options: -clean, -b bindir
2017-10-11 19:13:43 +03:00
|
|
|
ifeq "$($(T)-libtcc1-usegcc)" "yes"
|
2017-05-07 13:41:29 +03:00
|
|
|
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 =
|
2019-06-22 02:38:43 +03:00
|
|
|
else
|
|
|
|
DSO_O = dsohandle.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
|
|
|
|
|
2019-12-10 10:07:25 +03:00
|
|
|
XFLAGS += -g -Wno-deprecated-declarations
|
|
|
|
|
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
|
2019-07-22 02:23:27 +03:00
|
|
|
RISCV64_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
|
|
|
|
2019-12-10 10:07:25 +03:00
|
|
|
OBJ-i386 = $(I386_O) $(DSO_O)
|
|
|
|
OBJ-x86_64 = $(X86_64_O) va_list.o $(DSO_O)
|
2017-05-07 13:41:29 +03:00
|
|
|
OBJ-x86_64-osx = $(X86_64_O) va_list.o
|
2019-12-10 10:07:25 +03:00
|
|
|
OBJ-i386-win32 = $(I386_O) chkstk.o $(WIN_O)
|
|
|
|
OBJ-x86_64-win32 = $(X86_64_O) chkstk.o (WIN_O)
|
2019-06-22 02:38:43 +03:00
|
|
|
OBJ-arm64 = $(ARM64_O) $(DSO_O)
|
|
|
|
OBJ-arm = $(ARM_O) $(DSO_O)
|
|
|
|
OBJ-arm-fpa = $(ARM_O) $(DSO_O)
|
|
|
|
OBJ-arm-fpa-ld = $(ARM_O) $(DSO_O)
|
|
|
|
OBJ-arm-vfp = $(ARM_O) $(DSO_O)
|
|
|
|
OBJ-arm-eabi = $(ARM_O) $(DSO_O)
|
|
|
|
OBJ-arm-eabihf = $(ARM_O) $(DSO_O)
|
2017-02-25 14:49:47 +03:00
|
|
|
OBJ-arm-wince = $(ARM_O) $(WIN_O)
|
2019-06-22 07:13:10 +03:00
|
|
|
OBJ-riscv64 = $(RISCV64_O) $(DSO_O)
|
2017-02-25 14:49:47 +03:00
|
|
|
|
2019-12-10 10:07:25 +03:00
|
|
|
OBJB-i386 = $(BCHECK_O)
|
|
|
|
OBJB-x86_64 = $(BCHECK_O)
|
2019-12-10 10:44:44 +03:00
|
|
|
OBJB-x86_64-osx = dummy.o
|
2019-12-10 10:07:25 +03:00
|
|
|
OBJB-i386-win32 = bcheck.o
|
|
|
|
OBJB-x86_64-win32 = bcheck.o
|
2019-12-10 10:44:44 +03:00
|
|
|
OBJB-arm64 = dummy.o
|
|
|
|
OBJB-arm = dummy.o
|
|
|
|
OBJB-arm-fpa = dummy.o
|
|
|
|
OBJB-arm-fpa-ld = dummy.o
|
|
|
|
OBJB-arm-vfp = dummy.o
|
|
|
|
OBJB-arm-eabi = dummy.o
|
|
|
|
OBJB-arm-eabihf = dummy.o
|
|
|
|
OBJB-arm-wince = dummy.o
|
|
|
|
OBJB-riscv64 = dummy.o
|
2019-12-10 10:07:25 +03:00
|
|
|
|
|
|
|
all: $(BIN) $(BINB)
|
|
|
|
|
2017-02-25 14:49:47 +03:00
|
|
|
$(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
|
|
|
|
2019-12-10 10:07:25 +03:00
|
|
|
$(BINB) : $(patsubst %.o,$(X)%.o,$(OBJB-$T))
|
|
|
|
$(XAR) rcs $@ $^
|
|
|
|
|
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 :
|
2019-12-10 10:07:25 +03:00
|
|
|
rm -f *.a *.o $(BIN) $(BINB)
|