mirror of
https://github.com/mirror/tinycc.git
synced 2025-01-27 06:10:06 +08:00
libtcc: minor adjustments
- use {B} to substitute tcc_lih_path (instead of \b)
- expand CONFIG_TCC_CRTPREFIX in CONFIG_TCC_LIBPATHS
which fixes duplicate CONFIG_SYSROOT.
- put default CONFIG_SYSROOT ("") into tcc.h
- remove hack from commit db6fcce78f
because $(tccdir)/include is already in sysincludes
- configure: error out for unrecognized options.
- win32/build-tcc.bat: put libtcc into base dir where it will
find lib/include automatically, and build libtcc_test example.
This commit is contained in:
parent
fd0cea8895
commit
74a24d77fd
4
Makefile
4
Makefile
@ -164,10 +164,10 @@ $(I386_CROSS): DEFINES = -DTCC_TARGET_I386 \
|
||||
$(X64_CROSS): DEFINES = -DTCC_TARGET_X86_64
|
||||
$(WIN32_CROSS): DEFINES = -DTCC_TARGET_I386 -DTCC_TARGET_PE \
|
||||
-DCONFIG_TCCDIR="\"$(tccdir)/win32\"" \
|
||||
-DCONFIG_TCC_LIBPATHS="\"\b/lib/32;\b/lib\""
|
||||
-DCONFIG_TCC_LIBPATHS="\"{B}/lib/32;{B}/lib\""
|
||||
$(WIN64_CROSS): DEFINES = -DTCC_TARGET_X86_64 -DTCC_TARGET_PE \
|
||||
-DCONFIG_TCCDIR="\"$(tccdir)/win32\"" \
|
||||
-DCONFIG_TCC_LIBPATHS="\"\b/lib/64;\b/lib\""
|
||||
-DCONFIG_TCC_LIBPATHS="\"{B}/lib/64;{B}/lib\""
|
||||
$(WINCE_CROSS): DEFINES = -DTCC_TARGET_PE
|
||||
$(C67_CROSS): DEFINES = -DTCC_TARGET_C67
|
||||
$(ARM_FPA_CROSS): DEFINES = -DTCC_TARGET_ARM
|
||||
|
4
configure
vendored
4
configure
vendored
@ -168,6 +168,8 @@ for opt do
|
||||
;;
|
||||
--help|-h) show_help="yes"
|
||||
;;
|
||||
*) echo "configure: unrecognized option $opt"; exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
@ -380,7 +382,7 @@ print_var2()
|
||||
{
|
||||
if test -n "$2"; then print_var1 $1 "$2"; fi
|
||||
}
|
||||
print_var1 CONFIG_SYSROOT "$sysroot"
|
||||
print_var2 CONFIG_SYSROOT "$sysroot"
|
||||
print_var1 CONFIG_TCCDIR "$tccdir"
|
||||
print_var2 CONFIG_TCC_SYSINCLUDEPATHS "$tcc_sysincludepaths"
|
||||
print_var2 CONFIG_TCC_LIBPATHS "$tcc_libpaths"
|
||||
|
29
libtcc.c
29
libtcc.c
@ -32,12 +32,6 @@ ST_DATA int tcc_ext = 1;
|
||||
/* XXX: get rid of this ASAP */
|
||||
ST_DATA struct TCCState *tcc_state;
|
||||
|
||||
#ifdef CONFIG_TCC_BACKTRACE
|
||||
ST_DATA int num_callers = 6;
|
||||
ST_DATA const char **rt_bound_error_msg;
|
||||
ST_DATA void *rt_prog_main;
|
||||
#endif
|
||||
|
||||
/********************************************************/
|
||||
|
||||
#ifdef ONE_SOURCE
|
||||
@ -115,7 +109,7 @@ static void tcc_add_systemdir(TCCState *s)
|
||||
{
|
||||
char buf[1000];
|
||||
GetSystemDirectory(buf, sizeof buf);
|
||||
tcc_add_library_path(s, buf);
|
||||
tcc_add_library_path(s, normalize_slashes(buf));
|
||||
}
|
||||
|
||||
#ifndef CONFIG_TCC_STATIC
|
||||
@ -315,8 +309,10 @@ static void tcc_split_path(TCCState *s, void ***p_ary, int *p_nb_ary, const char
|
||||
|
||||
cstr_new(&str);
|
||||
for (p = in; c = *p, c != '\0' && c != PATHSEP; ++p) {
|
||||
if (c == '\b') {
|
||||
cstr_cat(&str, s->tcc_lib_path);
|
||||
if (c == '{' && p[1] && p[2] == '}') {
|
||||
c = p[1], p += 2;
|
||||
if (c == 'B')
|
||||
cstr_cat(&str, s->tcc_lib_path);
|
||||
} else {
|
||||
cstr_ccat(&str, c);
|
||||
}
|
||||
@ -640,11 +636,6 @@ PUB_FUNC void error(const char *fmt, ...)
|
||||
}
|
||||
}
|
||||
|
||||
PUB_FUNC void expect(const char *msg)
|
||||
{
|
||||
error("%s expected", msg);
|
||||
}
|
||||
|
||||
PUB_FUNC void warning(const char *fmt, ...)
|
||||
{
|
||||
TCCState *s1 = tcc_state;
|
||||
@ -1242,6 +1233,7 @@ static int tcc_add_library_internal(TCCState *s, const char *fmt,
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifndef TCC_TARGET_PE
|
||||
/* find and load a dll. Return non zero if not found */
|
||||
/* XXX: add '-rpath' option support ? */
|
||||
ST_FUNC int tcc_add_dll(TCCState *s, const char *filename, int flags)
|
||||
@ -1249,6 +1241,7 @@ ST_FUNC int tcc_add_dll(TCCState *s, const char *filename, int flags)
|
||||
return tcc_add_library_internal(s, "%s/%s", filename, flags,
|
||||
s->library_paths, s->nb_library_paths);
|
||||
}
|
||||
#endif
|
||||
|
||||
ST_FUNC int tcc_add_crt(TCCState *s, const char *filename)
|
||||
{
|
||||
@ -1604,14 +1597,6 @@ LIBTCCAPI void tcc_set_lib_path(TCCState *s, const char *path)
|
||||
s->tcc_lib_path = tcc_strdup(path);
|
||||
}
|
||||
|
||||
PUB_FUNC void set_num_callers(int n)
|
||||
{
|
||||
#ifdef CONFIG_TCC_BACKTRACE
|
||||
num_callers = n;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
PUB_FUNC char *tcc_default_target(TCCState *s, const char *default_file)
|
||||
{
|
||||
char buf[1024];
|
||||
|
6
libtcc.h
6
libtcc.h
@ -1,10 +1,8 @@
|
||||
#ifndef LIBTCC_H
|
||||
#define LIBTCC_H
|
||||
|
||||
#ifdef LIBTCC_AS_DLL
|
||||
#define LIBTCCAPI __declspec(dllexport)
|
||||
#else
|
||||
#define LIBTCCAPI
|
||||
#ifndef LIBTCCAPI
|
||||
# define LIBTCCAPI
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
59
tcc.c
59
tcc.c
@ -263,6 +263,16 @@ static void exec_other_tcc(TCCState *s, char **argv, const char *optarg)
|
||||
}
|
||||
#endif
|
||||
|
||||
static void parse_option_D(TCCState *s1, const char *optarg)
|
||||
{
|
||||
char *sym = tcc_strdup(optarg);
|
||||
char *value = strchr(sym, '=');
|
||||
if (value)
|
||||
*value++ = '\0';
|
||||
tcc_define_symbol(s1, sym, value);
|
||||
tcc_free(sym);
|
||||
}
|
||||
|
||||
static int parse_args(TCCState *s, int argc, char **argv)
|
||||
{
|
||||
int optind;
|
||||
@ -327,16 +337,7 @@ static int parse_args(TCCState *s, int argc, char **argv)
|
||||
error("too many include paths");
|
||||
break;
|
||||
case TCC_OPTION_D:
|
||||
{
|
||||
char *sym, *value;
|
||||
sym = (char *)optarg;
|
||||
value = strchr(sym, '=');
|
||||
if (value) {
|
||||
*value = '\0';
|
||||
value++;
|
||||
}
|
||||
tcc_define_symbol(s, sym, value);
|
||||
}
|
||||
parse_option_D(s, optarg);
|
||||
break;
|
||||
case TCC_OPTION_U:
|
||||
tcc_undefine_symbol(s, optarg);
|
||||
@ -347,12 +348,6 @@ static int parse_args(TCCState *s, int argc, char **argv)
|
||||
case TCC_OPTION_B:
|
||||
/* set tcc utilities path (mainly for tcc development) */
|
||||
tcc_set_lib_path(s, optarg);
|
||||
/* append /include and add it as -isystem, as gcc does */
|
||||
r = tcc_strdup(optarg);
|
||||
r = tcc_realloc(r, strlen(r) + 8 + 1);
|
||||
strcat(r, "/include");
|
||||
tcc_add_sysinclude_path(s, r);
|
||||
tcc_free(r);
|
||||
break;
|
||||
case TCC_OPTION_l:
|
||||
dynarray_add((void ***)&files, &nb_files, r);
|
||||
@ -360,14 +355,14 @@ static int parse_args(TCCState *s, int argc, char **argv)
|
||||
break;
|
||||
case TCC_OPTION_pthread:
|
||||
was_pthread = 1;
|
||||
tcc_define_symbol(s, "_REENTRANT", "1");
|
||||
parse_option_D(s, "_REENTRANT");
|
||||
break;
|
||||
case TCC_OPTION_bench:
|
||||
do_bench = 1;
|
||||
break;
|
||||
#ifdef CONFIG_TCC_BACKTRACE
|
||||
case TCC_OPTION_bt:
|
||||
set_num_callers(atoi(optarg));
|
||||
tcc_set_num_callers(atoi(optarg));
|
||||
break;
|
||||
#endif
|
||||
#ifdef CONFIG_TCC_BCHECK
|
||||
@ -417,17 +412,17 @@ static int parse_args(TCCState *s, int argc, char **argv)
|
||||
print_search_dirs = 1;
|
||||
break;
|
||||
case TCC_OPTION_run:
|
||||
{
|
||||
int argc1;
|
||||
char **argv1;
|
||||
argc1 = expand_args(&argv1, optarg);
|
||||
if (argc1 > 0) {
|
||||
parse_args(s, argc1, argv1);
|
||||
}
|
||||
multiple_files = 0;
|
||||
output_type = TCC_OUTPUT_MEMORY;
|
||||
{
|
||||
int argc1;
|
||||
char **argv1;
|
||||
argc1 = expand_args(&argv1, optarg);
|
||||
if (argc1 > 0) {
|
||||
parse_args(s, argc1, argv1);
|
||||
}
|
||||
multiple_files = 0;
|
||||
output_type = TCC_OUTPUT_MEMORY;
|
||||
break;
|
||||
}
|
||||
case TCC_OPTION_v:
|
||||
do ++s->verbose; while (*optarg++ == 'v');
|
||||
break;
|
||||
@ -447,10 +442,8 @@ static int parse_args(TCCState *s, int argc, char **argv)
|
||||
s->rdynamic = 1;
|
||||
break;
|
||||
case TCC_OPTION_Wl:
|
||||
{
|
||||
if ((r = (char *) tcc_set_linker(s, (char *)optarg, TRUE)))
|
||||
error("unsupported linker option '%s'", r);
|
||||
}
|
||||
if ((r = (char *) tcc_set_linker(s, (char *)optarg, TRUE)))
|
||||
error("unsupported linker option '%s'", r);
|
||||
break;
|
||||
case TCC_OPTION_E:
|
||||
output_type = TCC_OUTPUT_PREPROCESS;
|
||||
@ -473,9 +466,7 @@ static int parse_args(TCCState *s, int argc, char **argv)
|
||||
}
|
||||
}
|
||||
/* fixme: these options could be different on your platform */
|
||||
if (was_pthread
|
||||
&& output_type != TCC_OUTPUT_OBJ)
|
||||
{
|
||||
if (was_pthread && output_type != TCC_OUTPUT_OBJ) {
|
||||
dynarray_add((void ***)&files, &nb_files, "-lpthread");
|
||||
nb_libraries++;
|
||||
}
|
||||
|
37
tcc.h
37
tcc.h
@ -50,7 +50,10 @@
|
||||
#define inline __inline
|
||||
#define inp next_inp
|
||||
#ifdef _WIN64
|
||||
#define uplong unsigned long long
|
||||
# define uplong unsigned long long
|
||||
#endif
|
||||
#ifdef LIBTCC_AS_DLL
|
||||
# define LIBTCCAPI __declspec(dllexport)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -134,6 +137,10 @@
|
||||
|
||||
/* ------------ path configuration ------------ */
|
||||
|
||||
#ifndef CONFIG_SYSROOT
|
||||
# define CONFIG_SYSROOT ""
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_TCC_LDDIR
|
||||
# if defined(TCC_TARGET_X86_64_CENTOS)
|
||||
# define CONFIG_TCC_LDDIR "/lib64"
|
||||
@ -147,25 +154,27 @@
|
||||
# define CONFIG_TCC_CRTPREFIX CONFIG_SYSROOT "/usr" CONFIG_TCC_LDDIR
|
||||
#endif
|
||||
|
||||
/* Below: {B} is substituted by CONFIG_TCCDIR (rsp. -B option) */
|
||||
|
||||
/* system include paths */
|
||||
#ifndef CONFIG_TCC_SYSINCLUDEPATHS
|
||||
# ifdef TCC_TARGET_PE
|
||||
# define CONFIG_TCC_SYSINCLUDEPATHS "\b/include;\b/include/winapi"
|
||||
# define CONFIG_TCC_SYSINCLUDEPATHS "{B}/include;{B}/include/winapi"
|
||||
# else
|
||||
# define CONFIG_TCC_SYSINCLUDEPATHS \
|
||||
CONFIG_SYSROOT "/usr/local/include" \
|
||||
":" CONFIG_SYSROOT "/usr/include" \
|
||||
":" "\b/include"
|
||||
":" "{B}/include"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* library search paths */
|
||||
#ifndef CONFIG_TCC_LIBPATHS
|
||||
# ifdef TCC_TARGET_PE
|
||||
# define CONFIG_TCC_LIBPATHS "\b/lib"
|
||||
# define CONFIG_TCC_LIBPATHS "{B}/lib"
|
||||
# else
|
||||
# define CONFIG_TCC_LIBPATHS \
|
||||
CONFIG_SYSROOT CONFIG_TCC_CRTPREFIX \
|
||||
CONFIG_SYSROOT "/usr" CONFIG_TCC_LDDIR \
|
||||
":" CONFIG_SYSROOT CONFIG_TCC_LDDIR \
|
||||
":" CONFIG_SYSROOT "/usr/local" CONFIG_TCC_LDDIR
|
||||
# endif
|
||||
@ -924,7 +933,9 @@ static inline int toup(int c)
|
||||
return (c >= 'a' && c <= 'z') ? c - 'a' + 'A' : c;
|
||||
}
|
||||
|
||||
#define PUB_FUNC
|
||||
#ifndef PUB_FUNC
|
||||
# define PUB_FUNC
|
||||
#endif
|
||||
|
||||
#ifdef ONE_SOURCE
|
||||
#define ST_INLN static inline
|
||||
@ -946,7 +957,7 @@ ST_DATA int tcc_ext;
|
||||
ST_DATA struct TCCState *tcc_state;
|
||||
|
||||
#ifdef CONFIG_TCC_BACKTRACE
|
||||
ST_DATA int num_callers;
|
||||
ST_DATA int rt_num_callers;
|
||||
ST_DATA const char **rt_bound_error_msg;
|
||||
ST_DATA void *rt_prog_main;
|
||||
#endif
|
||||
@ -976,7 +987,6 @@ PUB_FUNC void dynarray_add(void ***ptab, int *nb_ptr, void *data);
|
||||
PUB_FUNC void dynarray_reset(void *pp, int *n);
|
||||
PUB_FUNC void error_noabort(const char *fmt, ...);
|
||||
PUB_FUNC void error(const char *fmt, ...);
|
||||
PUB_FUNC void expect(const char *msg);
|
||||
PUB_FUNC void warning(const char *fmt, ...);
|
||||
|
||||
/* other utilities */
|
||||
@ -1012,14 +1022,18 @@ ST_FUNC int tcc_open(TCCState *s1, const char *filename);
|
||||
ST_FUNC void tcc_close(void);
|
||||
|
||||
ST_FUNC int tcc_add_file_internal(TCCState *s1, const char *filename, int flags);
|
||||
ST_FUNC int tcc_add_dll(TCCState *s, const char *filename, int flags);
|
||||
ST_FUNC int tcc_add_crt(TCCState *s, const char *filename);
|
||||
#ifndef TCC_TARGET_PE
|
||||
ST_FUNC int tcc_add_dll(TCCState *s, const char *filename, int flags);
|
||||
#endif
|
||||
|
||||
PUB_FUNC int tcc_set_flag(TCCState *s, const char *flag_name, int value);
|
||||
PUB_FUNC void tcc_print_stats(TCCState *s, int64_t total_time);
|
||||
PUB_FUNC void set_num_callers(int n);
|
||||
|
||||
PUB_FUNC char *tcc_default_target(TCCState *s, const char *default_file);
|
||||
PUB_FUNC void tcc_gen_makedeps(TCCState *s, const char *target, const char *filename);
|
||||
#ifdef CONFIG_TCC_BACKTRACE
|
||||
PUB_FUNC void tcc_set_num_callers(int n);
|
||||
#endif
|
||||
|
||||
/* ------------ tccpp.c ------------ */
|
||||
|
||||
@ -1074,6 +1088,7 @@ ST_FUNC void preprocess_init(TCCState *s1);
|
||||
ST_FUNC void preprocess_new();
|
||||
ST_FUNC int tcc_preprocess(TCCState *s1);
|
||||
ST_FUNC void skip(int c);
|
||||
ST_FUNC void expect(const char *msg);
|
||||
|
||||
/* ------------ tccgen.c ------------ */
|
||||
|
||||
|
14
tccelf.c
14
tccelf.c
@ -2856,19 +2856,11 @@ static int filename_to_libname(TCCState *s1, const char filename[], char libname
|
||||
return 0;
|
||||
libprefix = !strncmp(filename, "lib", 3);
|
||||
if (!s1->static_link) {
|
||||
#ifdef TCC_TARGET_PE
|
||||
if (!strcmp(ext, ".def")) {
|
||||
size_t len = ext - filename;
|
||||
pstrncpy(libname, filename, len);
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
if (libprefix && (!strcmp(ext, ".so"))) {
|
||||
size_t len = ext - filename - 3;
|
||||
pstrncpy(libname, filename + 3, len);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
if (libprefix && (!strcmp(ext, ".a"))) {
|
||||
size_t len = ext - filename - 3;
|
||||
@ -2887,11 +2879,7 @@ static int filename_to_libname(TCCState *s1, const char filename[], char libname
|
||||
static void libname_to_filename(TCCState *s1, const char libname[], char filename[])
|
||||
{
|
||||
if (!s1->static_link) {
|
||||
#ifdef TCC_TARGET_PE
|
||||
sprintf(filename, "%s.def", libname);
|
||||
#else
|
||||
sprintf(filename, "lib%s.so", libname);
|
||||
#endif
|
||||
} else {
|
||||
sprintf(filename, "lib%s.a", libname);
|
||||
}
|
||||
@ -3029,4 +3017,4 @@ ST_FUNC int tcc_load_ldscript(TCCState *s1)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif /* ndef TCC_TARGET_PE */
|
||||
|
5
tccpp.c
5
tccpp.c
@ -94,6 +94,11 @@ ST_FUNC void skip(int c)
|
||||
next();
|
||||
}
|
||||
|
||||
ST_FUNC void expect(const char *msg)
|
||||
{
|
||||
error("%s expected", msg);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* CString handling */
|
||||
static void cstr_realloc(CString *cstr, int new_size)
|
||||
|
25
tccrun.c
25
tccrun.c
@ -20,6 +20,12 @@
|
||||
|
||||
#include "tcc.h"
|
||||
|
||||
#ifdef CONFIG_TCC_BACKTRACE
|
||||
ST_DATA int rt_num_callers = 6;
|
||||
ST_DATA const char **rt_bound_error_msg;
|
||||
ST_DATA void *rt_prog_main;
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define ucontext_t CONTEXT
|
||||
#endif
|
||||
@ -38,7 +44,7 @@ static void win64_add_function_table(TCCState *s1);
|
||||
/* Do all relocations (needed before using tcc_get_symbol())
|
||||
Returns -1 on error. */
|
||||
|
||||
int tcc_relocate(TCCState *s1)
|
||||
LIBTCCAPI int tcc_relocate(TCCState *s1)
|
||||
{
|
||||
int ret;
|
||||
#ifdef HAVE_SELINUX
|
||||
@ -73,7 +79,7 @@ int tcc_relocate(TCCState *s1)
|
||||
}
|
||||
|
||||
/* launch the compiled program with the given arguments */
|
||||
int tcc_run(TCCState *s1, int argc, char **argv)
|
||||
LIBTCCAPI int tcc_run(TCCState *s1, int argc, char **argv)
|
||||
{
|
||||
int (*prog_main)(int, char **);
|
||||
int ret;
|
||||
@ -213,6 +219,11 @@ static void set_pages_executable(void *ptr, unsigned long length)
|
||||
/* ------------------------------------------------------------- */
|
||||
#ifdef CONFIG_TCC_BACKTRACE
|
||||
|
||||
PUB_FUNC void tcc_set_num_callers(int n)
|
||||
{
|
||||
rt_num_callers = n;
|
||||
}
|
||||
|
||||
/* print the position in the source file of PC value 'pc' by reading
|
||||
the stabs debug information */
|
||||
static uplong rt_printline(uplong wanted_pc, const char *msg)
|
||||
@ -369,7 +380,7 @@ static void rt_error(ucontext_t *uc, const char *fmt, ...)
|
||||
va_end(ap);
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
for(i=0;i<num_callers;i++) {
|
||||
for(i=0;i<rt_num_callers;i++) {
|
||||
if (rt_get_caller_pc(&pc, uc, i) < 0)
|
||||
break;
|
||||
pc = rt_printline(pc, i ? "by" : "at");
|
||||
@ -650,12 +661,12 @@ static int rt_get_caller_pc(uplong *paddr, CONTEXT *uc, int level)
|
||||
#define RTLD_DEFAULT NULL
|
||||
|
||||
/* dummy function for profiling */
|
||||
void *dlopen(const char *filename, int flag)
|
||||
ST_FUNC void *dlopen(const char *filename, int flag)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void dlclose(void *p)
|
||||
ST_FUNC void dlclose(void *p)
|
||||
{
|
||||
}
|
||||
/*
|
||||
@ -682,7 +693,7 @@ static TCCSyms tcc_syms[] = {
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
void *resolve_sym(TCCState *s1, const char *symbol)
|
||||
ST_FUNC void *resolve_sym(TCCState *s1, const char *symbol)
|
||||
{
|
||||
TCCSyms *p;
|
||||
p = tcc_syms;
|
||||
@ -696,7 +707,7 @@ void *resolve_sym(TCCState *s1, const char *symbol)
|
||||
|
||||
#elif !defined(_WIN32)
|
||||
|
||||
void *resolve_sym(TCCState *s1, const char *sym)
|
||||
ST_FUNC void *resolve_sym(TCCState *s1, const char *sym)
|
||||
{
|
||||
return dlsym(RTLD_DEFAULT, sym);
|
||||
}
|
||||
|
@ -3,8 +3,6 @@
|
||||
@rem ----------------------------------------------------
|
||||
|
||||
echo>..\config.h #define TCC_VERSION "0.9.25"
|
||||
echo>>..\config.h #define CONFIG_TCCDIR "."
|
||||
echo>>..\config.h #define CONFIG_SYSROOT ""
|
||||
|
||||
@if _%PROCESSOR_ARCHITEW6432%_==_AMD64_ goto x86_64
|
||||
@if _%PROCESSOR_ARCHITECTURE%_==_AMD64_ goto x86_64
|
||||
@ -31,7 +29,9 @@ if not exist libtcc\nul mkdir libtcc
|
||||
copy ..\libtcc.h libtcc\libtcc.h
|
||||
%CC% %target% -DONE_SOURCE ../libtcc.c -c -o libtcc.o
|
||||
%AR% rcs libtcc/libtcc.a libtcc.o
|
||||
%CC% %target% -shared -DLIBTCC_AS_DLL -DONE_SOURCE ../libtcc.c -o libtcc/libtcc.dll
|
||||
:libtcc.dll
|
||||
%CC% %target% -shared -DLIBTCC_AS_DLL -DONE_SOURCE ../libtcc.c -o libtcc.dll
|
||||
tiny_impdef libtcc.dll -o lib/libtcc.def
|
||||
|
||||
:tcc
|
||||
%CC% %target% ../tcc.c -o tcc.exe -ltcc -Llibtcc
|
||||
@ -61,3 +61,7 @@ tiny_libmaker lib/libtcc1.a libtcc1.o alloca86_64.o crt1.o wincrt1.o dllcrt1.o d
|
||||
|
||||
:the_end
|
||||
del *.o
|
||||
|
||||
:libtcc_test
|
||||
.\tcc -v -I libtcc -ltcc ../tests/libtcc_test.c
|
||||
.\libtcc_test
|
||||
|
Loading…
Reference in New Issue
Block a user