History

Various Makefile fixes for cross-compilation

- Build libtcc1 for cross-compiler on arm (arm to X cross compilers) - Install libtcc1 and includes for arm to i386 cross compiler - Add basic check of cross-compilers (compile ex1.c)

Thomas Preud'homme committed 12 years ago

Commit 767410b1 parent da0601e2 files · +19 −5Browse files

Unified · Split

2 files
  1. Makefile +5 −4
  2. tests/Makefile +14 −1
Makefile+5−4
@@ -135,6 +135,7 @@ else ifeq ($(ARCH),arm) · 134 unmodified lines
135135 NATIVE_FILES=$(ARM_FILES)
136136 PROGS_CROSS=$(I386_CROSS) $(X64_CROSS) $(WIN32_CROSS) $(WIN64_CROSS) $(C67_CROSS)
137137 LIBTCC1=libtcc1.a
138+LIBTCC1_CROSS=lib/i386-win32/libtcc1.a lib/x86_64-win32/libtcc1.a lib/i386/libtcc1.a
138139 endif
139140 PROGS_CROSS_LINK=$(foreach PROG_CROSS,$(PROGS_CROSS),$($(PROG_CROSS)_LINK))
140141
@@ -278,7 +279,7 @@ endif · 137 unmodified lines
278279 ifdef CONFIG_CROSS
279280 mkdir -p "$(tccdir)/win32/lib/32"
280281 mkdir -p "$(tccdir)/win32/lib/64"
281−ifeq ($(ARCH),x86-64)
282+ifneq ($(ARCH),i386)
282283 mkdir -p "$(tccdir)/i386"
283284 $(INSTALL) -m644 lib/i386/libtcc1.a "$(tccdir)/i386"
284285 cp -r "$(tccdir)/include" "$(tccdir)/i386"
@@ -287,7 +288,7 @@ endif · 2 unmodified lines
287288 $(INSTALL) -m644 lib/i386-win32/libtcc1.a "$(tccdir)/win32/lib/32"
288289 $(INSTALL) -m644 lib/x86_64-win32/libtcc1.a "$(tccdir)/win32/lib/64"
289290 cp -r $(top_srcdir)/win32/include/. "$(tccdir)/win32/include"
290− cp -r $(top_srcdir)/include/. "$(tccdir)/win32/include"
291+ cp -r "$(tccdir)/include" "$(tccdir)/win32"
291292 endif
292293
293294 uninstall:
@@ -300,7 +301,7 @@ uninstall: · 6 unmodified lines
300301 rm -fv "$(libdir)/libtcc.so*"
301302 rm -rf "$(tccdir)/win32"
302303 -rmdir $(tccdir)/include
303−ifeq ($(ARCH),x86-64)
304+ifneq ($(ARCH),i386)
304305 rm -rf "$(tccdir)/i386"
305306 endif
306307 else
@@ -346,7 +347,7 @@ tcc-doc.info: tcc-doc.texi · 39 unmodified lines
346347 export LIBTCC1
347348
348349 %est:
349− $(MAKE) -C tests $@
350+ $(MAKE) -C tests $@ "PROGS_CROSS=$(PROGS_CROSS)"
350351
351352 clean:
352353 rm -vf $(PROGS) tcc_p$(EXESUF) tcc.pod *~ *.o *.a *.so* *.out *.exe libtcc_test$(EXESUF)
tests/Makefile+14−1
@@ -16,6 +16,9 @@ TESTS = \ · 15 unmodified lines
1616 abitest \
1717 vla_test-run \
1818 moretests
19+ifdef CONFIG_CROSS
20+TESTS += hello-cross
21+endif
1922
2023 # test4 -- problem with -static
2124 # asmtest -- minor differences with gcc
@@ -50,8 +53,9 @@ endif · 28 unmodified lines
5053 # run local version of tcc with local libraries and includes
5154 TCCFLAGS = -B$(TOP) -I$(TOP) -I$(top_srcdir) -I$(top_srcdir)/include
5255 ifdef CONFIG_WIN32
53− TCCFLAGS = -B$(top_srcdir)/win32 -I$(top_srcdir) -I$(top_srcdir)/include -I$(TOP) -L$(TOP)
56+ TCCFLAGS = -B$(top_srcdir)/win32 --I$(top_srcdir) -I$(top_srcdir)/include -I$(TOP) -L$(TOP)
5457 endif
58+XTCCFLAGS = -B$(TOP) -B$(top_srcdir)/win32 -I$(TOP) -I$(top_srcdir) -I$(top_srcdir)/include
5559
5660 TCC = $(TOP)/tcc $(TCCFLAGS)
5761 RUN_TCC = $(NATIVE_DEFINES) -DONE_SOURCE -run $(top_srcdir)/tcc.c $(TCCFLAGS)
@@ -69,6 +73,15 @@ hello-exe: ../examples/ex1.c · 11 unmodified lines
6973 @echo ------------ $@ ------------
7074 $(TCC) $< -o hello$(EXESUF) || ($(TOP)/tcc -vv; exit 1) && ./hello$(EXESUF)
7175
76+hello-cross: ../examples/ex1.c
77+ @echo ------------ $@ ------------
78+ for XTCC in $(PROGS_CROSS) ; \
79+ do echo -n "Test of $$XTCC... "; \
80+ out=$$($(TOP)/$$XTCC $(XTCCFLAGS) -c $< 2>&1); \
81+ test $$? -ne 0 && { echo "Failed\n$$out\n" ; $(TOP)/$$XTCC -vv; exit 1; } ; \
82+ echo "Success"; \
83+ done
84+
7285 hello-run: ../examples/ex1.c
7386 @echo ------------ $@ ------------
7487 $(TCC) -run $<

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