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
135NATIVE_FILES=$(ARM_FILES)135NATIVE_FILES=$(ARM_FILES)
136PROGS_CROSS=$(I386_CROSS) $(X64_CROSS) $(WIN32_CROSS) $(WIN64_CROSS) $(C67_CROSS)136PROGS_CROSS=$(I386_CROSS) $(X64_CROSS) $(WIN32_CROSS) $(WIN64_CROSS) $(C67_CROSS)
137LIBTCC1=libtcc1.a137LIBTCC1=libtcc1.a
138LIBTCC1_CROSS=lib/i386-win32/libtcc1.a lib/x86_64-win32/libtcc1.a lib/i386/libtcc1.a
138endif139endif
139PROGS_CROSS_LINK=$(foreach PROG_CROSS,$(PROGS_CROSS),$($(PROG_CROSS)_LINK))140PROGS_CROSS_LINK=$(foreach PROG_CROSS,$(PROGS_CROSS),$($(PROG_CROSS)_LINK))
140 141
@@ -278,7 +279,7 @@ endif · 137 unmodified lines
278ifdef CONFIG_CROSS279ifdef CONFIG_CROSS
279 mkdir -p "$(tccdir)/win32/lib/32"280 mkdir -p "$(tccdir)/win32/lib/32"
280 mkdir -p "$(tccdir)/win32/lib/64"281 mkdir -p "$(tccdir)/win32/lib/64"
281ifeq ($(ARCH),x86-64)282ifneq ($(ARCH),i386)
282 mkdir -p "$(tccdir)/i386"283 mkdir -p "$(tccdir)/i386"
283 $(INSTALL) -m644 lib/i386/libtcc1.a "$(tccdir)/i386"284 $(INSTALL) -m644 lib/i386/libtcc1.a "$(tccdir)/i386"
284 cp -r "$(tccdir)/include" "$(tccdir)/i386"285 cp -r "$(tccdir)/include" "$(tccdir)/i386"
@@ -287,7 +288,7 @@ endif · 2 unmodified lines
287 $(INSTALL) -m644 lib/i386-win32/libtcc1.a "$(tccdir)/win32/lib/32"288 $(INSTALL) -m644 lib/i386-win32/libtcc1.a "$(tccdir)/win32/lib/32"
288 $(INSTALL) -m644 lib/x86_64-win32/libtcc1.a "$(tccdir)/win32/lib/64"289 $(INSTALL) -m644 lib/x86_64-win32/libtcc1.a "$(tccdir)/win32/lib/64"
289 cp -r $(top_srcdir)/win32/include/. "$(tccdir)/win32/include"290 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"
291endif292endif
292 293
293uninstall:294uninstall:
@@ -300,7 +301,7 @@ uninstall: · 6 unmodified lines
300 rm -fv "$(libdir)/libtcc.so*"301 rm -fv "$(libdir)/libtcc.so*"
301 rm -rf "$(tccdir)/win32"302 rm -rf "$(tccdir)/win32"
302 -rmdir $(tccdir)/include303 -rmdir $(tccdir)/include
303ifeq ($(ARCH),x86-64)304ifneq ($(ARCH),i386)
304 rm -rf "$(tccdir)/i386"305 rm -rf "$(tccdir)/i386"
305endif306endif
306else307else
@@ -346,7 +347,7 @@ tcc-doc.info: tcc-doc.texi · 39 unmodified lines
346export LIBTCC1347export LIBTCC1
347 348
348%est:349%est:
349 $(MAKE) -C tests $@350 $(MAKE) -C tests $@ "PROGS_CROSS=$(PROGS_CROSS)"
350 351
351clean:352clean:
352 rm -vf $(PROGS) tcc_p$(EXESUF) tcc.pod *~ *.o *.a *.so* *.out *.exe libtcc_test$(EXESUF)353 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
16 abitest \16 abitest \
17 vla_test-run \17 vla_test-run \
18 moretests18 moretests
19ifdef CONFIG_CROSS
20TESTS += hello-cross
21endif
19 22
20# test4 -- problem with -static23# test4 -- problem with -static
21# asmtest -- minor differences with gcc24# asmtest -- minor differences with gcc
@@ -50,8 +53,9 @@ endif · 28 unmodified lines
50# run local version of tcc with local libraries and includes53# run local version of tcc with local libraries and includes
51TCCFLAGS = -B$(TOP) -I$(TOP) -I$(top_srcdir) -I$(top_srcdir)/include54TCCFLAGS = -B$(TOP) -I$(TOP) -I$(top_srcdir) -I$(top_srcdir)/include
52ifdef CONFIG_WIN3255ifdef 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)
54endif57endif
58XTCCFLAGS = -B$(TOP) -B$(top_srcdir)/win32 -I$(TOP) -I$(top_srcdir) -I$(top_srcdir)/include
55 59
56TCC = $(TOP)/tcc $(TCCFLAGS)60TCC = $(TOP)/tcc $(TCCFLAGS)
57RUN_TCC = $(NATIVE_DEFINES) -DONE_SOURCE -run $(top_srcdir)/tcc.c $(TCCFLAGS)61RUN_TCC = $(NATIVE_DEFINES) -DONE_SOURCE -run $(top_srcdir)/tcc.c $(TCCFLAGS)
@@ -69,6 +73,15 @@ hello-exe: ../examples/ex1.c · 11 unmodified lines
69 @echo ------------ $@ ------------73 @echo ------------ $@ ------------
70 $(TCC) $< -o hello$(EXESUF) || ($(TOP)/tcc -vv; exit 1) && ./hello$(EXESUF)74 $(TCC) $< -o hello$(EXESUF) || ($(TOP)/tcc -vv; exit 1) && ./hello$(EXESUF)
71 75
76hello-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
72hello-run: ../examples/ex1.c85hello-run: ../examples/ex1.c
73 @echo ------------ $@ ------------86 @echo ------------ $@ ------------
74 $(TCC) -run $<87 $(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