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
157157
158158 # Cross Tiny C Compilers
159159 %-tcc$(EXESUF):
160− $(CC) -o $@ tcc.c $(DEFINES) $(CFLAGS) $(LIBS) $(LDFLAGS)
160+ $(CC) -o $@ tcc.c -DONE_SOURCE $(DEFINES) $(CFLAGS) $(LIBS) $(LDFLAGS)
161161
162162 $(I386_CROSS): DEFINES = -DTCC_TARGET_I386 -DCONFIG_TCCDIR="\"$(tccdir)/i386\""
163163 $(X64_CROSS): DEFINES = -DTCC_TARGET_X86_64
@@ -179,14 +179,13 @@ $(C67_CROSS): $(C67_FILES) · 15 unmodified lines
179179 $(ARM_FPA_CROSS) $(ARM_FPA_LD_CROSS) $(ARM_VFP_CROSS) $(ARM_EABI_CROSS): $(ARM_FILES)
180180
181181 # libtcc generation and test
182−ifdef NOTALLINONE
182+ifndef ONE_SOURCE
183183 LIBTCC_OBJ = $(filter-out tcc.o,$(patsubst %.c,%.o,$(filter %.c,$(NATIVE_FILES))))
184184 LIBTCC_INC = $(filter %.h,$(CORE_FILES)) $(filter-out $(CORE_FILES),$(NATIVE_FILES))
185−$(LIBTCC_OBJ) tcc.o : NATIVE_DEFINES += -DNOTALLINONE
186185 else
187186 LIBTCC_OBJ = libtcc.o
188187 LIBTCC_INC = $(NATIVE_FILES)
189−tcc.o : NATIVE_DEFINES += -DNOTALLINONE
188+$(LIBTCC_OBJ) tcc.o : NATIVE_DEFINES += -DONE_SOURCE
190189 endif
191190
192191 $(LIBTCC_OBJ) tcc.o : %.o : %.c $(LIBTCC_INC)
arm-gen.c+6−3
@@ -102,10 +102,8 @@ enum { · 101 unmodified lines
102102 //#define FUNC_STRUCT_PARAM_AS_PTR
103103
104104 #if defined(TCC_ARM_EABI) && defined(TCC_ARM_VFP)
105−#ifdef NEED_FLOAT_TYPES
106−static CType float_type, double_type, func_float_type, func_double_type;
105+ST_DATA CType float_type, double_type, func_float_type, func_double_type;
107106 #define func_ldouble_type func_double_type
108−#endif
109107 #else
110108 #define func_float_type func_old_type
111109 #define func_double_type func_old_type
@@ -172,6 +170,11 @@ ST_DATA const int reg_classes[NB_REGS] = { · 60 unmodified lines
172170 #endif
173171 };
174172
173+/* keep in sync with line 104 above */
174+#if defined(TCC_ARM_EABI) && defined(TCC_ARM_VFP)
175+ST_DATA CType float_type, double_type, func_float_type, func_double_type;
176+#endif
177+
175178 static int func_sub_sp_offset, last_itod_magic;
176179 static int leaffunc;
177180
libtcc.c+1−2
@@ -18,7 +18,6 @@ · 17 unmodified lines
1818 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1919 */
2020
21−#define NEED_FLOAT_TYPES
2221 #include "tcc.h"
2322
2423 /********************************************************/
@@ -41,7 +40,7 @@ ST_DATA void *rt_prog_main; · 16 unmodified lines
4140
4241 /********************************************************/
4342
44−#ifndef NOTALLINONE
43+#ifdef ONE_SOURCE
4544 #include "tccpp.c"
4645 #include "tccgen.c"
4746 #include "tccelf.c"
tcc.c+3−3
@@ -18,10 +18,10 @@ · 17 unmodified lines
1818 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1919 */
2020
21−#if defined NOTALLINONE || defined TCC_USE_LIBTCC
22−#include "tcc.h"
23−#else
21+#ifdef ONE_SOURCE
2422 #include "libtcc.c"
23+#else
24+#include "tcc.h"
2525 #endif
2626
2727 static char **files;
tcc.h+2−2
@@ -877,7 +877,7 @@ static inline int toup(int c) · 876 unmodified lines
877877
878878 #define PUB_FUNC
879879
880−#ifndef NOTALLINONE
880+#ifdef ONE_SOURCE
881881 #define ST_INLN static inline
882882 #define ST_FUNC static
883883 #define ST_DATA static
@@ -1278,7 +1278,7 @@ ST_DATA const int reg_classes[NB_REGS]; · 394 unmodified lines
12781278
12791279 /********************************************************/
12801280 #undef ST_DATA
1281−#ifndef NOTALLINONE
1281+#ifdef ONE_SOURCE
12821282 #define ST_DATA static
12831283 #else
12841284 #define ST_DATA
tccpe.c+1−1
@@ -376,7 +376,7 @@ static int pe_find_import(TCCState * s1, ElfW(Sym) *sym) · 375 unmodified lines
376376 {
377377 char buffer[200];
378378 const char *s, *p;
379− int sym_index, n = 0;
379+ int sym_index = 0, n = 0;
380380
381381 do {
382382 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
2929 :libtcc
3030 if not exist libtcc\nul mkdir libtcc
3131 copy ..\libtcc.h libtcc\libtcc.h
32−%CC% %target% -fno-strict-aliasing ../libtcc.c -c -o libtcc.o
32+%CC% %target% -fno-strict-aliasing -DONE_SOURCE ../libtcc.c -c -o libtcc.o
3333 %AR% rcs libtcc/libtcc.a libtcc.o
3434
3535 :tcc
36−%CC% %target% -fno-strict-aliasing ../tcc.c -o tcc.exe -DTCC_USE_LIBTCC -ltcc -Llibtcc
36+%CC% %target% -fno-strict-aliasing ../tcc.c -o tcc.exe -ltcc -Llibtcc
3737
3838 :copy_std_includes
3939 copy ..\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