History

Improve cygwin Makefile that now support TARGET=32/64 to force final version for 32/64 platform

Christian Jullien committed 9 years ago

Commit 5550e431 parent 43d9a7d2 files · +30 −11Browse files

Unified · Split

2 files
  1. win32/Makefile +20 −11
  2. win32/tcc-win32.txt +10 −0
win32/Makefile+20−11
@@ -19,6 +19,16 @@ NATIVE = -m$(ARCH) -DTCC_TARGET_I386 · 18 unmodified lines
1919 PREFIX = i386
2020 endif
2121
22+TARGET = $(ARCH)
23+
24+ifeq ($(TARGET), 64)
25+TFLAGS = -m$(TARGET) -DTCC_TARGET_X86_64
26+TPREFIX = x86_64
27+else
28+TFLAGS = -m$(TARGET) -DTCC_TARGET_I386
29+TPREFIX = i386
30+endif
31+
2232 all: pre bootstrap libs rebuild
2333 @chmod 775 *.exe
2434 @ls -ls *.exe
@@ -70,7 +80,7 @@ lib/32/libtcc1.a: tiny_libmaker32.exe · 45 unmodified lines
7080 @./tiny_libmaker32 lib/32/libtcc1.a libtcc1.o alloca86.o alloca86-bt.o crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o
7181 @rm *.o
7282
73−lib/64/libtcc1.a: tcc.exe tiny_libmaker64.exe
83+lib/64/libtcc1.a: tiny_libmaker64.exe
7484 @echo Building $*.a with tcc -m64
7585 @./tcc -m64 -DTCC_TARGET_PE -DTCC_TARGET_X86_64 -c ../lib/libtcc1.c
7686 @./tcc -m64 -DTCC_TARGET_PE -DTCC_TARGET_X86_64 -c ../lib/alloca86_64.S
@@ -88,14 +98,14 @@ libs: lib/32/libtcc1.a lib/64/libtcc1.a · 11 unmodified lines
8898 PHONY += libs
8999
90100 rebuild:
91− @echo Rebuild using tcc itself - default $(ARCH)bits
92− @./$(PREFIX)-win32-tcc $(NATIVE) -DTCC_TARGET_PE -DONE_SOURCE -o tcc.exe ../tcc.c libtcc.dll
93− @./$(PREFIX)-win32-tcc $(NATIVE) -DTCC_TARGET_PE -DONE_SOURCE -o tiny_libmaker.exe tools/tiny_libmaker.c
94− @./tcc $(NATIVE) -DTCC_TARGET_PE -DONE_SOURCE -DLIBTCC_AS_DLL -o libtcc.dll -shared ../libtcc.c
95− @./tcc -m$(ARCH) -DTCC_TARGET_PE -DONE_SOURCE -DTCC_TARGET_I386 -o tmp-tcc.exe ../tcc.c && mv tmp-tcc.exe i386-win32-tcc.exe
96− @./tcc -m$(ARCH) -DTCC_TARGET_PE -DONE_SOURCE -DTCC_TARGET_X86_64 -o tmp-tcc.exe ../tcc.c && mv tmp-tcc.exe x86_64-win32-tcc.exe
97− @./tcc -m$(ARCH) -DTCC_TARGET_PE -DONE_SOURCE -DTCC_TARGET_I386 -o tiny_libmaker32.exe tools/tiny_libmaker.c
98− @./tcc -m$(ARCH) -DTCC_TARGET_PE -DONE_SOURCE -DTCC_TARGET_X86_64 -o tiny_libmaker64.exe tools/tiny_libmaker.c
101+ @echo Rebuild using tcc itself - default $(TARGET)bits
102+ @./$(TPREFIX)-win32-tcc $(TFLAGS) -DTCC_TARGET_PE -DONE_SOURCE -o tcc.exe ../tcc.c
103+ @./$(TPREFIX)-win32-tcc $(TFLAGS) -DTCC_TARGET_PE -DONE_SOURCE -o tiny_libmaker.exe tools/tiny_libmaker.c
104+ @./tcc $(TFLAGS) -DTCC_TARGET_PE -DONE_SOURCE -DLIBTCC_AS_DLL -o libtcc.dll -shared ../libtcc.c
105+ @./tcc -m$(TARGET) -DTCC_TARGET_PE -DONE_SOURCE -DTCC_TARGET_I386 -o tmp-tcc.exe ../tcc.c && mv tmp-tcc.exe i386-win32-tcc.exe
106+ @./tcc -m$(TARGET) -DTCC_TARGET_PE -DONE_SOURCE -DTCC_TARGET_X86_64 -o tmp-tcc.exe ../tcc.c && mv tmp-tcc.exe x86_64-win32-tcc.exe
107+ @./tcc -m$(TARGET) -DTCC_TARGET_PE -DONE_SOURCE -DTCC_TARGET_I386 -o tiny_libmaker32.exe tools/tiny_libmaker.c
108+ @./tcc -m$(TARGET) -DTCC_TARGET_PE -DONE_SOURCE -DTCC_TARGET_X86_64 -o tiny_libmaker64.exe tools/tiny_libmaker.c
99109
100110 PHONY += rebuild
101111
@@ -110,7 +120,6 @@ tarball: · 8 unmodified lines
110120 @cp -r lib $(TARNAME)
111121 @cp -r libtcc $(TARNAME)
112122 @cp -r tools $(TARNAME)
113−# @cp -r vs2015 $(TARNAME)
114123 @cp -r build-tcc.bat $(TARNAME)
115124 @cp -r i386-win32-tcc.exe $(TARNAME)
116125 @cp -r libtcc.def $(TARNAME)
@@ -128,4 +137,4 @@ tarball: · 11 unmodified lines
128137 PHONY += tarball
129138
130139 clean:
131− rm -f *.o *.exe *.dll lib/*/*.a
140+ rm -f *.o *.exe *.dll lib/*/*.a *.pdb *.obj *.exp *.def *.lib
win32/tcc-win32.txt+10−0
@@ -128,6 +128,16 @@ · 127 unmodified lines
128128 Also you can copy/install everything into another directory:
129129 > build-tcc.bat -i <dir>
130130
131+ * You can also bootstrap a native tcc Windows toolchain with cygwin.
132+ https://www.cygwin.com/
133+
134+ Install Base, gcc, make
135+ Launch Cygwin Terminal
136+ > make
137+ or to force 32bit executables (including 64bit backend)
138+ > make TARGET=32
139+ or to force 64bit executables (including 32bit backend)
140+ > make TARGET=64
131141
132142 Limitations:
133143 ------------

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