History

make: create native tcc from separate objects

This was already possible using make NOTALLINONE=1 and is now the default. To build as previously from one big source, use make ONE_SOURCE=1 Cross compilers are still build from one source because using separate objects requires separate build directories one per platform which currently is not (yet) supported by the makefile. We could probably use gnu-makeish target variables like $(I386_CROSS): OUTDIR=build/i386 $(X64_CROSS): OUTDIR=build/x86-64 and so on ... Also NEED_FLOAT_TYPES for arm-gen is removed. It was about variables that are referenced from outside (libtcc, tccgen). We could declare them in tcc.h (as with reg_classes) or have them twice in arm-gen.c. I chose option 2.

grischka committed 15 years ago

Commit 52802931 parent 4ccb5667 files · +18 −17Browse files

Unified · Split

7 files
  1. Makefile +3 −4
  2. arm-gen.c +6 −3
  3. libtcc.c +1 −2
  4. tcc.c +3 −3
  5. tcc.h +2 −2
  6. tccpe.c +1 −1
  7. win32/build-tcc.bat +2 −2
Makefile+3−4
@@ -157,7 +157,7 @@ tcc$(EXESUF): tcc.o $(LIBTCC) · 156 unmodified lines
157 157
158# Cross Tiny C Compilers158# Cross Tiny C Compilers
159%-tcc$(EXESUF):159%-tcc$(EXESUF):
160 $(CC) -o $@ tcc.c $(DEFINES) $(CFLAGS) $(LIBS) $(LDFLAGS)160 $(CC) -o $@ tcc.c -DONE_SOURCE $(DEFINES) $(CFLAGS) $(LIBS) $(LDFLAGS)
161 161
162$(I386_CROSS): DEFINES = -DTCC_TARGET_I386 -DCONFIG_TCCDIR="\"$(tccdir)/i386\""162$(I386_CROSS): DEFINES = -DTCC_TARGET_I386 -DCONFIG_TCCDIR="\"$(tccdir)/i386\""
163$(X64_CROSS): DEFINES = -DTCC_TARGET_X86_64163$(X64_CROSS): DEFINES = -DTCC_TARGET_X86_64
@@ -179,14 +179,13 @@ $(C67_CROSS): $(C67_FILES) · 15 unmodified lines
179$(ARM_FPA_CROSS) $(ARM_FPA_LD_CROSS) $(ARM_VFP_CROSS) $(ARM_EABI_CROSS): $(ARM_FILES)179$(ARM_FPA_CROSS) $(ARM_FPA_LD_CROSS) $(ARM_VFP_CROSS) $(ARM_EABI_CROSS): $(ARM_FILES)
180 180
181# libtcc generation and test181# libtcc generation and test
182ifdef NOTALLINONE182ifndef ONE_SOURCE
183LIBTCC_OBJ = $(filter-out tcc.o,$(patsubst %.c,%.o,$(filter %.c,$(NATIVE_FILES))))183LIBTCC_OBJ = $(filter-out tcc.o,$(patsubst %.c,%.o,$(filter %.c,$(NATIVE_FILES))))
184LIBTCC_INC = $(filter %.h,$(CORE_FILES)) $(filter-out $(CORE_FILES),$(NATIVE_FILES))184LIBTCC_INC = $(filter %.h,$(CORE_FILES)) $(filter-out $(CORE_FILES),$(NATIVE_FILES))
185$(LIBTCC_OBJ) tcc.o : NATIVE_DEFINES += -DNOTALLINONE
186else185else
187LIBTCC_OBJ = libtcc.o186LIBTCC_OBJ = libtcc.o
188LIBTCC_INC = $(NATIVE_FILES)187LIBTCC_INC = $(NATIVE_FILES)
189tcc.o : NATIVE_DEFINES += -DNOTALLINONE188$(LIBTCC_OBJ) tcc.o : NATIVE_DEFINES += -DONE_SOURCE
190endif189endif
191 190
192$(LIBTCC_OBJ) tcc.o : %.o : %.c $(LIBTCC_INC)191$(LIBTCC_OBJ) tcc.o : %.o : %.c $(LIBTCC_INC)
arm-gen.c+6−3
@@ -102,10 +102,8 @@ enum { · 101 unmodified lines
102//#define FUNC_STRUCT_PARAM_AS_PTR102//#define FUNC_STRUCT_PARAM_AS_PTR
103 103
104#if defined(TCC_ARM_EABI) && defined(TCC_ARM_VFP)104#if defined(TCC_ARM_EABI) && defined(TCC_ARM_VFP)
105#ifdef NEED_FLOAT_TYPES105ST_DATA CType float_type, double_type, func_float_type, func_double_type;
106static CType float_type, double_type, func_float_type, func_double_type;
107#define func_ldouble_type func_double_type106#define func_ldouble_type func_double_type
108#endif
109#else107#else
110#define func_float_type func_old_type108#define func_float_type func_old_type
111#define func_double_type func_old_type109#define func_double_type func_old_type
@@ -172,6 +170,11 @@ ST_DATA const int reg_classes[NB_REGS] = { · 60 unmodified lines
172#endif170#endif
173};171};
174 172
173/* keep in sync with line 104 above */
174#if defined(TCC_ARM_EABI) && defined(TCC_ARM_VFP)
175ST_DATA CType float_type, double_type, func_float_type, func_double_type;
176#endif
177
175static int func_sub_sp_offset, last_itod_magic;178static int func_sub_sp_offset, last_itod_magic;
176static int leaffunc;179static int leaffunc;
177 180
libtcc.c+1−2
@@ -18,7 +18,6 @@ · 17 unmodified lines
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */19 */
20 20
21#define NEED_FLOAT_TYPES
22#include "tcc.h"21#include "tcc.h"
23 22
24/********************************************************/23/********************************************************/
@@ -41,7 +40,7 @@ ST_DATA void *rt_prog_main; · 16 unmodified lines
41 40
42/********************************************************/41/********************************************************/
43 42
44#ifndef NOTALLINONE43#ifdef ONE_SOURCE
45#include "tccpp.c"44#include "tccpp.c"
46#include "tccgen.c"45#include "tccgen.c"
47#include "tccelf.c"46#include "tccelf.c"
tcc.c+3−3
@@ -18,10 +18,10 @@ · 17 unmodified lines
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */19 */
20 20
21#if defined NOTALLINONE || defined TCC_USE_LIBTCC21#ifdef ONE_SOURCE
22#include "tcc.h"
23#else
24#include "libtcc.c"22#include "libtcc.c"
23#else
24#include "tcc.h"
25#endif25#endif
26 26
27static char **files;27static char **files;
tcc.h+2−2
@@ -877,7 +877,7 @@ static inline int toup(int c) · 876 unmodified lines
877 877
878#define PUB_FUNC 878#define PUB_FUNC
879 879
880#ifndef NOTALLINONE880#ifdef ONE_SOURCE
881#define ST_INLN static inline881#define ST_INLN static inline
882#define ST_FUNC static882#define ST_FUNC static
883#define ST_DATA static883#define ST_DATA static
@@ -1278,7 +1278,7 @@ ST_DATA const int reg_classes[NB_REGS]; · 394 unmodified lines
1278 1278
1279/********************************************************/1279/********************************************************/
1280#undef ST_DATA1280#undef ST_DATA
1281#ifndef NOTALLINONE1281#ifdef ONE_SOURCE
1282#define ST_DATA static1282#define ST_DATA static
1283#else1283#else
1284#define ST_DATA1284#define ST_DATA
tccpe.c+1−1
@@ -376,7 +376,7 @@ static int pe_find_import(TCCState * s1, ElfW(Sym) *sym) · 375 unmodified lines
376{376{
377 char buffer[200];377 char buffer[200];
378 const char *s, *p;378 const char *s, *p;
379 int sym_index, n = 0;379 int sym_index = 0, n = 0;
380 380
381 do {381 do {
382 s = pe_export_name(s1, sym);382 s = pe_export_name(s1, sym);
win32/build-tcc.bat+2−2
@@ -29,11 +29,11 @@ echo>>..\config.h #define CONFIG_SYSROOT "" · 28 unmodified lines
29:libtcc29:libtcc
30if not exist libtcc\nul mkdir libtcc30if not exist libtcc\nul mkdir libtcc
31copy ..\libtcc.h libtcc\libtcc.h31copy ..\libtcc.h libtcc\libtcc.h
32%CC% %target% -fno-strict-aliasing ../libtcc.c -c -o libtcc.o32%CC% %target% -fno-strict-aliasing -DONE_SOURCE ../libtcc.c -c -o libtcc.o
33%AR% rcs libtcc/libtcc.a libtcc.o33%AR% rcs libtcc/libtcc.a libtcc.o
34 34
35:tcc35:tcc
36%CC% %target% -fno-strict-aliasing ../tcc.c -o tcc.exe -DTCC_USE_LIBTCC -ltcc -Llibtcc36%CC% %target% -fno-strict-aliasing ../tcc.c -o tcc.exe -ltcc -Llibtcc
37 37
38:copy_std_includes38:copy_std_includes
39copy ..\include\*.h include39copy ..\include\*.h include

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t