mirror of
https://github.com/mirror/tinycc.git
synced 2025-02-04 06:30:10 +08:00
make tcc from tcc.c and libtcc from libtcc.c
This commit is contained in:
parent
b8f6e1ae30
commit
5c6509578e
2
Makefile
2
Makefile
@ -139,7 +139,7 @@ arm-tcc-vfp-eabi$(EXESUF): $(ARM_FILES)
|
|||||||
|
|
||||||
# libtcc generation and test
|
# libtcc generation and test
|
||||||
libtcc.o: $(NATIVE_FILES)
|
libtcc.o: $(NATIVE_FILES)
|
||||||
$(CC) -o $@ -c $< $(NATIVE_TARGET) -DLIBTCC $(CFLAGS)
|
$(CC) -o $@ -c libtcc.c $(NATIVE_TARGET) $(CFLAGS)
|
||||||
|
|
||||||
libtcc.a: libtcc.o
|
libtcc.a: libtcc.o
|
||||||
$(AR) rcs $@ $^
|
$(AR) rcs $@ $^
|
||||||
|
5
libtcc.c
5
libtcc.c
@ -125,7 +125,6 @@ static struct TCCState *tcc_state;
|
|||||||
static const char *tcc_lib_path = CONFIG_TCCDIR;
|
static const char *tcc_lib_path = CONFIG_TCCDIR;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef TCC_TARGET_I386
|
#ifdef TCC_TARGET_I386
|
||||||
#include "i386-gen.c"
|
#include "i386-gen.c"
|
||||||
#endif
|
#endif
|
||||||
@ -706,14 +705,12 @@ void error1(TCCState *s1, int is_warning, const char *fmt, va_list ap)
|
|||||||
s1->nb_errors++;
|
s1->nb_errors++;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LIBTCC
|
|
||||||
void tcc_set_error_func(TCCState *s, void *error_opaque,
|
void tcc_set_error_func(TCCState *s, void *error_opaque,
|
||||||
void (*error_func)(void *opaque, const char *msg))
|
void (*error_func)(void *opaque, const char *msg))
|
||||||
{
|
{
|
||||||
s->error_opaque = error_opaque;
|
s->error_opaque = error_opaque;
|
||||||
s->error_func = error_func;
|
s->error_func = error_func;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* error without aborting current compilation */
|
/* error without aborting current compilation */
|
||||||
void error_noabort(const char *fmt, ...)
|
void error_noabort(const char *fmt, ...)
|
||||||
@ -1130,7 +1127,6 @@ static int tcc_compile(TCCState *s1)
|
|||||||
return s1->nb_errors != 0 ? -1 : 0;
|
return s1->nb_errors != 0 ? -1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LIBTCC
|
|
||||||
int tcc_compile_string(TCCState *s, const char *str)
|
int tcc_compile_string(TCCState *s, const char *str)
|
||||||
{
|
{
|
||||||
BufferedFile bf1, *bf = &bf1;
|
BufferedFile bf1, *bf = &bf1;
|
||||||
@ -1158,7 +1154,6 @@ int tcc_compile_string(TCCState *s, const char *str)
|
|||||||
/* currently, no need to close */
|
/* currently, no need to close */
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* define a preprocessor symbol. A value can also be provided with the '=' operator */
|
/* define a preprocessor symbol. A value can also be provided with the '=' operator */
|
||||||
void tcc_define_symbol(TCCState *s1, const char *sym, const char *value)
|
void tcc_define_symbol(TCCState *s1, const char *sym, const char *value)
|
||||||
|
3
tcc.c
3
tcc.c
@ -20,8 +20,6 @@
|
|||||||
|
|
||||||
#include "libtcc.c"
|
#include "libtcc.c"
|
||||||
|
|
||||||
#if !defined(LIBTCC)
|
|
||||||
|
|
||||||
void help(void)
|
void help(void)
|
||||||
{
|
{
|
||||||
printf("tcc version " TCC_VERSION " - Tiny C Compiler - Copyright (C) 2001-2006 Fabrice Bellard\n"
|
printf("tcc version " TCC_VERSION " - Tiny C Compiler - Copyright (C) 2001-2006 Fabrice Bellard\n"
|
||||||
@ -565,4 +563,3 @@ int main(int argc, char **argv)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
@echo>>..\config.h #define CONFIG_SYSROOT ""
|
@echo>>..\config.h #define CONFIG_SYSROOT ""
|
||||||
:
|
:
|
||||||
gcc -Os -fno-strict-aliasing ../tcc.c -o tcc.exe -s
|
gcc -Os -fno-strict-aliasing ../tcc.c -o tcc.exe -s
|
||||||
gcc -Os -fno-strict-aliasing ../tcc.c -D LIBTCC -c -o libtcc.o
|
gcc -Os -fno-strict-aliasing ../libtcc.c -c -o libtcc.o
|
||||||
gcc -Os tools/tiny_impdef.c -o tiny_impdef.exe -s
|
gcc -Os tools/tiny_impdef.c -o tiny_impdef.exe -s
|
||||||
gcc -Os tools/tiny_libmaker.c -o tiny_libmaker.exe -s
|
gcc -Os tools/tiny_libmaker.c -o tiny_libmaker.exe -s
|
||||||
mkdir libtcc
|
mkdir libtcc
|
||||||
|
Loading…
Reference in New Issue
Block a user